National debt future day real-time transaction method based on order book
Through the intraday real-time trading method based on the order book, the order sheet information is used to generate quantity and price factors and perform signal calibration, the problem of unstable returns in treasury bond futures price prediction and trading is solved, and stable investment returns under high-frequency market conditions are achieved.
Patent Information
- Application Number
- CN202411423447.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-12-06
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
It is difficult for existing technology to predict the ups and downs of treasury bond futures prices in the shorter cycle in the future through high-frequency market data, resulting in unstable investment returns.
The intraday real-time trading method based on the order book is adopted, through the steps of factor classification, factor expansion, factor screening, transaction parameter acquisition, market data reception, signal processing and position calculation, the order sheet information is used to generate quantity and price factors, combined with the effectiveness of multi-dimensional factors. The evaluation indicators are calibrated and positioned to realize programmatic ordering.
Treasury bond futures price prediction and trading under high-frequency market data conditions have been achieved, which has improved the stability of investment returns and net value growth, and avoided the problems of long position cycles and unclear returns characteristics of traditional trading strategies.
Smart Images

Figure CN119295216A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quantitative trading, and in particular to an intraday real-time trading method for treasury bond futures based on an order book. Background Art
[0002] After the release of the new asset management regulations, the period of guaranteed dividends for wealth management products has gradually become history. As market yields gradually decline, the yields of stable assets that residents can allocate continue to decline. Products with considerable yields generally have problems such as high volatility and high requirements for timing ability. Therefore, the current financial market is increasingly in need of an investable product with stable income characteristics, relatively considerable yields, and low volatility and drawdown ratios. Based on this, the intraday real-time trading strategy stands out. It is a fast turnaround operation, which may place hundreds or thousands of transactions every day, and the shortest holding period can be seconds. It uses historical backtesting to find effective factors and believes that the factors will remain effective in the future. The simple logic, and then gradually approaches the theoretical winning rate through frequent transactions, obtains a higher daily and weekly winning rate, and then brings the characteristics of stable growth of product net value; at the same time, the traditional manual trading order placement speed is relatively slow, and there are certain operational risks and moral risks. The logic is converted into code and rolled and cyclically calculated when the market arrives, and the order is placed directly in a programmatic way, which has the characteristics of accurate transaction execution, extremely short decision-making time, no fatigue and misoperation, clear logic and easy modification, and no strategy drift due to psychological fluctuations. Therefore, for the intraday real-time trading strategy that captures real-time market conditions and places orders quickly, programmatic trading is the best choice.
[0003] Traditional trading strategies are mainly based on subjective value investment, and rely on the judgment of investors and traders to analyze and operate market trends. They have high uncertainty and long holding periods. The correctness of an investment strategy needs to be measured on a monthly, quarterly or even annual basis. The market is in urgent need of a strategy that can complete multiple complete transactions within a day, has high certainty and is quickly verified. Among them, the order book strategy, as a typical high-frequency programmatic trading, can obtain the quantity, price, and active buying and selling information of each gear in real time, and quickly judge the strength of buyers and sellers through factors that have been shown to be effective in historical backtesting, calculate the game victory, and go to the market from the essential logic of how prices are formed. It has the advantages of high winning rate, frequent transactions, and strong verifiability, and is a good supplement to the subjective trading strategies that are prevalent in the market.
[0004] Of course, in programmatic trading, not all factors can predict market trends, and they need to be effectively screened and identified. Machine learning algorithms, especially dimensionality reduction technology and feature selection methods, can process high-dimensional feature data composed of huge quantitative factors, capture nonlinear relationships and complex patterns in the data, save the time and energy required for manual judgment, and significantly improve the quality and efficiency of trading decisions. At the same time, it should be noted that the financial market is dynamic and effective factors may change over time. Machine learning algorithms can automatically adjust according to new data, adapt to market changes, maintain the timeliness of quantitative factors, and ensure that programmatic trading can maximize sustained and stable returns. The above problems need to be solved urgently. To this end, a real-time intraday trading method for Treasury bond futures based on an order book is proposed.
[0005] The following is an explanation of some technical terms:
[0006] Programmed trading: a trading model that uses computers to replace manual operations to place orders. High-frequency trading in programmed trading features frequent transactions of investment targets, fast order placement, and extremely low latency.
[0007] Spot: refers to commodities that can be traded at any time. Any commodity that we can get directly after paying in supermarkets, stores, online platforms, etc. is called spot. In the bulk market, spot also includes all kinds of commodities that can be delivered immediately, such as gold, crude oil, agricultural products, industrial raw materials, etc. It should be noted that spot is not all physical, touchable, and physically perceptible. For example, non-physical (electronic accounting) stocks and bonds are all spot.
[0008] Treasury bond spot (spot bond): refers to a type of government bond issued by the central government to raise fiscal funds. It is a debt certificate issued by the central government to investors, promising to pay interest within a certain period and repay the principal upon maturity. It has different maturities, such as 2 years, 5 years, 10 years, 30 years, etc.
[0009] Futures: The symmetry of spot, refers to a contract for the delivery of a certain spot on a certain date in the future. It is usually standardized, so it can be bought and sold on the exchange. For example, RB2406 refers to the rebar (codenamed RB) contract listed and traded on the Shanghai Futures Exchange. If you buy and hold 1 lot of RB2406 contract in advance, you can exchange it for 10 tons of standard rebar spot at the designated warehouse on June 15, 24 (the contract stipulates that the delivery date is the 15th). It should be noted that the subject matter of futures contracts can be physical commodities such as gold, crude oil, rebar, etc., or non-physical financial instruments such as stocks, bonds, etc.
[0010] Treasury bond futures: Futures contracts with the underlying being spot treasury bonds, listed and traded on the China Financial Futures Exchange, with four different varieties: TS (2-year), TF (5-year), T (10-year), and TL (30-year). For the 10-year treasury bond futures among treasury bond futures, the underlying is the futures contract for the 10-year treasury bond spot (spot bond). Four contracts rotate as the main contracts each year and are adjusted on a quarterly basis. Taking 2024 as an example, the names of the contracts that were listed successively are T2403, T2406, T2409, and T2412, and the corresponding delivery months are March, June, September, and December of 2024, respectively. Similarly, the four contracts in 2025 are T2503, T2506, T2509, and T2512, and so on. The price of treasury bond futures will fluctuate within the day due to various factors, see Fig.12 , which is the price fluctuation of 10-year Treasury futures for delivery in September 2024 within a certain 10 days.
[0011] Order: It is to send one's transaction intention to the market, which includes two elements: quantity and price. For example, buy 100 shares of Moutai at a price of 1,700 yuan, buy 20 lots of 10-year Treasury bond futures at a price of 100.005, etc. Orders are mainly divided into limit orders and market orders. For market orders in orders, the price is loose and the time is strict, that is, the order issued requires immediate execution (generally directly matching the counterparty price, such as the market order issued by the seller can only be executed at the buyer's current best price), but the transaction price is not limited. A large number of market orders will lead to liquidity being plundered all the way, causing prices to jump rapidly in a short period of time. Furthermore, for limit orders in orders, the price is strict and the time is loose, that is, the order issued requires execution at a specific price, but does not require immediate execution.
[0012] Liquidity: This is to evaluate the number of limit orders for a trading product. The more the limit orders, the better the liquidity (e.g. Figure 1 As shown in the upper part), oligomers are called poorly liquid (such as Figure 1 shown below).
[0013] Order book: The exchange can receive orders from all investors in the market, aggregate and match them. The orders that failed to be matched and executed remain to form an order book, which is publicly pushed to the entire market. This intermittent full market is the quotation that investors see.
[0014] Market quotation: A slice of the order book of a trading product at a certain moment. Each trading product has a different level for display.
[0015] Level: All orders queued at a certain price are called a level. A "one-level market" can only see the best quotes on the surface of the order book, that is, "buy one" (called bid 1 in the industry) and "sell one" (called ask 1 in the industry). Multi-level market can see the depth of the order book and know the order information waiting to be bought and sold at different prices. Common stocks we have are five levels, that is, the market can give the quantity and price information of buy one to buy five and sell one to sell five, such as Figure 2 shown.
[0016] Jump: The minimum jump price between each level of a futures contract. The price difference between all order quotations is an integer multiple of 1 jump. Taking 10-year Treasury bond futures as an example, 1 jump is 0.005 yuan. If the bid price is 100.000 yuan, the lowest ask price is 100.005 yuan, and it cannot be lower than this number. Therefore, the price jump on each trading floor is a step.
[0017] Tick: The minimum time interval for the market price given by the exchange to the outside world. For example, 1 tick of the China Financial Futures Exchange = 0.5 seconds, which means that the latest price and the latest quotes for each gear are broadcast to the entire market every 0.5 seconds. Obviously, connecting the price sections on each tick in chronological order will form a continuous price. Summary of the invention
[0018] The technical problem to be solved by the present invention is: how to predict the price rise and fall trend of the target (such as ten-year treasury bond futures) in a relatively short period in the future through high-frequency market data and conduct transactions. To this end, the present invention provides a real-time intraday trading method based on an order book, which applies the quantity and price factors that have been screened and analyzed for a long time and proven to be effective in historical backtesting to treasury bond futures varieties, and continuously rolls back the high-frequency market data accessed in real time from the exchange to perform short-term price predictions, and then gives signals in a programmatic manner and sends them to the matching counter of the exchange to complete the transaction. After hundreds or thousands of transactions, the law of large numbers will naturally realize the positive return expectations during the backtest in the actual market, thereby helping investors obtain stable net value growth returns.
[0019] The present invention solves the above technical problems through the following technical solutions, and the present invention comprises the following steps:
[0020] S1: Factor classification
[0021] According to the order book information, the order book characteristics are refined into order flow imbalance factors, order book imbalance factors, transaction volume factors, and commission price factors;
[0022] S2: Factor expansion
[0023] According to the generation rules of the four types of factors in step S1, the factors are derived and expanded in combination with different transaction objects, different historical sample time windows, different gears, and different forecast periods to obtain a factor library;
[0024] S3: Factor screening
[0025] It is used to use the Treasury bond futures market data to calculate the intraday factor value of each factor in the factor library obtained through factor expansion, combine the actual rate of return of the intraday factor prediction period, use the multi-dimensional factor effectiveness evaluation index, build a factor effectiveness scoring mechanism, and remove factors with scores lower than the set threshold according to the set threshold to obtain the optimal factor;
[0026] S4: Acquisition of transaction parameters
[0027] Get trading parameters before daily trading begins, including signal, trading cycle, prediction cycle, and maximum leverage ratio;
[0028] S5: Market data reception
[0029] Receive real-time market data push, and perform investigation, cleaning, proofreading, and localization processing on the market data in sequence;
[0030] S6: Raw signal processing
[0031] Used to obtain relevant transaction parameters and perform post-processing to obtain the original value of the signal and its rolling mean and rolling standard deviation;
[0032] S7: Signal calibration
[0033] Obtain the original value of the signal and its rolling mean and rolling standard deviation, and introduce the signal attenuation framework according to the prediction period to perform signal calibration, and obtain the calibrated signal value, i.e., the calibrated signal value;
[0034] S8: Position calculation and execution
[0035] The calibration signal value is further processed and the specific target position is calculated to determine the trading direction and place a programmed order.
[0036] Furthermore, in step S1, the various factors are specifically as follows:
[0037] Order flow imbalance factor: reflects the imbalance of buy and sell orders by calculating the impact of new orders from time t-1 to time t on each price level of the market. The generation rules of this type of factor include the average value of the ask level, the standard deviation of the ask level, the average value of the bid level, and the standard deviation of the bid level.
[0038] Order book imbalance factors use the order book information of different levels to calculate the order imbalance of each level to reflect the market supply and demand relationship. The generation rules of this type of factors include the difference in the number of pending orders at each level.
[0039] Volume factors capture market fluctuations and predict price trends by analyzing volume changes and the relationship between volume and price. The generation rules of this type of factors include volume ratio, active buying volume and active selling volume ratio;
[0040] Order price factors measure liquidity and market pressure by analyzing the order price and order volume of buy and sell orders. The generation rules of this type of factors include the relative price difference of orders and the deviation of order price.
[0041] Furthermore, in step S3, the multidimensional factor effectiveness evaluation index includes IC, Sharpe ratio, x-kurtosis normality correction value and x-skewness normality correction value, which are as follows:
[0042] IC is the correlation coefficient between the factor value and the rate of return, which is used to measure the relevance of the factor in predicting future rises and falls;
[0043] The Sharpe ratio is the annualized return / annualized variance of the yield curve formed by the factor value, which is used to measure how much excess return the factor can generate for each risk it bears;
[0044] x Kurtosis Normality Correction Value is used to determine the level at which the kurtosis of the factor value distribution differs from that of the normal distribution;
[0045] The x-skewness normality correction is used to measure the degree of deviation from the normality of the factor value distribution.
[0046] Furthermore, the calculation formula of the IC is as follows:
[0047]
[0048] The calculation formula for the x-kurtosis normality correction value is as follows:
[0049]
[0050] The calculation formula for the x skewness normality correction value is as follows:
[0051]
[0052] Among them, X i is the specific value of the factor at different time points in the historical time sample period [0, T]. The historical time sample period is the sample period. is the mean of the specific values of the factor at all time points in the sample period, Y i For X i The yield of the underlying asset within the forecast period at the corresponding time point, The yield of the underlying asset Y i The mean of ; n is the number of samples in the sample period.
[0053] Furthermore, in step S3, the factor effectiveness score calculation formula is as follows:
[0054] SCORE=Z1*w1+Z2*w2+Z3*w3-Z4*w4
[0055] Among them, Z1 is the final result of the normalized absolute value of the IC value of the factor, Z2 is the final result of the normalized Sharpe ratio of the factor, Z3 is the final result of the normalized x-kurtosis correction value of the factor, and Z4 is the final result of the normalized x-skewness correction value of the factor. w1, w2, w3, and w4 are the corresponding weight ratios respectively.
[0056] Furthermore, in step S4, the transaction parameters are as follows:
[0057] Signal: used to predict the intraday trend of treasury bond futures. Its source is the optimal factor obtained through screening in step S3 and will be transmitted to step S6 before the first transaction of each day;
[0058] Trading cycle: the time interval between each position adjustment, which is a fixed value and will be transmitted to step S6 before the first transaction of the day;
[0059] Prediction period: the time range of price increase or decrease that the signal needs to predict in the future. It is a fixed value and will be transmitted to step S7 before the first transaction of the day;
[0060] Maximum leverage ratio: the maximum allowable multiple of the invested principal relative to the nominal amount of the futures positions held, used to measure the account risk level, where leverage ratio = nominal market value of treasury bond futures positions held / account trading margin, and will be transmitted to step S8 before the first transaction of the day occurs.
[0061] Furthermore, in step S6, the specific process of post-processing is as follows:
[0062] S61: Determine the time point at which each trading signal will be issued on the future time axis according to the acquired trading cycle;
[0063] S62: Read localized real-time market data from the local according to the acquired signal. When reaching each time point given in step S61, calculate the original value of the signal at that time point, and then calculate the rolling mean and rolling standard deviation of the original value of the signal as relevant indicators, and proceed to the next step of processing;
[0064] S63: The original value of the signal and the above-mentioned related indicators are stored locally to realize localized processing.
[0065] Furthermore, in step S7, the specific processing process of the signal calibration work is as follows:
[0066] S71: Standardize the signal, the signal after standardization = (signal original value - signal rolling mean) / signal rolling standard deviation, the signal original value, signal rolling mean, and signal rolling standard deviation are all calculated and generated in step S62;
[0067] S72: Booleanize the signal processed in step S71 (-1, 0, 1). A threshold is set here. If the value is greater than the threshold, the value is set to 1; if the value is less than the threshold, the value is set to -1; otherwise, the value is set to 0.
[0068] Step S73: storing the signal value obtained in step S72 locally to achieve localized processing;
[0069] S74: Introduce a signal attenuation framework, and then multiply the signal by an exponential decay function in the time series and perform moving weighted average processing, and the latest value obtained is the calibrated signal value;
[0070] In step S74, the process of obtaining the calibrated signal value is as follows:
[0071] S741: Read the signal value saved in step S73 on the current day from the local computer;
[0072] S742: The prediction period parameters obtained by the program call;
[0073] S743: Apply the signal value obtained in step S741 to the signal attenuation framework, and the latest value obtained is the calibration signal value.
[0074] Furthermore, in step S743, the calculation process of the signal attenuation frame is as follows:
[0075] S7431: record the prediction period of step S742 as T;
[0076] S7432: For the signal value in step S743, the signal value corresponding to any time t is recorded as f. After a time Δt, the signal value f at the time t decays to Here t and Δt are arbitrary, T half =T;
[0077] S7433: For the signal value in step S743, consider any time t arbitary , t arbitary The value of the signal after applying the signal decay frame at time instant
[0078] S7434: For the signal value in step S743, calculation is performed according to the formula in step S7433 at each moment, that is, the signal attenuation framework is applied to the signal, and the latest value obtained is the calibration signal value.
[0079] Furthermore, in step S8, the specific processing process is as follows:
[0080] S81: Get the maximum leverage ratio;
[0081] S82: Get the calibration signal value and use it as the position ratio directly, which means the ratio of the actual position used to the trading margin;
[0082] S83: Calculate the real-time target position quantity according to the following calculation formula, that is, obtain the specific target position. The calculation formula is as follows:
[0083] Target position quantity = position ratio * trading margin * maximum leverage ratio / nominal market value of each lot of treasury bond futures
[0084] Among them, the value range of the position ratio is [-1,1], which is the same as the calibration signal value;
[0085] S84: After the calculation is completed, the target position is output as the final result, and an order is placed to the exchange through a programmatic interface.
[0086] Compared with the prior art, the present invention has the following advantages: the order book-based intraday real-time trading method for treasury bond futures provides the optimal order book-based quantity and price factors in the historical database by means of machine learning. Under the premise of given selection signals and target prediction cycles, it can access high-frequency market sources and provide long and short direction judgments and target positions for treasury bond futures, reflecting stable net value growth with a higher winning rate, avoiding factors such as long holding periods and unclear trading income characteristics of traditional intraday trading strategies, having certain absolute income characteristics, and enabling investors to obtain stable income; and by applying a signal attenuation framework, the originally isolated signals at each time point are clearly linked together in a quantitative manner, greatly improving the accuracy of the signals. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] Figure 1 This is an example diagram showing liquidity;
[0088] Figure 2 This is an example chart of quantity and price information for Buy 1 to Buy 5 and Sell 1 to Sell 5 in stocks;
[0089] Figure 3 It is a schematic diagram of kurtosis normality correction in Embodiment 1 of the present invention;
[0090] Figure 4aThis is a schematic diagram of right-skewed distribution of data in Embodiment 1 of the present invention;
[0091] Figure 4b is a schematic diagram of the skewness of the normal distribution in the first embodiment of the present invention;
[0092] Figure 4c This is a schematic diagram of left-skewed distribution of data in Embodiment 1 of the present invention;
[0093] Figure 5 It is a flow chart of a method for generating a real-time target position within a day when the transaction object is treasury bond futures in the second embodiment of the present invention;
[0094] Figure 6 This is a schematic diagram of the operation flow when real-time market data is received during the day in the second embodiment of the present invention;
[0095] Figure 7 is a schematic diagram of the execution flow of the first operation instruction in the second embodiment of the present invention;
[0096] Figure 8 is a schematic diagram of the execution flow of the second operation instruction in the second embodiment of the present invention;
[0097] Fig. 9 is a schematic diagram of the execution flow of the third operation instruction in the second embodiment of the present invention;
[0098] Fig.10 is a schematic diagram of the execution flow of the fourth operation instruction in the second embodiment of the present invention;
[0099] Fig.11 This is a system interface diagram of an actual operation case in the second embodiment of the present invention;
[0100] Fig.12 It is the price fluctuation curve chart described in the background technology. DETAILED DESCRIPTION
[0101] The following is a detailed description of an embodiment of the present invention. This embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation method and a specific operation process are given, but the protection scope of the present invention is not limited to the following embodiment.
[0102] Embodiment 1
[0103] This embodiment provides a technical solution: a real-time intraday trading system for treasury bond futures based on an order book, comprising the following modules:
[0104] The factor classification module is used to refine the order book characteristics into order flow imbalance factors, order book imbalance factors, trading volume factors, and commission price factors according to the order book information. Each category of factors has corresponding factor generation rules;
[0105] In this embodiment, various factors are further described below:
[0106] The order flow imbalance factor reflects the imbalance of buy and sell orders by calculating the impact of new orders from time t-1 to time t on each price level of the market. The generation rules of this type of factors include the average value of the ask level, the standard deviation of the ask level, the average value of the bid level, the standard deviation of the bid level, etc.
[0107] The order book imbalance factor uses the order book information of different levels to calculate the order imbalance of each level, reflecting the market supply and demand relationship. The generation rules of this type of factor include the difference in the number of pending orders at each level.
[0108] Volume factors capture market fluctuations and predict price trends by analyzing volume changes and the relationship between volume and price. The generation rules of this type of factors include volume ratio, active buying volume and active selling volume ratio, etc.
[0109] Order price factors measure liquidity and market pressure by analyzing the order prices of buy and sell orders. The generation rules of this type of factors include the relative price difference of orders, the deviation of order prices, etc.
[0110] Furthermore, in the factor generation rules, taking the average value of the ask level in the order flow imbalance factor as an example, the average value of the ask level is used as a generation rule, the average value is the specific calculation method, and the prices of different ask levels are the calculation objects. Because the factor expansion process involves a large number of similar factor generation, the same calculation rules defined by the factor classification module can be applied to similar factor calculation objects without repeating the design of the calculation process. It can be understood as a modular design to improve reusability and facilitate functional programming. For example:
[0111] The Ask 1Order Flow Moving Average on 30Tick on T Predicting 50Tick factor and the Ask 1Order Flow Moving Average on 30Tick on T Predicting 100Tick factor refer to the continuous calculation of the moving average of the ask 1 level price on the historical 30-tick window with 10-year Treasury bond futures (T) as the underlying asset, and then combined with different prediction window periods of 50 ticks and 100 ticks (that is, predicting the rise and fall of the next 50 ticks or predicting the rise and fall of the next 100 ticks), finally forming two different factors.
[0112] Taking the difference in order volumes at each level in the order book imbalance factor as an example, it is obvious that when the seller's orders are greater than the buyer's orders, more investors want to sell, which has a certain suppressive effect on the price. On the contrary, when the buyer's orders are greater than the seller's orders, the price has a strong support. Soir 2rolling on 10tick on T Predicting 50 and Soir 2rollingon 20tick on T Predicting 50, means that the difference between the orders of the first two levels in the past 10 ticks and 20 ticks (i.e., the first selling level + the second selling level - the first buying level - the second buying level) is continuously calculated based on the 10-year Treasury bond futures (T) and the two factors that predict the rise and fall of the next 50 ticks.
[0113] Taking the volume ratio in the volume factor as an example, when the market fluctuates greatly, the volume is often enlarged. The volume ratio captures market fluctuations by calculating the changes in the volume. Volume_ratio on 10tickon T Predicting 60tick and Volume_ratio on 30tick on T Predicting 60tick are based on 10-year Treasury bond futures (T). The ratio of the volume of the most recent tick to the average volume of the historical 10 ticks or the average volume of the historical 30 ticks is used to determine whether the volume is abnormally enlarged, and to predict the rise and fall trend of the next 60 ticks, thus forming two factors.
[0114] Taking the relative price difference of the entrustment in the entrustment price factor as an example, in the period of stable market, the price difference between the five tiers of treasury bond futures is small, otherwise the price difference between the five tiers may be enlarged. We can judge the volatility of futures by tracking the expansion and contraction of the price difference. Relative Price Diff 2on 10Tick on T Predicting 10Tick and Relative Price Diff 2on 10Tick on T Predicting 50Tick are based on 10-year treasury bond futures (T). The relative difference between the ask2-tier price and the bid2-tier price is calculated on the historical 10-tick sliding window (i.e. (sell 2-tier price - buy 2-tier price) / (sell 2-tier price + buy 2-tier price)), and then combined with different prediction window periods of 10 ticks and 50 ticks (i.e. predicting the rise and fall of the next 10 ticks or predicting the rise and fall of the next 50 ticks), finally forming two different factors.
[0115] The factor expansion module derives and expands the factors according to the four factor generation rules in the factor classification module, combining different transaction objects, different historical sample time windows, different gears, and different forecast periods to obtain a factor library.
[0116] Specifically, the factor derivation and expansion method is to select the generation rules in any type of factor and combine them with the trading object, historical sample time window, gear, and prediction period to generate the final factor. Taking the order flow imbalance factor in the factor classification module as an example, using the ask gear average rule MA, combined with the trading object 10-year Treasury bond futures (T), historical sample time window (30 ticks), ask gear 1, and prediction period (50 ticks), the Ask 1 Order Flow Moving Average on 30 ticks on T Predicting 50 ticks factor (abbreviated as A1T30MA50) can be generated.
[0117] The factor screening module is used to use the treasury bond futures market data to calculate the intraday factor value of each factor in the factor library obtained by the factor expansion module, combine the actual rate of return of the intraday factor prediction period, use the multi-dimensional factor effectiveness evaluation index, and construct a factor effectiveness scoring mechanism. According to the set threshold, factors with lower scores are removed to obtain the optimal factor (there is at least one optimal factor).
[0118] In this embodiment, the multidimensional factor effectiveness evaluation index includes (IC, Sharpe ratio, x-kurtosis normality correction value, x-skewness normality correction value), specifically:
[0119] IC (Information Coefficient): The correlation coefficient between the factor value and the rate of return, which is used to measure the relevance of the factor in predicting future rises and falls. The larger the value, the higher the prediction accuracy, and thus the higher the rate of return.
[0120] This indicator compares the correlation between the sequence of factor values at different points in the historical time sample period and the sequence of the underlying yield at the corresponding point in the factor value and the future forecast period to obtain the evaluation result. The yield is the annualized yield of the yield curve formed by the factor value, which is used to measure the ability of the factor to generate income.
[0121] As a bit more specific, the IC calculation formula is as follows:
[0122]
[0123] Where X i is the specific value of the factor at different time points in the historical time sample period [0, T] (hereinafter referred to as the sample period), is the mean of the specific values of the factor at all time points in the sample period, Y i For Xi The yield of the underlying asset within the forecast period at the corresponding time point, The yield of the underlying asset Y i The IC value of a factor in the sample period is obtained by this formula.
[0124] As an example, for the first selling gear (level) of the 10-year Treasury bond futures (trading object), the weighted average price is calculated over the past 10-tick sliding window (historical sample time window) to predict the rise and fall factor of the next 10 ticks (forecast period) (hereinafter referred to as T10WMA10 factor). Assume that the historical time sample period is [10:00,11:00] (hereinafter referred to as the sample period). During the sample period, there is a 1-tick fluctuation every minute. The price of the 10-year Treasury bond futures at 10:30 is A0 yuan. The prices of the 10-year Treasury bond futures at 10:31, 10:32, 10:33 and 10:34 are selected as A1, A2, A3 and A4, and the corresponding T10WMA10 factors are calculated. The resulting sequence is represented by X[x1,x2,x3,x4]. The actual yield sequence corresponding to the 10-tick price change after the four time points is represented by Y[y1,y2,y3,y4]. Assume that the sequence X is [1.1,1.2,1.3,1.4] and the sequence Y is [0.1,0.2,0.3,0.4].
[0125] Then, the effectiveness of the factor is evaluated based on the correlation between the factor calculation result sequence X and the target yield sequence Y. According to the calculation formula:
[0126]
[0127] That is, for each pair of X and Y values, calculate the difference between them and their respective average values, add the products of each pair of differences and divide them by the square of the difference between the values of X and Y and their average values, take the square root after summing, and multiply the two parts. The average value of the X sequence is 1.25, the average value of the Y sequence is 0.25, the covariance of the X and Y sequences is -0.0166, the standard deviation of the sequence X is 0.129, and the standard deviation of the sequence Y is 0.129. The IC value of the T10WMA10 factor is -0.0166 / (0.129*0.129)=-1. The IC values of all factors in the factor library are taken as absolute values and normalized, and the result of the IC conversion of the T10WMA10 factor is recorded as Z1. Assuming that the IC sequence of all factors in the factor library is [-1, 0.3, 0.2, 1], the sequence after taking the absolute value is [1, 0.3, 0.2, 1], then the final result of the IC value Z1 is 1.
[0128] Sharpe ratio (return-drawdown ratio): the annualized rate of return / annualized variance of the yield curve formed by the factor value, which is used to measure how many excess returns the factor will generate for each risk it bears, and can also be understood as how much volatility is required to obtain each return; in this embodiment, it is used to measure the winning rate of the factor in opening a "long" futures order; at the same time, intuitively, the higher the Sharpe ratio of a factor, the smoother the yield curve it forms. Assuming that the Sharpe ratio of the T10WMA10 factor is 10, the Sharpe ratios of all factors in the factor library are normalized. Assuming that the Sharpe sequence of all factors in the factor library is [-10, 10, 20, 30], and the normalized sequence is [0.0.5, 0.75, 1], the final result Z2 of the Sharpe ratio of the T10WMA10 factor is 0.5.
[0129] x Kurtosis Normality Correction Value: This indicator evaluates the difference between the kurtosis of the factor value distribution and the kurtosis of the normal distribution. Kurtosis is an indicator used in statistics to describe the height of the peak of the probability distribution curve near the mean. It can reflect the sharpness of the distribution, that is, whether the peak of the data distribution is sharp or flat. See Figure 3 High kurtosis means more extreme values, low kurtosis means fewer extreme values and smooth data. The closer the factor value distribution is to the normal distribution, the easier it is to grasp the rarity of each tick factor value, which is conducive to building corresponding opening and closing signals.
[0130] According to the kurtosis normality correction, the factor effectiveness is evaluated, and the calculation formula is as follows:
[0131]
[0132] Among them, X i is the specific value of the factor in the factor calculation result sequence, n is the number of samples in the sample period, the absolute value abs of the calculated x-kurtosis normality correction value is taken, the x-kurtosis normality correction values of all factors are calculated, and the result sequence is normalized. According to the above assumption, the X sequence is [1.1, 1.2, 1.3, 1.4], then the calculation result of the x-kurtosis normality correction value of the T10WMA10 factor is -1, assuming that the x-kurtosis normality calculation result sequence of all factors in the factor library is [-1, 3, 4, 1], then the normalized sequence is [0, 0.8, 1, 0.4], and the final result Z3 of the x-kurtosis normality correction value of the T10WMA10 factor is 0;
[0133] x Skewness Normality Correction Value: It is a measure of the asymmetry of the data distribution form, used to measure the degree of deviation of the factor value distribution. The larger the absolute value of the skewness, the more serious the deviation of the data distribution. Figure 4a-4c .
[0134] According to the skewness normality correction, the factor effectiveness is evaluated, and the calculation formula is as follows:
[0135]
[0136] According to the above assumption that the X sequence is [1.1, 1.2, 1.3, 1.4], the x skewness normality correction value of the T10WMA10 factor is 0. Assuming that the x skewness normality correction value sequence of all factors in the factor library is [-1, 0, 4, 1], the normalized result is [0, 0.2, 1, 0.4], and the final result Z4 of the x skewness normality correction value of the T10WMA10 factor is 0.2.
[0137] Through the above four evaluation indicators, a scoring mechanism is constructed. The weight sequence W[w1,w2,w3,w4] of the final result of each evaluation indicator is multiplied by the corresponding indicator value to calculate the weighted sum, and screen out high-quality factors with strong correlation with yield, good ability to grasp profit window, and distribution close to normal.
[0138] Assuming that the weight sequence of the final results of the four evaluation indicators is W[0.3, 0.2, 0.1, 0.4], the T10WMA10 factor effectiveness score is as follows:
[0139] SCORE=Z1*w1+Z2*w2+Z3*w3-Z4*w4=1*0.3+0.5*0.2+0*0.1-0.2*0.4=0.32.
[0140] The trading parameter acquisition module is used to obtain trading parameters, including signals, trading cycles, prediction cycles, and maximum leverage ratios, and perform manual confirmation before the start of daily trading.
[0141] In this embodiment, each transaction parameter is further described below:
[0142] 1. Signal: used to predict the intraday trend of treasury bond futures. Its source is the optimal factor obtained through screening in the factor screening module, and will be transmitted to the original signal processing module before the first transaction of the day;
[0143] 2. Trading cycle: The time interval between each position adjustment is a fixed value and will be transmitted to the original signal processing module before the first transaction of the day;
[0144] 3. Prediction period: The time range of price increase or decrease that the signal needs to predict in the future. It is a fixed value and will be transmitted to the signal calibration module before the first transaction of the day.
[0145] 4. Maximum leverage ratio: the maximum allowable multiple of the invested principal relative to the nominal amount of the futures position held, used to measure the account risk level. Here, the leverage ratio = nominal market value of the treasury bond futures position held / account trading margin, and will be transmitted to the position calculation and execution module before the first transaction of the day occurs;
[0146] The market data receiving module is used to receive real-time market data push and to check, clean and proofread the market data in sequence.
[0147] In this embodiment, the following further describes the troubleshooting, cleaning, and proofreading process:
[0148] Troubleshooting: used to check whether the real-time market data is complete and determine the reason; if the reason for the missing data is that there is no real transaction, the cleaning function is enabled; otherwise, the execution of subsequent instructions is suspended; if the data is complete, the market localization module is called to localize the real-time market data;
[0149] Cleaning: used to fill in the gaps in real-time market data; if there is missing data and the corresponding field is a price field, the localized market data will be traced back and the latest data of the corresponding field will be selected to fill in the gaps in the real-time market data; if the corresponding field is not a price field, the gap will be filled with a zero value; after cleaning is completed, the market localization module is called to localize the real-time market data.
[0150] Proofreading: used to check whether the real-time market data timestamp is consistent with the real timestamp. If not, the execution of subsequent instructions will be suspended.
[0151] It should be noted that real-time market data is automatically pushed at the set frequency. Each time it is pushed, the processing processes of the market receiving module, original signal processing module, signal calibration module, position calculation and execution module will be executed in sequence until the end of the trading period of the day.
[0152] The original signal processing module is used to obtain relevant transaction parameters from the transaction parameter acquisition module and perform post-processing.
[0153] In this embodiment, the specific process of post-processing is as follows:
[0154] Step S61: According to the trading cycle obtained by the trading parameter acquisition module, determine the time point at which each trading signal will be issued on the future time axis;
[0155] Step S62: According to the signal obtained by the transaction parameter acquisition module, the localized real-time market data processed by the market receiving module is read from the local. When the time point given in each step S61 is reached, the original value of the signal at that time point is calculated, and then the rolling mean and rolling standard deviation of the original value of the signal are calculated as relevant indicators, and the next step of processing is entered;
[0156] Step S63: The original value of the signal and the above-mentioned related indicators are stored locally to realize localized processing.
[0157] The signal calibration module is used to obtain the original value of the signal in the original signal processing module and its rolling mean and rolling standard deviation, and perform signal calibration according to the forecast period obtained from the trading parameter acquisition module to obtain the calibrated signal value, that is, the calibration signal value.
[0158] In this embodiment, the signal calibration process is as follows:
[0159] Step S71: Standardize the signal. The signal after standardization = (signal original value - signal rolling mean) / signal rolling standard deviation. The signal original value, signal rolling mean and signal rolling standard deviation are all calculated and generated in step S62.
[0160] Step S72: Booleanize the signal processed in step S71 to (-1, 0, 1). Here, a threshold is set to 0.1. If the value is greater than 0.1, the value is set to 1. If the value is less than -0.1, the value is set to -1. Otherwise, the value is set to 0.
[0161] Step S73: storing the signal value obtained in step S72 locally to achieve localized processing;
[0162] Step S74: Considering that the signal generated by the quantity-price factor can be captured by other traders in the market, its final prediction effect has the characteristic of gradually decaying over time. Therefore, when the original signal strength is equal, the time weight of the signal needs to be considered. The effectiveness of the signal 1 second ago and the signal 30 seconds ago for the price rise and fall in the future very short period is also different. For this, a signal decay framework is introduced, and then an exponential decay function is superimposed on the signal in the time series and a moving weighted average is performed. The latest value obtained is the calibrated signal value;
[0163] As a further step, in step S74, the process of obtaining the calibrated signal value is as follows:
[0164] Step S741: Read the signal value saved in step S73 on the current day from the local computer;
[0165] Step S742: the program calls the forecast period parameters obtained by the transaction parameter acquisition module;
[0166] Step S743: applying the signal value obtained in step S741 to the signal attenuation framework, and the latest value obtained is the calibration signal value;
[0167] As a further step, in step S743, the calculation process of the signal attenuation frame is as follows:
[0168] Step S7431: The prediction period in step S742 is recorded as T, and the half-life applicable to the signal in step S743 is T half =T;
[0169] Step S7432: For the signal value in step S743, the signal value corresponding to any time t is recorded as f. After Δt, the signal value f at time t decays to Here t and Δt are arbitrary, T half =T;
[0170] Step S7433: For the signal value in step S743, consider any time t arbitary , t arbitary The value of the signal after applying the signal decay frame at time instant
[0171] Step S7434: For the signal value in step S743, calculation is performed at each moment according to the formula in step S7433, that is, the signal attenuation framework is applied to the signal, and the latest value obtained is the calibration signal value.
[0172] It should be noted that in this embodiment, in step S7432, the half-life definition is similar to the half-life definition of radioactive substances in nature, that is, after each half-life, the predictive ability of the signal will decay by half. The concept of half-life is introduced here for the purpose of constructing a framework that can quantitatively evaluate the impact of past signals on the current moment, which is the signal attenuation framework in step S743. By applying the signal attenuation framework, the originally isolated signals at each time point are clearly linked together in a quantitative way, which greatly improves the accuracy of the signal.
[0173] The position calculation and execution module is used to further process the calibration signal value and calculate the specific target position, thereby determining the transaction direction and placing a programmed order.
[0174] In this embodiment, the specific processing process of the position calculation and execution module is as follows:
[0175] Step S81: Obtain the maximum leverage ratio from the transaction parameter acquisition module;
[0176] Step S82: Obtain the calibration signal value from the signal calibration module, and use the value directly as the position ratio, which means the ratio of the actual position used to occupy the trading margin;
[0177] Step S83: Calculate the real-time target position quantity according to the calculation formula, that is, obtain the specific target position. The calculation formula is as follows:
[0178] Target position quantity = position ratio * trading margin * maximum leverage ratio / nominal market value of each lot of treasury bond futures
[0179] The value range of the position ratio is [-1,1], which is the same as the calibration signal value.
[0180] Step S84: After the calculation is completed, the target position is output as the final result, and an order is placed to the exchange through a programmatic interface.
[0181] It should be noted that the system in this embodiment can satisfy the function of outputting signals according to order book factors and obtaining stable returns, enabling investors to obtain stable returns.
[0182] Embodiment 2
[0183] This embodiment provides a technical solution: a method for intraday real-time trading of treasury bond futures based on order book factors, which is used to construct an intraday trading strategy with absolute return characteristics, including the following steps:
[0184] Step 1: Factor classification (factor classification module operation): It is used to refine the characteristics of the order book into order flow imbalance factors, order book imbalance factors, trading volume factors, and commission price factors according to the order book information. Each category of factors has corresponding factor generation rules.
[0185] Step 2, factor expansion (factor expansion module operation): According to the various factors classified by factors, based on the dimensions of transaction object * time window period * gear quantity price * forecast period, a factor library is derived (see the factor expansion module in Example 1 for details). Taking the entrustment price factor as an example, based on multiple time windows such as 5, 10, 20, 50, 100, 500, 1000, 3600 and 1 to 5 price levels, a total of 8*5*8 and 320 factors can be generated. A large number of factors can cover all historical features of the data, and there are tens of thousands of factor libraries generated by this method.
[0186] Step 3, factor screening (factor screening module operation): Based on the factor library obtained after factor expansion, the factor screening module is used to analyze and screen it (see the factor screening module in Example 1 for details).
[0187] The final factor (optimal factor) obtained after analysis and screening will be used as the factor for all transactions. In step 6, all the factors after screening will be calculated and processed to obtain the final signal value as the trading signal.
[0188] Step 4: Get trading parameters (run trading parameter acquisition module): Get all necessary trading parameters from the trader. Trading parameters include: signal, trading cycle, forecast cycle, maximum leverage ratio; the specific meanings of the trading parameters are as follows:
[0189] Trading cycle: the time interval between each position adjustment, which is a fixed value; in this embodiment, it is 1 minute;
[0190] Signal: Factors used to predict the intraday trend of treasury bond futures. For example, the optimal factor given after screening in step 3 is a specific factor in the order book imbalance factor library. The logical meaning of the optimal factor is that the difference between the limit order quantity of the buy and sell orders is a reflection of the strength comparison between the buyers and sellers. If the quantity of the buy order is higher than the quantity of the sell order for a period of time, it is considered that the buyer's power is stronger and it is more likely to rise in the future, and vice versa. In this implementation case, it can be seen from step 3 that the optimal factor has a winning rate of more than 50% in the backtest of the past period of time for predicting future prices. Further, in order to explain the mechanism of action of this embodiment in detail, the initial state of the factor is assigned: the average number of pending orders in the first 5-second period of the buy order is 17 lots, and correspondingly, the average number of pending orders in the first 5-second period of the sell order is 9 lots. In this state, the initial value of the factor is 8. This value will be continuously rolled over and calculated within the interval between two opening signals according to the market conditions, and the treasury bond futures price in the next 30 seconds will be predicted when the first opening signal arrives;
[0191] Prediction period: the effective prediction time length of the selected optimal factor, which is a fixed value, and is 30 seconds in this embodiment. (The prediction period will be called as a parameter in the third operation instruction as the half-life of the signal generated by the optimal factor. The definition of half-life here is similar to the definition of half-life of radioactive substances in nature, that is, after each half-life, the prediction ability of the signal will decay by half. The concept of half-life is introduced here for the purpose of constructing a signal attenuation framework that can quantitatively evaluate the impact of past signals on the current moment. It clearly links the isolated signals at each time point in a quantitative way, thereby improving the accuracy of the signal. In this embodiment, half-life = prediction period.
[0192] Maximum leverage ratio: used to measure the risk level of an account. Leverage ratio = nominal market value of treasury bond futures held / account trading margin. For example, in this embodiment, the leverage ratio is 50 times for 10-year treasury bond futures (hereinafter referred to as T). Since the face value of 1 lot of T is 1 million, each lot requires about 100 / 50 = 20,000 margin. Assuming that the trading margin invested in a trading account is 300,000, if all margin is used to open a position, 300,000 / 20,000 = 15 lots of T can be held, corresponding to a nominal amount of 15*1 million = 15 million. At this time, the leverage ratio is 15 million / 300,000 = 50 times. In actual transactions, in order to ensure that the risk of the account is not too high to cause a position to be liquidated, the maximum leverage ratio is generally limited. For example, in this embodiment, the maximum leverage ratio is limited to 10 times, corresponding to a nominal amount of 300,000*10 = 3 million, that is, a maximum of 3 lots of T can be placed.
[0193] Step 5: After the transaction parameters are determined, the first operation instruction is started, which will call the market receiving module to perform timestamp checking, investigation, cleaning, proofreading, and localized storage on the market data in sequence.
[0194] The module definition is as follows:
[0195] Timestamp check submodule: used for timestamp check (timestamp check here refers to judging whether it is in the current trading time period, whether the local time of the server hosted by the system is accurate, and whether the real-time market information pushed by the market source is delayed due to various factors. In an abnormal state, the alarm prompt module is activated. The alarm prompt module uses a beep of corresponding frequency to send a single or multiple sounds to remind the trader of the current real-time status. Among them: a single long beep of 200 Hz represents a normal state; two short beeps of 200 Hz represent that the current time period is non-trading time; three short beeps and one long beep of 600 Hz represent that there are problems with the real-time market data that cannot be eliminated;
[0196] Under normal conditions, the market receiving module enters the working state and connects to the real-time market source of treasury bond futures. The market source is generally sent by the corresponding futures exchange and forwarded to the client terminal by the futures company. In this embodiment, the market of T.cfe is broadcast by the China Financial Futures Exchange in Shanghai at 9:30-11:30 and 13:00-15:15 every day. The interval between each two broadcasts is 500 milliseconds (i.e. 1 Tick), and different levels of detailed market information are sent according to different payment methods of the customer. In this embodiment, the Level-2 market information containing five levels of buying and selling prices and corresponding pending order quantities is received (Level-1 market information only contains 1 level of quantity and price);
[0197] After receiving the first batch of real-time market data, the market module checks, cleans and proofreads the market data in sequence. Here, the market receiving module requires certain requirements on the format of the data source. First, its frequency is tick level (for the market pushed by China Financial Futures Exchange, 1 Tick means 500 milliseconds), and the fields that need to be included are: latest price, transaction volume, transaction amount, five buying and selling prices and corresponding pending order volume.
[0198] The troubleshooting submodule is used to check whether the real-time market data is complete and determine the reason. If the reason for the missing data is that there is no real transaction, the cleaning function is enabled; otherwise, the alarm prompt module is called to issue a corresponding alarm and suspend the execution of subsequent instructions; if the data is complete, the market localization module is called to store all fields of the real-time market in the local database;
[0199] The cleaning function submodule is used to fill in the gaps in real-time market data. If the data is missing and the corresponding field is a price field, the localized market data is traced back and the latest data of the corresponding field is selected to fill in the gaps in the real-time market data; if the corresponding field is not a price field, the gap is filled with a zero value. After the cleaning is completed, the market localization module is called to localize the real-time market data;
[0200] The proofreading function submodule is used to check whether the real-time market data timestamp is consistent with the real timestamp. If not, the alarm prompt module is called to issue a corresponding alarm and suspend the execution of subsequent instructions. The real timestamp here is the standard Beijing time received from the Internet;
[0201] The market localization module writes the complete Level-2 market information into the system memory in time series for subsequent calculation and call;
[0202] As mentioned above, the market data based on treasury bond futures will be automatically pushed at a frequency of 500 milliseconds / time. Every time the market module receives real-time market data push, it will always execute steps 4 to 8 in sequence until the trading period ends.
[0203] Step 6: Start the second operation instruction. This instruction will call the original signal processing module to obtain relevant transaction parameters from the transaction parameter acquisition module and perform post-processing.
[0204] In this embodiment, the trading cycle parameter recorded in the trading parameter acquisition module is 1 minute, that is, a trading signal is given at the end of every minute after the market opens at 9:30.
[0205] In this embodiment, by reading the real-time market data cleaned by the first operation instruction, it can be known that the data input by the optimal factor is: the average number of pending orders in the first 5-second period for the buy level is 17 lots, and correspondingly, the average number of pending orders in the first 5-second period for the sell level is 9 lots. In the next 55 seconds, there will be 11 average pending orders for buy and sell respectively, and the order is sorted by time every 5 seconds as buy one: 17, 22, 31, 11, 19, 25, 2, 7, 6, 18, 9, 11, sell one: 9, 22, 15, 17, 2, 6, 8, 7, 11, 5, 8, 6. The difference is 8, 0, 16, -6, 17, 19, -6, 0, -5, 13, 1, 5. In this embodiment, we calculate the rolling mean and rolling standard deviation of the difference sequence as indicators, and the values are 5.167 and 9.252 respectively (retain three significant digits).
[0206] After the above signal calculation is completed, the signal localization module is called. It should be noted that when the signal localization module is processing, it is performed simultaneously in the form of a database and a file, and the above signal value includes both the original value and the necessary intermediate calculation results.
[0207] Step 7: Start the third operation instruction. This instruction will call the signal calibration module and apply the signal attenuation framework to calibrate the original signal value. The module definition is as follows:
[0208] Signal calibration module: used to obtain the original value of the signal in the original signal processing module and its rolling mean and rolling standard deviation, and perform signal calibration according to the prediction period obtained from the transaction parameter acquisition module to obtain the calibrated signal value, i.e., the calibration signal value. In this embodiment, the prediction period is 30 seconds. At this time, the signal calibration calculation work is performed, and the specific process is as follows:
[0209] Step 1: Standardize the signal and map all signals to a natural number to facilitate subsequent processing. The standardized signal = (signal original value - signal rolling mean) / signal rolling standard deviation. In this embodiment, the signal sequence = 0.3062, -0.5584, 1.1710, -1.2070, 1.2790, 1.495, -1.207, -0.5584, -1.099, 0.8466, -0.4503, -0.0180;
[0210] Step 2: Booleanize the standardized signal. If it is greater than 0.1, set the value to 1; if it is less than -0.1, set the value to -1; otherwise, set it to 0. This signal can be considered as a judgment of future rising and falling trends. 1 means opening a long position, -1 means opening a short position, and the rest of the cases remain unchanged. That is, the signal sequence in step 1 is Booleanized to 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 0;
[0211] Step 3: Localization processing: For the Boolean signal sequence obtained in the above step 2, call the signal localization module to store it in the local database for subsequent operations.
[0212] Step 4: Read all the Boolean signal sequences saved in step 3 on the day from the local computer, and use the prediction period recorded in the trading parameter acquisition module as a parameter to apply the signal attenuation frame movement processing on the time series. The final value obtained is the calibrated signal value, that is, the position ratio. In this embodiment, the specific operations are as follows:
[0213] 1) Read the locally saved Boolean signal sequence: 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 0. Note that the leftmost is the 0th to 5th second value, the second left is the 6th to 10th second value, and so on to the rightmost;
[0214] 2) Read the prediction period parameter recorded by the transaction parameter acquisition module, which is 30 seconds in this embodiment;
[0215] 3) Applying a signal attenuation framework to the signal sequence obtained in step 3 in a sliding window manner, wherein the half-life parameter of the framework is the prediction period obtained in the above step, and in this embodiment, the value is 15 (seconds);
[0216] 4) The result is 1,-0.14285714,0.35135135,-0.14285714,0.23175416,0.46539947,0.04261464,-0.24703688,-0.45055906,-0.06627914,-0.31000307,-0.22996705.
[0217] It should be noted that this sequence is similar to the Fibonacci sequence in principle. The value of each signal in the sequence depends on the value of the previous signal. Therefore, the value of the last signal in the sequence, -0.22996705, depends on the existence of the first 11 values of the sequence.
[0218] In this embodiment, the signal attenuation framework provides traders with several customized contents including signals, trading cycles, prediction cycles, and maximum leverage ratios, and has strong compatibility. This embodiment is not the only embodiment of the signal attenuation framework, but can be extended to all relevant embodiments within the claims of the present invention.
[0219] Step 8. In this embodiment, the preset trading cycle time point is reached every 1 minute. At this time, the fourth operation instruction is started, the position calculation and execution module is called, the calibrated signal sequence is further processed, and finally a specific target position is formed.
[0220] The steps are as follows: Get the maximum leverage ratio of the account from the trading parameter acquisition module, which is 10 in this embodiment, that is, relative to the trading margin of 500,000, the maximum nominal market value of the treasury bond futures held is 5 million, and the corresponding position limit is 5 lots. Here, the value range of the position ratio is [-1,1].
[0221] Target position quantity = position ratio when the position adjustment signal arrives * trading margin (10,000) * maximum leverage ratio / nominal market value of each lot of treasury bond futures (10,000).
[0222] At the end of the first minute, the target position quantity is -0.22996705*50*10 / 100=-1.14983525;
[0223] A positive target position quantity indicates long Treasury bond futures, and a negative target position quantity indicates short selling. In this embodiment, short selling means selling one lot of 10-year Treasury bond futures.
[0224] This embodiment is selected from actual operation cases, such as Fig.11 As shown, in this embodiment, the position was successfully opened at 9:45, and then the position was closed at 10:04. This intraday turnaround transaction used a trading margin of 20,000 yuan to short sell 1 lot of treasury bonds, and obtained a profit of 200 yuan within 19 minutes of holding the position.
[0225] To summarize, the order book-based intraday real-time trading method for treasury bond futures in the above-mentioned embodiment provides the optimal order book-based quantity and price factors in the historical database by means of machine learning. Under the premise of given selection signals and target prediction cycles, it can access high-frequency market sources and provide long and short direction judgments and target positions for treasury bond futures, reflecting stable net value growth with a higher winning rate, avoiding factors such as long holding periods and unclear trading income characteristics of traditional intraday trading strategies, and possessing certain absolute income characteristics, enabling investors to obtain stable income.
[0226] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for intraday real-time trading of treasury bond futures based on an order book, characterized in that: The following steps are involved: S1: Factor classification According to the order book information, the order book characteristics are refined into order flow imbalance factors, order book imbalance factors, transaction volume factors, and commission price factors; S2: Factor expansion According to the generation rules of the four types of factors in step S1, the factors are derived and expanded in combination with different transaction objects, different historical sample time windows, different gears, and different forecast periods to obtain a factor library; S3: Factor screening It is used to use the Treasury bond futures market data to calculate the intraday factor value of each factor in the factor library obtained through factor expansion, combine the actual rate of return of the intraday factor prediction period, use the multi-dimensional factor effectiveness evaluation index, build a factor effectiveness scoring mechanism, and remove factors with scores lower than the set threshold according to the set threshold to obtain the optimal factor; S4: Acquisition of transaction parameters Get trading parameters before daily trading begins, including signal, trading cycle, prediction cycle, and maximum leverage ratio; S5: Market data reception Receive real-time market data push, and perform investigation, cleaning, proofreading, and localization processing on the market data in sequence; S6: Raw signal processing Used to obtain relevant transaction parameters and perform post-processing to obtain the original value of the signal and its rolling mean and rolling standard deviation; S7: Signal calibration Obtain the original value of the signal and its rolling mean and rolling standard deviation, and introduce the signal attenuation framework according to the prediction period to perform signal calibration, and obtain the calibrated signal value, i.e., the calibrated signal value; S8: Position calculation and execution The calibration signal value is further processed and the specific target position is calculated to determine the trading direction and place a programmed order.
2. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 1, characterized in that: In step S1, the various factors are specifically as follows: Order flow imbalance factor: reflects the imbalance of buy and sell orders by calculating the impact of new orders from time t-1 to time t on each price level of the market. The generation rules of this type of factor include the average value of the ask level, the standard deviation of the ask level, the average value of the bid level, and the standard deviation of the bid level. Order book imbalance factors use the order book information of different levels to calculate the order imbalance of each level to reflect the market supply and demand relationship. The generation rules of this type of factors include the difference in the number of pending orders at each level. Volume factors capture market fluctuations and predict price trends by analyzing volume changes and the relationship between volume and price. The generation rules of this type of factors include volume ratio, active buying volume and active selling volume ratio; Order price factors measure liquidity and market pressure by analyzing the order price and order volume of buy and sell orders. The generation rules of this type of factors include the relative price difference of orders and the deviation of order price.
3. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 1, characterized in that: In step S3, the multidimensional factor effectiveness evaluation index includes IC, Sharpe ratio, x-kurtosis normality correction value and x-skewness normality correction value, which are as follows: IC is the correlation coefficient between the factor value and the rate of return, which is used to measure the relevance of the factor in predicting future rises and falls; The Sharpe ratio is the annualized return / annualized variance of the yield curve formed by the factor value, which is used to measure how much excess return the factor can generate for each risk it bears; x Kurtosis Normality Correction Value is used to determine the level at which the kurtosis of the factor value distribution differs from that of the normal distribution; The x-skewness normality correction is used to measure the degree of deviation from the normality of the factor value distribution.
4. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 3, characterized in that: The calculation formula of the IC is as follows: The calculation formula for the x-kurtosis normality correction value is as follows: The calculation formula for the x skewness normality correction value is as follows: Among them, X i is the specific value of the factor at different time points in the historical time sample period [0, T]. The historical time sample period is the sample period. is the mean of the specific values of the factor at all time points in the sample period, Y i For X i The yield of the underlying asset within the forecast period at the corresponding time point, The yield of the underlying asset Y i The mean of ; n is the number of samples in the sample period.
5. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 4, characterized in that: In step S3, the factor effectiveness score calculation formula is as follows: SCORE=Z1*w1+Z2*w2+Z3*w3-Z4*w4 Among them, Z1 is the final result of the normalized absolute value of the IC value of the factor, Z2 is the final result of the normalized Sharpe ratio of the factor, Z3 is the final result of the normalized x-kurtosis correction value of the factor, and Z4 is the final result of the normalized x-skewness correction value of the factor. w1, w2, w3, and w4 are the corresponding weight ratios respectively.
6. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 1, characterized in that: In step S4, the transaction parameters are as follows: Signal: used to predict the intraday trend of treasury bond futures. Its source is the optimal factor obtained through screening in step S3 and will be transmitted to step S6 before the first transaction of each day; Trading cycle: the time interval between each position adjustment, which is a fixed value and will be transmitted to step S6 before the first transaction of the day; Prediction period: the time range of price increase or decrease that the signal needs to predict in the future. It is a fixed value and will be transmitted to step S7 before the first transaction of the day; Maximum leverage ratio: the maximum allowable multiple of the invested principal relative to the nominal amount of the futures positions held, used to measure the account risk level, where leverage ratio = nominal market value of treasury bond futures positions held / account trading margin, and will be transmitted to step S8 before the first transaction of the day occurs.
7. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 6, characterized in that: In step S6, the specific process of post-processing is as follows: S61: Determine the time point at which each trading signal will be issued on the future time axis according to the acquired trading cycle; S62: Read localized real-time market data from the local according to the acquired signal. When reaching each time point given in step S61, calculate the original value of the signal at that time point, and then calculate the rolling mean and rolling standard deviation of the original value of the signal as relevant indicators, and proceed to the next step of processing; S63: The original value of the signal and the above-mentioned related indicators are stored locally to realize localized processing.
8. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 7, characterized in that: In step S7, the specific processing process of the signal calibration work is as follows: S71: Standardize the signal, the signal after standardization = (signal original value - signal rolling mean) / signal rolling standard deviation, the signal original value, signal rolling mean, and signal rolling standard deviation are all calculated and generated in step S62; S72: Booleanize the signal processed in step S71 (-1, 0, 1). A threshold is set here. If the value is greater than the threshold, the value is set to 1; if the value is less than the threshold, the value is set to -1; otherwise, the value is set to 0. Step S73: storing the signal value obtained in step S72 locally to achieve localized processing; S74: Introduce a signal attenuation framework, and then multiply the signal by an exponential decay function in the time series and perform moving weighted average processing, and the latest value obtained is the calibrated signal value; In step S74, the process of obtaining the calibrated signal value is as follows: S741: Read the signal value saved in step S73 on the current day from the local computer; S742: The prediction period parameters obtained by the program call; S743: Apply the signal value obtained in step S741 to the signal attenuation framework, and the latest value obtained is the calibration signal value.
9. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 8, characterized in that: In step S743, the calculation process of the signal attenuation frame is as follows: S7431: record the prediction period of step S742 as T; S7432: For the signal value in step S743, the signal value corresponding to any time t is recorded as f. After a time Δt, the signal value f at the time t decays to Here t and Δt are arbitrary, T half =T; S7433: For the signal value in step S743, consider any time t arbitary , t arbitary The value of the signal after applying the signal decay frame at that moment S7434: For the signal value in step S743, calculation is performed according to the formula in step S7433 at each moment, that is, the signal attenuation framework is applied to the signal, and the latest value obtained is the calibration signal value.
10. The method for intraday real-time trading of treasury bond futures based on an order book according to claim 8, characterized in that: In step S8, the specific processing process is as follows: S81: Get the maximum leverage ratio; S82: Get the calibration signal value and use it as the position ratio directly, which means the ratio of the actual position used to the trading margin; S83: Calculate the real-time target position quantity according to the following calculation formula, that is, obtain the specific target position. The calculation formula is as follows: Target position quantity = position ratio * trading margin * maximum leverage ratio / nominal market value of each lot of treasury bond futures Among them, the value range of the position ratio is [-1, 1], which is the same as the calibration signal value; S84: After the calculation is completed, the target position is output as the final result, and an order is placed to the exchange through a programmatic interface.