Simulation order book matching method, device and equipment based on LEVEL2 market information data

By using LEVEL2 market data and dynamically updating the order book, the poor accuracy and poor user experience caused by LEVEL1 market data in simulated transactions are solved, and the simulation transaction effect is achieved with higher precision and realistic.

CN119228539APending Publication Date: 2024-12-31DASHANGSUO FEITAI TESTING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411240678.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

When the existing simulated trading system uses LEVEL1 market data for matching transactions, the accuracy is poor and the user experience is poor, resulting in a large difference between the simulation matchmaking results and the real environment.

Method used

The simulated order book matching method based on LEVEL2 market data is adopted, and the matching transactions are carried out in a simulation or production environment by receiving transaction data, and the user order book is dynamically updated to improve the matching accuracy and logical accuracy.

Benefits of technology

It improves the accuracy and user experience of matching transactions, approaches the real trading scenario, avoids logical problems in the order transaction process, and enhances the authenticity of simulated transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119228539A_ABST
    Figure CN119228539A_ABST
Patent Text Reader

Abstract

The invention provides a simulation order book matching method, device and equipment based on LEVEL2 market information data. The method comprises the following steps: receiving trade-by-trade data; under the condition that the trade-by-trade data is a simulated trade-by-trade order, performing matchmaking trade on the simulated trade-by-trade order based on the user order book, and then updating the user order book based on a matchmaking trade result; wherein the initial user order book is generated based on the LEVEL2 market information data. By adopting the technical scheme, the problems of poor matching precision and poor user experience when the LEVEL1 snapshot data is used as input to carry out matching transaction in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of simulated trading technology, and in particular to a simulated order book matching method, device and equipment based on LEVEL2 market data. Background Art

[0002] The simulated trading system is a system that performs simulated matching based on LEVEL1 futures market data. The simulated trading system uses LEVEL1 market data as input to estimate the transaction price and quantity according to the normal distribution probability for matching transactions. However, when matching transactions using LEVEL1 market data as input, the matching accuracy is poor. At the same time, the results of simulated matching transactions may differ from the matching results of the actual production environment, resulting in a poor user experience. Summary of the invention

[0003] The present invention provides a simulated order book matching method, device and equipment based on LEVEL2 market data, so as to solve the problems of poor matching accuracy and poor user experience when matching transactions with LEVEL1 market data as input in the prior art.

[0004] In a first aspect, the present invention provides a simulated order book matching method based on LEVEL2 market data, comprising: receiving transaction data; when the transaction data is a simulated transaction order, matching the simulated transaction order based on a user order book, and then updating the user order book based on the result of the matching transaction; wherein the initial user order book is generated based on the LEVEL2 market data.

[0005] Optionally, the method further includes: when the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data; wherein the initial basic order book is generated based on LEVEL2 market data.

[0006] Optionally, when the transaction data is a simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction, including: when the simulated transaction order is the best entrustment of the party, the transaction is matched at the best price of the party, and the number of pending orders at the best price level of the party is increased in the user order book according to the entrustment amount of the simulated transaction order; when the simulated transaction order is not the best entrustment of the party, the number of pending orders at the corresponding price level in the user order book is reduced according to the transaction price and transaction quantity for the executed part of the matched transaction, and the number of pending orders at the entrustment price level is increased in the user order book for the unexecuted part of the matched transaction.

[0007] Optionally, when the transaction data is production transaction data, the user order book and the basic order book are updated based on the production transaction data, including: when the production transaction data is the best entrustment of the party, the number of pending orders at the best price level of the party is increased in the basic order book and the user order book; when the production transaction data is a limit entrustment, for the unexecuted entrustment in the production transaction data, the number of pending orders at the entrustment price level is increased in the basic order book and the user order book according to the entrustment price.

[0008] Optionally, when the transaction data is production data, the user order book and the basic order book are updated based on the production data, including: when the production data is transaction data, reducing the number of pending orders at the transaction price level in the basic order book and the user order book according to the number of transactions and transaction prices in the production data.

[0009] Optionally, when the transaction data is production transaction data, the user order book and the basic order book are updated based on the production transaction data, including: when the production transaction data is cancellation transaction data, querying the original entrustment price according to the entrustment number in the cancellation transaction data; reducing the number of pending orders at the original entrustment price level in the basic order book and the user order book.

[0010] In a second aspect, the present invention provides a simulated order book matching device based on LEVEL2 market data, comprising: a receiving module for receiving transaction data; a first processing module for matching the simulated transaction orders based on the user order book when the transaction data is a simulated transaction order, and then updating the user order book based on the result of the matching transaction; wherein the initial user order book is generated based on the LEVEL2 market data.

[0011] In a third aspect, the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements any of the above-mentioned simulated order book matching methods based on LEVEL2 market data.

[0012] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-mentioned simulated order book matching methods based on LEVEL2 market data.

[0013] In a fifth aspect, the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned simulated order book matching methods based on LEVEL2 market data.

[0014] The simulated order book matching method, device and equipment based on LEVEL2 market data provided by the present invention receives transaction data one by one, and when receiving simulated transaction orders one by one, matches the simulated transaction orders based on the user order book, and then updates the user order book based on the results of the matching transactions. Matching transactions with transaction data one by one as input improves the matching accuracy. At the same time, by dynamically updating the order book, logical problems that may occur during the order transaction process are avoided, which is closer to the real transaction scene and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 It is a flow chart of the simulated order book matching method based on LEVEL2 market data provided by the present invention.

[0017] Figure 2 It is a flowchart of the high-precision matching service based on LEVEL2 provided by the present invention.

[0018] Figure 3 This is a technical architecture diagram of the high-precision matching business based on LEVEL2 provided by the present invention.

[0019] Figure 4 It is a structural schematic diagram of a simulated order book matching device based on LEVEL2 market data provided by the present invention.

[0020] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. The above method provided by the present invention is illustrated below by examples of specific application scenarios.

[0022] Figure 1 It is a flow chart of the simulated order book matching method based on LEVEL2 market data provided by the present invention, such as Figure 1 As shown, the method includes the following steps S102 and S104: Step S102: receiving transaction data.

[0023] It should be noted that the transaction data includes simulated transaction orders and production transaction data.

[0024] It should be noted that simulated transaction orders refer to the use of a simulation environment to simulate the execution process of transaction orders in the real market in the financial market, especially in securities trading.

[0025] It should be noted that the transaction-by-transaction data produced records the detailed information of each transaction in the market, including but not limited to transaction time, transaction price, transaction quantity, and buying and selling direction.

[0026] It should be noted that LEVEL2 market data provides more detailed market information than LEVEL1 market data. Specifically, LEVEL2 market data is sent faster than LEVEL1 market data, and LEVEL1 market data displays five-level market information, while LEVEL2 market data can display more market information. In addition, in addition to basic market information, LEVEL2 market data also provides a variety of new data such as transaction records (i.e., transaction data and entrustment data in the embodiment), buy and sell queues, total entrustment amount and weighted price.

[0027] It should be noted that matching transactions refers to matching orders between buyers and sellers and completing transactions. The trading system will match orders based on the principles of price priority (the highest bid buy order and the lowest bid sell order are matched first) and time priority (at the same price, the earliest submitted order is matched first).

[0028] As an optional embodiment, assume that user A is willing to buy 100 shares at 10 yuan per share. User B is willing to buy 50 shares at 10.5 yuan per share. User C is willing to sell 80 shares at 10 yuan per share. User D is willing to sell 100 shares at 9.8 yuan per share.

[0029] When matching transactions, user B is willing to buy at 10.5 yuan, and the current seller's highest price is less than this price, so it can be matched directly. User D sells 100 shares at 9.8 yuan, which matches the 50-share buy order of user B and completes the transaction. The remaining unfulfilled part forms a pending order and is recorded in the order book.

[0030] Step S104: When the transaction data is a simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction.

[0031] Among them, the initial user order book is generated based on LEVEL2 market data.

[0032] It should be noted that the initial basic order book is generated based on LEVEL2 market data, specifically based on snapshot data in LEVEL2 market data.

[0033] In an exemplary embodiment, the method further comprises: In the case where the transaction data is production transaction data, the user order book and the basic order book are updated based on the production transaction data; wherein the initial basic order book is generated based on LEVEL2 market data.

[0034] It should be noted that the production of transaction data includes transaction data and transaction data. Since the production of transaction data is the data result after matching transactions, when the production of transaction data is received, no matching transaction will be performed, and only the user order book and the basic order book will be updated according to the production of transaction data.

[0035] It should be noted that when there is no simulated transaction order sent by the user, the initial user order book and the initial basic order book remain consistent. After the transaction data is available, the user order book and the basic order book will be continuously updated according to the type of transaction data.

[0036] As an optional embodiment, assuming that the current transaction data is the first production transaction data, the initial basic order book and user order book are updated according to the production transaction data. Assuming that the current transaction data is not the first production transaction data, the basic order book and user order book are matched according to the current status of their respective order books and then updated.

[0037] Assume that the transaction data is the first transaction data produced. At this time, the basic order book and the user order book are both the initial basic order book and the initial user order book, that is, the basic order book and the user order book are consistent at this time, which can be illustrated by the following Table 1: Table 1 Basic order book or user order book

[0038] Assume that the production data at this time is: A-sell order-100 yuan-200 shares. In this case, the basic order book and the user order book are updated synchronously, and the update results are shown in Table 2 below.

[0039] Table 2 Updated basic order book or user order book

[0040] As an optional embodiment, it is assumed that before receiving the simulated transaction order of user C, the basic order book is as shown in Table 1 above, and the order book of user C is as shown in Table 2 above. Since the transaction data is a simulated transaction order, the simulated transaction order is matched only according to the order book of user C, and the order book of the user is updated according to the result of the matching transaction. Only the order book of the user (i.e. user C) is updated (i.e. Table 2 above). Assuming that the simulated transaction order is C-buy order-100.10 yuan-200 shares, the result after the order book is updated is shown in Table 3 below.

[0041] Table 3 Updated user (user C) order book

[0042] It should be noted that there may be multiple users during the simulated trading process. The simulated transaction orders sent by user B only update the order book of user B and will not change the order books of other users.

[0043] It should be noted that if a user uses simulated trading for the first time, the basic order book at the current moment will be used as the user's user order book for matching transactions.

[0044] It should be further explained that, in the prior art, the simulated transaction orders sent by the user will not change the structure of the order book. If there are 200 shares sold at 10 yuan in the order book, and the user buys 200 shares at 10 yuan for the first time, according to the real market transaction logic, when the user has the next purchase of 10 yuan, a pending order will be formed and the matching transaction cannot be carried out. However, in the existing method, since the order book will not change, the second purchase will also be executed, which is obviously not in line with the real transaction logic. That is, the solution in the present invention avoids the problem of not conforming to the real transaction logic in the simulated transaction process by dynamically updating the order book, thereby improving the user experience.

[0045] In the above steps S102-S104, by receiving the transaction data, when receiving the simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction. Matching transactions with transaction data as input improves the matching accuracy. At the same time, by dynamically updating the order book, logical problems that may occur during the order transaction process are avoided, which is closer to the real transaction scene and improves the user experience.

[0046] In an exemplary embodiment, when the transaction data is a simulated transaction order, matching transactions are performed on the simulated transaction orders based on the user order book, and then the user order book is updated based on the result of the matching transaction, including: When the simulated transaction order is the best entrustment of our party, the transaction will be matched at our best price. According to the entrustment volume of the simulated transaction order, the number of pending orders at our best price level will be increased in the user's order book.

[0047] As an optional embodiment, when the order type is the best order of our side, it is converted into a limit order at our best price, enters the order matching logic, and records the order quantity of this level (the number of orders at this price in the order book of this account). The recorded data is active_orders[client_orderid]={"limit_price":order price, "direction":order direction, "front_vol":order quantity at this level; "leaves_qty":unfulfilled quantity (order quantity)}; update the best bid price p_bestbid=max (order price, p_bestbid) and the best ask price p_bestask=min (p_bestask, order price) of the order under this account.

[0048] When the simulated transaction order is not the best order of the party, the number of pending orders at the corresponding price level in the user's order book will be reduced according to the transaction price and transaction quantity for the executed part of the matched transaction, and the number of pending orders at the entrusted price level in the user's order book will be increased for the unexecuted part of the matched transaction.

[0049] As an optional embodiment, when the order type is not the best order of the party, the transaction is matched step by step first. For limit orders, the order book level that is equal to or breaks the order price is matched step by step; for market orders, 1 or 5 levels are matched step by step according to the market order type; and transactions are matched according to the price cross algorithm.

[0050] It should be noted that, in the above embodiment, the unfulfilled part enters the pending order logic, and the pending order quantity of this gear is recorded at the same time, and the recorded data is active_orders; the pending order best buying price p_bestbid=max (pending order price, p_bestbid) and the pending order best selling price p_bestask=min (p_bestask, pending order price) under this account are synchronously updated.

[0051] In an exemplary embodiment, when the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: When producing the best order for each transaction, the number of pending orders at the best price level will be increased in the basic order book and the user order book.

[0052] As an optional embodiment, when the order type OrdType=U (the best order of our side), the number of our best price orders is increased according to the latest order book.

[0053] When the production of tick-by-tick data is a limit order, for the unexecuted orders in the production of tick-by-tick data, the number of pending orders at the order price level will be increased in the basic order book and the user order book according to the order price.

[0054] As an optional embodiment, if the buy order price ≥ the best selling price (p_bestask) of the pending order or the sell order price ≤ the best buying price (p_bestbid), no pending order will be generated, so there is no need to change the order book; if not, the part of the order book level that is better than the order price will be deemed to be executed, and no pending order will be generated, and the order book will not be updated; for the remaining unexecuted part, the number of pending orders at the corresponding level will be increased according to the order price.

[0055] It should be noted that in the above embodiment, after receiving the order data of each order, the order data such as the pending order price and the remaining quantity of the order number are cached md_orders[client_orderid]={"limit_price": pending order price, "direction": order direction, "leaves_qty": unfulfilled quantity}.

[0056] In an exemplary embodiment, when the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: When the produced tick data is the transaction data, the number of pending orders at the transaction price level in the basic order book and the user order book is reduced according to the number of transactions and transaction prices in the produced tick data.

[0057] It should be noted that the transaction data is used to record the specific information of each transaction in the market, mainly including the transaction time, transaction price, transaction quantity, etc. The transaction data also represents the result after the matching transaction. Therefore, there is no need to match the transaction again. Only the transaction data is updated to update the user order book and the basic order book.

[0058] In an exemplary embodiment, when the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: When the produced transaction data is the transaction data of cancelled orders, the original order price is queried according to the order number in the transaction data of cancelled orders; Reduce the number of pending orders at the original commission price level in the basic order book and user order book.

[0059] As an optional implementation example, for the transaction data of order cancellation where the price is 0 but the quantity is not 0, it is necessary to find the original order price according to the order number, reduce the order quantity at the corresponding price, and delete the md_orders data of this order number. If the original order cannot be found, it will not be processed.

[0060] The executor of each step in the method can be a simulated order book matching device based on LEVEL2 market data, which can be implemented by software and / or hardware. The device can be integrated in an electronic device, which can be a terminal device (such as a smart phone, a personal computer, etc.), a server (such as a local server or a cloud server, or a server cluster, etc.), a processor, or a chip, etc.

[0061] Obviously, the above-described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but the technical solutions of the embodiments of the present invention are not limited. Specifically: The above method provided by the present invention is illustrated below by using examples of specific application scenarios.

[0062] The present invention provides a high-precision simulation matching algorithm based on LEVEL2 for transaction-by-transaction entrustment and transaction-by-transaction data, including market data push, high-precision matching, and transaction data management. Figure 2 The figure is a flow chart of the high-precision matching service based on LEVEL2 provided by the present invention.

[0063] The present invention is based on B / S architecture, the front end uses the EasyUI framework based on JQuery, the back end uses the SpringMVC framework, the front and back ends use JSON to transfer data, and the database uses MySQL. Figure 3 The figure shows the technical architecture diagram of the high-precision matchmaking service based on LEVEL2 provided by the present invention. Specifically: 1. Construct a local dynamic order book (i.e., the basic order book in the above embodiment)

[0064] The present invention performs real-time simulation transaction order matching by constructing a local dynamic order book, that is, combining the snapshot data, transaction data, and transaction data of the real LEVEL2 market with the simulated transaction transaction data and transaction data to jointly construct a local dynamic order book. The details are as follows: (1) For the Shenzhen Stock Exchange's individual orders

[0065] (1-1) When the order type OrdType=1 (market price), no pending orders will be generated, so there is no need to change the order book. The generated transaction data will reduce the counterparty's pending orders accordingly.

[0066] (1-2) When the order type OrdType=U (the best order of our side), the number of our best price orders will be increased according to the latest order book.

[0067] (1-3) Limit Order: If the buy order price ≥ p_bestask or the sell order price ≤ p_bestbid, the order book will not be changed. If not, the part of the order book that is better than the order price will be considered as executed and the order book will not be changed. For the remaining unexecuted part, the number of orders in the corresponding level will be increased according to the order price.

[0068] It should be noted that after receiving the order data, the order data such as the pending order price and remaining quantity of the order number are cached md_orders[client_orderid]={"limit_price": pending order price, "direction": order direction, "leaves_qty": unfulfilled quantity}.

[0069] (2) For the transaction of Shenzhen Stock Exchange

[0070] (2-1) For the transaction data of order cancellation, if the price is 0 and the quantity is not 0, it is necessary to find the original order price according to the order number, reduce the order quantity at the corresponding price, and delete the md_orders data of this order number. If the original order cannot be found, it will not be processed; (2-2) For each transaction, the corresponding price order quantity is reduced according to the transaction price, and the original order is found according to the buyer and seller order numbers to reduce the remaining quantity. When the remaining quantity is 0, the md_orders data of this order number is deleted.

[0071] (3) For Shanghai Stock Exchange's individual orders

[0072] (3-1) When the order type OrderType=A (newly added entrustment order), the processing logic is the same as the above-mentioned Shenzhen Stock Exchange's individual entrustment.

[0073] (3-2) When the order type OrderType=D (delete the entrustment order), it is necessary to find the remaining quantity of the original entrustment according to the entrustment number and reduce the number of pending orders at the corresponding price.

[0074] It should be noted that after receiving the order data, the order number and remaining quantity should be cached. When the remaining quantity is 0, this data should be deleted.

[0075] (3) For Shanghai Stock Exchange's transaction-by-transaction

[0076] Reduce the corresponding price entrustment quantity according to the transaction price; find the original entrustment according to the buyer and seller order numbers and reduce the remaining quantity.

[0077] After receiving the transaction data, the transaction is matched first and then the order book data is updated.

[0078] It should be noted that the order book generated based on the first LEVEL2 snapshot data is the initial basic order book in the above embodiment.

[0079] 2. First matching of simulated trading orders

[0080] For simulated trading orders, when the order type is the best order of our party, it is converted into a limit order at our party's best price, enters the order matching logic, and records the number of orders at this price in the order book of this account (i.e., the user order book in the above embodiment)). The recorded data is active_orders[client_orderid]={"limit_price": order price, "direction": order direction, "front_vol": order volume at this level; "leaves_qty": unfulfilled quantity (order quantity)}; update the best bid price p_bestbid=max (order price, p_bestbid) and the best ask price p_bestask=min (p_bestask, order price) of the order under this account.

[0081] When the order type is not the best order of the party, first perform snapshot matching, and first obtain the order book under the securities account. If there is no order book, obtain the local basic order book (i.e. the basic order book in the above embodiment). For limit orders, the order book level that is equal to or breaks through the entrustment price is matched level by level; for market orders, 1 or 5 levels are matched level by level according to the market order type; matching is carried out according to the price crossing algorithm. After the transfer or withdrawal of all traded orders are matched, no new pending orders are generated, so there is no need to update the order book.

[0082] For the unexecuted part of the order, the pending order logic is entered, and the pending order quantity of this gear is recorded at the same time, and the recorded data is active_orders; the pending order best bid price p_bestbid=max (pending order price, p_bestbid) and the pending order best selling price p_bestask=min (p_bestask, pending order price) under this account are synchronously updated.

[0083] When the production transaction order is matched, the local basic order book needs to be updated according to the matching result. When the simulation transaction order completes the matching transaction, only the user order book corresponding to this order is updated. The matching result is the untraded part, and the corresponding order quantity is increased. For the traded part, the corresponding order quantity is reduced according to the transaction price.

[0084] After the simulated trading order goes through the above processing flow, the unfulfilled part enters the pending order processing logic. The pending order is repeatedly matched with the transaction data of each transaction of the real market until all transactions are completed or the order is cancelled. After receiving the transaction data of each transaction, traverse the pending order queue active_orders; if the price is equal to the commission price limit_price, the pending order volume front_vol of this gear is reduced first. When front_vol is reduced to 0, the transaction is triggered and the remaining quantity leaves_qty of this order is reduced; if the price breaks through the commission price limit_price, the remaining quantity of this order number client_orderid is directly triggered to be fully executed, and leaves_qty=0 is set; when leaves_qty is reduced to 0, this order number client_orderid is removed from the pending order queue active_orders. Update the best bid price p_bestbid of pending orders under this account to the maximum value of limit_price in active_orders with direction = buy, and the best selling price p_bestask to the minimum value of limit_price in active_orders with direction = sell. If there is no active_orders, set it to null.

[0085] When a transaction occurs, the local order book under the corresponding securities account will be updated to reduce the number of pending orders corresponding to the transaction price.

[0086] When the pending orders of the above simulated transactions are not executed, users can request to cancel the orders. When high-precision matching receives the cancellation request, it first reduces the pending orders of the limit_price level of the local order book of the corresponding account, and removes the order number client_orderid from active_orders. Then update the pending orders under this account with the best bid price p_bestbid as the maximum value of the limit_price of the direction = buy in active_orders at this time, and the best selling price p_bestask as the minimum value of the limit_price of the direction = sell in active_orders at this time. If there is no active_orders, it is set to null.

[0087] It should be noted that in the real production environment, a large number of orders for targets with poor liquidity will seriously affect the market trend. High-precision matching provides three modes for the processing of large orders for targets with low liquidity in this scenario. Users can choose to process through the front-end configuration. Mode 1: Orders exceeding the threshold are not supported, that is, large orders are not supported; Mode 2: When the transaction price is better than the large order price, it is processed as a full transaction; Mode 3: When the transaction price is better than the large order price, it is processed as a partial transaction according to the actual transaction quantity.

[0088] The present invention can achieve the following technical effects: 1. Provide high-precision matching results support for securities and futures companies to establish simulated trading environments.

[0089] 2. Provide an evaluation, testing and verification environment for trading algorithms in a simulated environment.

[0090] 3. Provide a high-precision algorithm for simulated matching by constructing a local order book based on transaction data.

[0091] Figure 4 : is a schematic diagram of the structure of the simulated order book matching device based on LEVEL2 market data provided by the present invention, such as Figure 4 As shown, the device comprises: A receiving module 410, configured to receive transaction data one by one; The first processing module 420 is used for matching the simulated transaction orders based on the user order book when the transaction data is a simulated transaction order, and then updating the user order book based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data.

[0092] In the above device, by receiving the transaction data, when receiving the simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction. Matching transactions with transaction data as input improves the accuracy of matching. At the same time, by dynamically updating the order book, logical problems that may occur during the order transaction process are avoided, which is closer to the real transaction scene and improves the user experience.

[0093] Optionally, the device also includes a second processing module, which is used to update the user order book and the basic order book based on the production transaction data when the transaction data is production transaction data; wherein the initial basic order book is generated based on LEVEL2 market data.

[0094] Optionally, the first processing module 420 is also used to match transactions at the best price of the party when the simulated transaction order is the best entrustment of the party, and increase the number of pending orders at the best price level of the party in the user order book according to the entrustment amount of the simulated transaction order; when the simulated transaction order is not the best entrustment of the party, the number of pending orders at the corresponding price level in the user order book will be reduced according to the transaction price and transaction quantity for the executed part of the matched transaction, and the number of pending orders at the entrustment price level will be increased in the user order book for the unexecuted part of the matched transaction.

[0095] Optionally, the first processing module 420 is also used to increase the number of pending orders at the best price level in the basic order book and the user order book when the produced transaction data is the best order of the party; when the produced transaction data is a limit order, for the unexecuted orders in the produced transaction data, increase the number of pending orders at the entrustment price level in the basic order book and the user order book according to the entrustment price.

[0096] Optionally, the first processing module 420 is further used to reduce the number of pending orders at the transaction price level in the basic order book and the user order book according to the number of transactions and transaction prices in the produced transaction data when the produced transaction data is transaction data.

[0097] Optionally, the second processing module is also used to query the original entrustment price according to the entrustment number in the order cancellation and transaction data when the produced transaction data is the order cancellation and transaction data; and reduce the number of pending orders at the original entrustment price level in the basic order book and the user order book.

[0098] It should be noted here that the above-mentioned device provided by the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.

[0099] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communications interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute a simulated order book matching method based on LEVEL2 market data, the method comprising: Receive transaction data on a transaction-by-transaction basis; In the case where the transaction data is a simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data.

[0100] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0101] On the other hand, the present invention further provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the simulated order book matching method based on LEVEL2 market data provided by the above methods, and the method includes: Receive transaction data on a transaction-by-transaction basis; In the case where the transaction data is a simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data.

[0102] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the simulated order book matching method based on LEVEL2 market data provided by the above methods, the method comprising: Receive transaction data on a transaction-by-transaction basis; In the case where the transaction data is a simulated transaction order, the simulated transaction order is matched based on the user order book, and then the user order book is updated based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0103] Through the description of the above implementation modes, those skilled in the art can clearly understand that each implementation mode can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A simulated order book matching method based on LEVEL2 market data, characterized in that: include: Receive transaction data on a transaction-by-transaction basis; In the case where the transaction data is a simulated transaction order, matching the simulated transaction order based on the user order book, and then updating the user order book based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data.

2. The simulated order book matching method based on LEVEL2 market data according to claim 1 is characterized in that: The method further comprises: In a case where the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data; Among them, the initial basic order book is generated based on LEVEL2 market data.

3. The simulated order book matching method based on LEVEL2 market data according to claim 1 is characterized in that: In the case where the transaction data is a simulated transaction order, matching the simulated transaction order based on the user order book, and then updating the user order book based on the result of the matching transaction, including: In the case where the simulated transaction order is the best entrustment of the party, the transaction is matched at the best price of the party, and the number of pending orders at the best price level of the party is increased in the user order book according to the entrustment amount of the simulated transaction order; In the case that the simulated transaction order is not the optimal entrustment of the party, the number of pending orders at the corresponding price level in the user order book will be reduced according to the transaction price and transaction quantity for the executed part of the matched transaction, and the number of pending orders at the entrusted price level will be increased in the user order book for the unexecuted part of the matched transaction.

4. The simulated order book matching method based on LEVEL2 market data according to claim 2 is characterized in that: When the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: In the case where the production transaction data is the best order of the party, the number of pending orders at the best price level of the party is increased in the basic order book and the user order book; In the case where the production of the transaction data is a limit order, for the unexecuted orders in the production of the transaction data, the number of pending orders at the order price level is increased in the basic order book and the user order book according to the order price.

5. The simulated order book matching method based on LEVEL2 market data according to claim 2 is characterized in that: When the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: In the case where the produced transaction data is transaction data, the number of pending orders at the transaction price level is reduced in the basic order book and the user order book according to the number of transactions and the transaction price in the produced transaction data.

6. The simulated order book matching method based on LEVEL2 market data according to claim 2 is characterized in that: When the transaction data is production transaction data, updating the user order book and the basic order book based on the production transaction data includes: In the case where the produced transaction data is the transaction data of cancelled orders, querying the original order price according to the order number in the transaction data of cancelled orders; The number of pending orders at the original entrustment price level is reduced in the basic order book and the user order book.

7. A simulated order book matching device based on LEVEL2 market data, characterized in that: include: A receiving module, used for receiving transaction data one by one; A first processing module is used for matching the simulated transaction orders based on the user order book when the transaction data is a simulated transaction order, and then updating the user order book based on the result of the matching transaction; Among them, the initial user order book is generated based on LEVEL2 market data.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the simulated order book matching method based on LEVEL2 market data as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the simulated order book matching method based on LEVEL2 market data as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by the processor, the simulated order book matching method based on LEVEL2 market data as described in any one of claims 1 to 6 is implemented.