Font Size: a A A

Research On Automatic Backtesting And Trading Technology

Posted on:2023-04-08Degree:MasterType:Thesis
Country:ChinaCandidate:X R ZhangFull Text:PDF
GTID:2568306914483164Subject:Electronic Science and Technology
Abstract/Summary:PDF Full Text Request
Quantitative trading is the process of transforming the investment idea into an investment model,testing the effectiveness of the investment model with historical tick(back test),trading with the investment model.The model of separating the trading server from the market server is the most common due to the CPU load.A large number of different users send orders from the same IP is considered illegal agent financing in China.Therefore,users need to use the tick received from the market server to send orders locally.Due to the first come,first served mechanism.The earlier the order is sent,the higher the transaction rate.It is necessary to synchronize the contract with large trading volume(main contract)subscribed on the trading server to the market server prior to other contract.At present,MySQL supports data synchronization technology,but it can not give priority to synchronization for special data.In addition,the back test trading system currently existing in the market is not completely automated.Each strategy only automatically selects whether to send the trading signal,and does not make any adjustment intervention on the return of all strategies,which will make the return unable to be maximized or even unpredictable losses.The main contributions of this paper are as follows:(1)Based on MySQL master-slave,this paper proposes that filtering and priority synchronization on the trading server.Through the main contract algorithm,the main contract of each breed is automatically filtered and attached with the highest priority,put into the priority queue under multithreading.It is first synchronized to the binlog of market server through the network IO,and the binlog is parsed from the market server for consumption.Through comparing with MySQL master-slave,it is proved that when the number of processes is 1-8 and the continuous data synchronization,the synchronization completion time of main contract is 104~105(unit:microsecond)higher than MySQL master-slave,the average optimization time is about 50%.(2)This paper proposes a method based on portfolio optimization and capital management.After the back test results of each strategy are obtained,and the initial capital is allocated according to the results.Then use the capital management strategy written by the user to obtain the realtime results of strategy in the process of ordering,dynamically allocate the available capitals and stop or restart the strategy.It is designed and implemented as a automatic back test trading system based on portfolio optimization and capital management.This paper verifies that under seven different contracts for 7 days at random in a month,the automatic back test trading system improves the average return of strategy by an average of 0.33%.(3)A automatic back test trading system based on event driven engine called libevent+multiplexing mechanism called epoll+thread pool is designed and implemented.Firstly,A large number of concurrent connections and requests are processed through the interface provided by epoll.Secondly,the request is constructed as a custom structure to adapt to the libevent.Finally,the idle threads in the thread pool are scheduled to consume events waiting to be processed in the event engine.Through concurrent test and stability test,it is proved that the system can be used for(1)and(2)experiments.
Keywords/Search Tags:MySQL master-slave, main contract, portfolio optimization, capital management, quantitative transaction
PDF Full Text Request
Related items