Order book data construction method and system based on FPGA
By using FPGA programmable logic components to decode and reassemble market data, combined with caching and memory storage, the problem of slow order book construction in high-frequency trading is solved, achieving a fast response to market data.
Patent Information
- Application Number
- CN202511374997.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-09-25
AI Technical Summary
In high-frequency trading scenarios, existing technologies have slow order book construction speeds when implemented purely in software, resulting in excessively long transaction processing times. Furthermore, the complex interaction between FPGA hardware and software systems can lead to packet loss, further impacting order book construction speed.
An FPGA-based order book data construction method is adopted. The programmable logic components of the FPGA decode and reassemble the market data, and the order book data is quickly constructed by using a combination of cache and memory storage mechanism, avoiding frequent hardware and software interaction.
It improves the speed of order book data construction, reduces transaction latency, ensures rapid response to dynamically changing market conditions in high-frequency trading scenarios, and reduces the impact of slow data access.
Smart Images

Figure CN120872855B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of data processing, in particular to an order book data construction method and system based on FPGA. BACKGROUND
[0002] In the financial field, the order book is an electronic list that records all buy / sell orders in the financial market, including the price and quantity that market participants are willing to buy / sell, the difference between the lowest sell price and the highest buy price, and other information. By establishing an order book through the placement and execution of market quotes, new market data fluctuations can be obtained more quickly, providing a reference for downstream businesses.
[0003] With the development of computer and Internet technology, the faster the analysis speed of market information in the trading scenario, the faster the order book can be constructed, thereby effectively meeting the needs of downstream businesses. The existing technology generally implements order book construction through pure software, but in high-frequency trading scenarios (such as capturing market instantaneous price differences, where transaction instructions need to be completed within microseconds or even nanoseconds), the pure software implementation is based on the software CPU instruction structure, which means that a program is executed line by line, resulting in relatively long construction time, thereby affecting downstream business transactions, etc.
[0004] To solve this problem, the invention patent with publication number CN114549129A proposes a low-latency high-throughput real-time order book generation method. The disclosed content proposes a software and hardware combination scheme combining FPGA hardware and software systems. By dividing the contract order book into mutually exclusive large and small tables, the small table is stored in FPGA hardware, and the large table is stored in the software system, realizing the storage of a complete order book through the software and hardware combination method, fully utilizing the advantages of high concurrency and low latency of FPGA hardware and the flexible capacity of software storage, increasing practicality and reducing costs.
[0005] However, since the large and small tables divided from the contract order book have a mutual exclusion relationship and are stored in FPGA hardware and software systems respectively, it is necessary to traverse the large and small tables separately each time a transaction is processed, thereby prolonging the time required for transaction processing. In addition, since FPGA hardware and software systems support order book generation through a mutually dependent relationship, FPGA hardware and software systems need to interact frequently, and the interaction logic between hardware and software is not only complex, but also may cause packet loss due to slow software interaction processing speed when high traffic quotes enter (such as the collective bidding phase), thereby reducing the speed of order book construction. Although the software and hardware combination scheme can improve the speed of order book construction compared to pure software methods, there is still room for improvement in the software and hardware combination scheme, and therefore an effective solution is urgently needed to solve the above problems. SUMMARY
[0006] Therefore, the embodiment of the present specification provides an order book data construction method based on FPGA. One or more embodiments of the present specification also relate to an order book data construction system based on FPGA and an electronic device to solve the technical defects in the prior art.
[0007] According to a first aspect of the embodiment of the present specification, a first order book data construction method based on FPGA is provided, applied to a programmable logic component, comprising:
[0008] Obtaining transaction market data and decoding the transaction market data;
[0009] Reorganizing the decoded transaction market data according to a preset format to obtain market information;
[0010] Synchronously sending the market information to a target memory and a target cache, and constructing order book data based on the market information in the target cache.
[0011] According to a second aspect of the embodiment of the present specification, a second order book data construction method based on FPGA is provided, applied to a programmable logic component, comprising:
[0012] Obtaining transaction market data and decoding the transaction market data;
[0013] Reorganizing the decoded transaction market data according to a preset format to obtain first market information and second market information;
[0014] Synchronously sending the first market information to a target memory and a target cache, and constructing level information based on the first market information in the target cache;
[0015] Reading the level information from the target cache, and assembling the level information and the second market information to construct order book data.
[0016] According to a third aspect of the embodiment of the present specification, a third order book data construction method based on FPGA is provided, applied to a programmable logic component, comprising:
[0017] Obtaining transaction market data and decoding the transaction market data to obtain per-transaction data and snapshot data;
[0018] Reorganizing the per-transaction data according to a preset format to obtain market information;
[0019] Synchronously sending the market information to a target memory and a target cache, and constructing order book data based on the market information in the target cache;
[0020] The order book data and the snapshot data are compared, and optimal order book data is determined according to a comparison result.
[0021] According to a fourth aspect of the embodiments of the present specification, a fourth FPGA-based order book data construction method is provided, applied to a programmable logic component, comprising:
[0022] Multi-source heterogeneous data is acquired, and the multi-source heterogeneous data is split into at least two paths of complementary multi-source heterogeneous sub-data.
[0023] Each path of corresponding multi-source heterogeneous sub-data is processed to obtain each path of corresponding market sub-information.
[0024] Each path of corresponding market sub-information is sent to a corresponding target memory and a target cache, and each path of corresponding order book sub-data is constructed based on the market sub-information in the target cache.
[0025] Each path of corresponding order book sub-data is merged to obtain order book data.
[0026] According to a fifth aspect of the embodiments of the present specification, a fifth FPGA-based order book data construction method is provided, applied to a programmable logic component, comprising:
[0027] Trading market data is acquired, and the trading market data is decoded.
[0028] The decoded trading market data is data-reorganized according to a preset format to obtain market information.
[0029] The market information is synchronously sent to a target memory and a target cache, an optimal buying and selling position table is constructed based on the market information in the target cache, and order book data is constructed according to the optimal buying and selling position table.
[0030] In a case where structured data corresponding to the optimal buying and selling position table meets a data update condition, associated position elements are deleted and / or adjusted in the structured data, and target order book data is constructed according to a deletion and / or adjustment result.
[0031] According to a sixth aspect of the embodiments of the present specification, a first FPGA-based order book data construction system is provided, comprising a server and a terminal, wherein the server is configured with a programmable logic component, comprising:
[0032] The server is configured with a programmable logic component, and comprises:
[0033] The terminal is configured to render a transaction market list in a transaction page based on the order book data and display the transaction market list, or execute a transaction strategy based on the order book data.
[0034] According to a seventh aspect of the embodiments of the present specification, a second FPGA-based order book data construction system is provided, comprising a server and a terminal, wherein the server is configured with a programmable logic component, comprising:
[0035] The server is configured with a programmable logic component, and comprises:
[0036] The terminal is configured to render a transaction market list in a transaction page based on the order book data and display the transaction market list, or execute a transaction strategy based on the order book data.
[0037] According to an eighth aspect of the embodiments of the present specification, a third FPGA-based order book data construction system is provided, comprising a server and a terminal, wherein the server is configured with a programmable logic component, comprising:
[0038] The server is configured with a programmable logic component, and comprises:
[0039] The terminal is configured to render a transaction market list in a transaction page based on the optimal order book data and display the transaction market list, or execute a transaction strategy based on the optimal order book data.
[0040] According to a ninth aspect of the embodiments of the present specification, a fourth FPGA-based order book data construction system is provided, comprising a server and a terminal, wherein the server is configured with a programmable logic component, comprising:
[0041] The server is configured to obtain multi-source heterogeneous data through the programmable logic component, and split the multi-source heterogeneous data into at least two complementary multi-source heterogeneous sub-data; process each corresponding multi-source heterogeneous sub-data to obtain each corresponding market sub-information; send each corresponding market sub-information to a corresponding target memory and a target cache, and construct each corresponding order book sub-data based on the market sub-information in the target cache; merge each corresponding order book sub-data to obtain order book data; and send the order book data to the terminal.
[0042] The terminal is configured to render a transaction market list in a transaction page based on the order book data and display the transaction market list, or execute a transaction strategy based on the order book data.
[0043] According to a tenth aspect of the embodiments of the present specification, a fifth FPGA-based order book data construction system is provided, comprising a server and a terminal, wherein the server is configured with a programmable logic component, comprising:
[0044] The server is configured to obtain transaction market data through the programmable logic component, and decode the transaction market data; reorganize the decoded transaction market data according to a preset format to obtain market information; synchronize the market information to a target memory and a target cache, construct an optimal buy / sell position table based on the market information in the target cache, and construct order book data based on the optimal buy / sell position table; in a case where structured data corresponding to the optimal buy / sell position table meets a data update condition, delete and / or adjust associated position elements in the structured data, and construct target order book data according to the deletion and / or adjustment results; and send the target order book data to the terminal.
[0045] The terminal is configured to render a transaction market list in a transaction page based on the target order book data and display the transaction market list, or execute a transaction strategy based on the target order book data.
[0046] According to an eleventh aspect of the embodiments of the present specification, an electronic device is provided, which is a programmable logic component configured to perform the steps of the above-described FPGA-based order book data construction.
[0047] The order book data construction method based on FPGA provided by the embodiment is applied to a programmable logic component. In order to improve the order book data construction speed and reduce the influence caused by slow data access, the application provides a pure hardware order book data construction scheme. After the programmable logic component obtains transaction market data, the transaction market data is first decoded, and then the decoded transaction market data is reorganized according to a preset format to obtain market information. At this time, in order to support subsequent rapid completion of order book data construction, the market information can be synchronously sent to a target memory and a target cache. At this time, the target memory can directly perform a market information storage operation, and the target cache can detect whether the market information needs to be stored, so that the target cache can maintain data associated with a specific data structure. On this basis, order book data can be constructed based on the market information in the target cache. In this way, the programmable logic component is used to accelerate market data reading and support data reading operation through the memory of the programmable logic component, so as to improve the order book data construction speed while ensuring normal operation of the business, and in the transaction scenario, downstream businesses can more conveniently respond to dynamically changing transaction market information. BRIEF DESCRIPTION OF DRAWINGS
[0048] Figure 1 is a flowchart of a first order book data construction method based on FPGA provided by an embodiment of the present specification;
[0049] Figure 2a is a schematic diagram of a first order book data construction process based on FPGA provided by an embodiment of the present specification;
[0050] Figure 2b is a schematic diagram of a second order book data construction process based on FPGA provided by an embodiment of the present specification;
[0051] Figure 2c is a schematic diagram of a third order book data construction process based on FPGA provided by an embodiment of the present specification;
[0052] Figure 2d is a schematic diagram of a fourth order book data construction process based on FPGA provided by an embodiment of the present specification;
[0053] Figure 2e is a schematic diagram of a fifth order book data construction process based on FPGA provided by an embodiment of the present specification;
[0054] Figure 2f is a schematic diagram of a sixth order book data construction process based on FPGA provided by an embodiment of the present specification;
[0055] Figure 3 is a flow chart of a second FPGA-based order book data construction method provided by an embodiment of the present specification;
[0056] Figure 4 is a flow chart of a third FPGA-based order book data construction method provided by an embodiment of the present specification;
[0057] Figure 5 is a flow chart of a fourth FPGA-based order book data construction method provided by an embodiment of the present specification;
[0058] Figure 6 is a flow chart of a fifth FPGA-based order book data construction method provided by an embodiment of the present specification;
[0059] Figure 7 is a structural schematic diagram of a first FPGA-based order book data construction system provided by an embodiment of the present specification;
[0060] Figure 8 is a structural schematic diagram of a second FPGA-based order book data construction system provided by an embodiment of the present specification;
[0061] Figure 9 is a structural schematic diagram of a third FPGA-based order book data construction system provided by an embodiment of the present specification;
[0062] Figure 10 is a structural schematic diagram of a fourth FPGA-based order book data construction system provided by an embodiment of the present specification;
[0063] Figure 11 is a structural schematic diagram of a fifth FPGA-based order book data construction system provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0064] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, it would be apparent to those skilled in the art that the present specification can be practiced without the specific details set forth in the following description, and that the present specification can be implemented in many different ways, and that the present specification is not limited to the embodiments disclosed in the following description. In other instances, well-known methods, procedures and components have not been described in detail so as not to unnecessarily obscure aspects of the present specification.
[0065] The terminology used in this disclosure one or more embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this disclosure one or more embodiments. As used in this disclosure one or more embodiments and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification one or more embodiments, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0066] It is to be understood that the terms first, second, etc. can be employed in this disclosure one or more embodiments to describe various information. Such information should not be limited by these terms. These terms are only used to distinguish one category of information from another category of information. For example, without departing from the scope of this disclosure one or more embodiments, first could be termed second, and similarly, second could be termed first. Depending on the context, the word "if" as used herein can be interpreted to mean "when" or "in response to determining." Depending on the context, the word "if" as used herein can be interpreted to mean "when" or "in response to determining."
[0067] In addition, it should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this disclosure one or more embodiments are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0068] First, the terms involved in this disclosure one or more embodiments are explained.
[0069] FPGA (Field-Programmable Gate Array) is a kind of integrated circuit, which can be configured by hardware description language (such as VHDL or Verilog) to realize specific functions.
[0070] DDR (Double Data Rate) is a kind of DRAM technology, which can transmit data on the rising and falling edges of each clock cycle, thereby doubling the data transmission rate.
[0071] HBM (High Bandwidth Memory): a high-bandwidth memory technology designed specifically for high-performance graphics accelerators, network devices, high-performance computing (HPC), etc. Unlike traditional DDR SDRAM, HBM uses 3D stacking technology to vertically stack multiple DRAM chips together and uses a wider data bus to achieve higher data transfer rates and lower power consumption.
[0072] Cache: a small-capacity but very fast memory located between the CPU and the main memory. In this embodiment, the cache mentioned is the internal cache of the FPGA.
[0073] In practical applications, the order book that records all buy and sell orders in the financial market is generally implemented by pure software. However, in the high-frequency trading scenario, the core of high-frequency trading is to capture the instantaneous price difference in the market to meet the buying and selling needs of different users. Therefore, the transaction instructions triggered by users need to be completed within microseconds or even nanoseconds. The implementation of software will cause the construction time to be longer, which seriously affects the downstream business processing.
[0074] Therefore, the present specification provides an order book data construction method based on FPGA. One or more embodiments of the present specification also relate to an order book data construction system based on FPGA, an electronic device, which are described in detail one by one in the following embodiments.
[0075] The FPGA-based order book data construction method provided in the embodiment proposes to use FPGA to accelerate high-frequency trading processing. Based on FPGA, ultra-high parallelism can be achieved, and high parallel processing and low latency characteristics are possessed. By replacing traditional software processing messages with FPGA, the message processing time is compressed to the level of hundreds of nanoseconds. Therefore, it can be determined that FPGA realizes parallel computing at the hardware level, which can process market data and execute transaction decisions faster, greatly reducing transaction latency. Therefore, in the high-frequency trading processing scenario, transaction decisions can be responded more quickly, which is more conducive to users quickly capturing the expected price difference for trading. In addition, since the delay of FPGA is determined, it does not have jitter and predictable reaction time, which can avoid performance changes, thereby ensuring that transaction instructions can be responded and executed within a very short time.
[0076] On this basis, the daily market source is analyzed by code to obtain that most of the entrustment orders are close to completion, that is, the entrustment orders are almost in the optimal ten buying and selling ranks; the cache reading speed only needs several nanoseconds, the DDR / HBM reading needs several hundred nanoseconds, and the cache reading time is far less than the DDR / HBM reading time. According to the above characteristics, the order book data construction method based on FPGA provided in the embodiment supports the order book data fast construction by using the DDR / HBM+cache combination in FPGA, uses the cache of FPGA to maintain the optimal ten buying and selling ranks, and thus achieves the purpose of accelerating access. When a new order appears, the market information corresponding to the order can be sent to the DDR / HBM and the cache at the same time, the DDR / HBM stores the full amount of information according to the market information, and the cache only stores the market information about the optimal ten buying and selling ranks; when the downstream processes, the corresponding rank information is searched from the cache, the order book data corresponding to the order market is directly read and constructed. If the ranks in the cache are lost due to order cancellation or the like, because the DDR / HBM in FPGA stores the full amount of data, the cache can quickly read the corresponding data from the DDR / HBM, so as to maintain the optimal buying and selling rank table and realize the fast construction of the order book to meet the high-speed transaction demand of the downstream.
[0077] Referring to Figure 1 , Figure 1 A flow chart of a first order book data construction method based on FPGA is shown, which is provided according to one embodiment of the present specification and applied to a programmable logic component. The order book data construction based on FPGA provided in the embodiment can be applied to the order book construction scene in the transaction business of securities, futures and the like, the optimal buying and selling rank table is maintained through the cache of the programmable logic component, the full amount of market information is stored in the memory, the full hardware high-speed execution is realized, the construction speed of the order book data is greatly improved, so as to facilitate the downstream to respond to the constructed order book data for transaction operation. Specifically, the following steps are included.
[0078] In step S102, the transaction market data is acquired and decoded.
[0079] Specifically, the programmable logic component specifically refers to FPGA; the transaction market data specifically refers to the market data used for real-time construction of the order book in the securities or futures scene, including the tick data and snapshot data, the snapshot data refers to the field used for recording the transaction state or market condition at a specific time point, such as the yesterday's closing price, the opening price, the minimum price, the maximum price and the like, the tick data includes the entrustment data and the completion data, such as the entrustment quantity, the entrustment price, the completion quantity, the completion amount and the like.
[0080] The decoding of the transaction market data refers to processing the transaction market data according to the exchange business coding format to obtain the per-order data and / or snapshot data of each order, so as to facilitate subsequent use.
[0081] Based on this, in order to improve the order book data construction speed and reduce the influence caused by slow data access, the application proposes a pure hardware order book data construction scheme. After the programmable logic component obtains the transaction market data, the transaction market data is first decoded, and then the decoded transaction market data is reorganized according to the preset format to obtain market information. At this time, in order to support the subsequent rapid completion of the construction of the order book data, the market information can be sent to the target memory and the target cache. At this time, the target memory can directly perform the storage operation of the market information, and the target cache can detect whether the market information needs to be stored, so that the target cache can maintain the data associated with a specific data structure. On this basis, the order book data can be constructed based on the market information in the target cache. In this way, the cache of the programmable logic component is used to accelerate the reading of market data, and the memory of the programmable logic component is used to support the data reading operation, thereby improving the order book data construction speed while ensuring the normal operation of the business. In the trading scenario, the downstream business can respond to the dynamically changing transaction market more quickly.
[0082] Further, considering that the data obtained in the trading scenario may come from different nodes, the obtained data can be preprocessed and then decoded according to the set protocol. In the embodiment, the specific implementation is as follows:
[0083] Obtain multi-source heterogeneous data, and preprocess the multi-source heterogeneous data to obtain transaction market data; decode the transaction market data according to a binary protocol or an information exchange protocol to obtain per-order data.
[0084] Specifically, the multi-source heterogeneous data specifically refers to the data issued by multiple market sources when inputting the programmable logic component, including multiple types of data, and therefore needs to be preprocessed. The preprocessing mainly refers to filtering the multi-source heterogeneous data, removing non-transaction market data, and deleting transaction market data irrelevant to the final order book, such as securities order book construction, and deleting bond market data in advance. Correspondingly, the binary protocol and the information exchange protocol specifically refer to the exchange business coding format protocol. The binary protocol is Binary Protocol, and the information exchange protocol is FAST protocol (Financial Information eXchange).
[0085] In a specific implementation, the transaction securities market information is decoded according to the business coding format of the exchange securities market information to obtain the transaction-by-transaction market information, which can be completed by a decoding module in the FPGA, and the decoding module does not cache data, so that the data can pass through at full speed, and the decoded transaction-by-transaction data can be used for reorganization, thereby improving the data processing efficiency.
[0086] In step S104, the decoded transaction market data is reorganized according to a preset format to obtain market information.
[0087] Specifically, the preset format refers to the format used for reorganizing the transaction market data, and correspondingly, the market information refers to the price, quantity, starting storage address, maximum number of levels, channel, security code, time, and the like corresponding to the transaction-by-transaction order.
[0088] Based on this, by reorganizing the decoded transaction-by-transaction data, the one-to-one mapping of the price and the level can be completed according to the price and the quantity of the transaction-by-transaction order, and by using the starting storage address, the maximum number of levels, the channel, the security code, the time, and the like of the market information, the allocation of the storage addresses of each stock in the target memory DDR / HBM can be completed, so as to be used as index information when the data is stored subsequently.
[0089] In addition, when the transaction market data is decoded to obtain the transaction-by-transaction data, the data reorganization processing can be completed only for the transaction-by-transaction data, so as to obtain the market information corresponding to the transaction-by-transaction order, which is then sent to the target cache and the target memory for subsequent use in constructing the order book data.
[0090] In actual application, the data reorganization processing of the transaction market data can be implemented by a reorganization module in the programmable logic component, which can reorganize the field data output by the decoding module into a structure according to the output format, so as to obtain the market information for subsequent use.
[0091] In step S106, the market information is sent to the target memory and the target cache, and the order book data is constructed based on the market information in the target cache.
[0092] Specifically, the target memory is a DDR / HBM in the programmable logic component, and the target cache is a cache in the programmable logic component, wherein the reading time of the target cache is much shorter than that of the target memory (the reading speed of the cache only needs a few nanoseconds, and the reading of the DDR / HBM needs a few hundred nanoseconds). Correspondingly, the order book data is the data used to construct the transaction market list, and the transaction market list is the optimal price buying and selling level table that needs to be displayed on the user side, such as the optimal price buying and selling ten-level table.
[0093] Based on this, after obtaining market information, in order to improve the order book data construction speed, the market information can be stored in the target cache and the target memory in synchronization, and then the order book data can be constructed based on the market information in the target cache, so as to quickly respond to the transaction demand of the downstream to the user end, so that the user end can quickly construct the transaction market list corresponding to the order book data. And when the user has the demand to view more market information, more order book data can be constructed based on the market information in the target memory, so that the user end can view the transaction market list with more gears, and meet the user's market information viewing demand in different scenarios. As shown in Table 1, after the order book data is constructed, it can be pushed to the user and the institution for order book display, transaction decision and the like.
[0094] Table 1: Order book data
[0095]
[0096] Further, in order to improve the order book data construction speed by cooperating the cache and the memory in the FPGA hardware, the market information can be sent to the target cache and the target memory in synchronization, and since the target cache has limited storage space, whether the market information is stored in the target cache in real time needs to be detected. In this embodiment, the specific implementation is as follows:
[0097] Detect whether the market information meets the storage condition of the target cache; if yes, store the market information in the target cache and the target memory in synchronization; if no, store the market information in the target memory.
[0098] Specifically, the storage condition specifically refers to detecting whether the market information belongs to the information within the data range maintained by the target cache. Based on this, after obtaining the market information, the market information can be sent to the target cache and the target memory in synchronization, and since the target cache has limited storage space and cannot maintain full data, before the market information is written into the target cache, it needs to be detected whether it meets the storage condition of the target cache. If yes, it means that the market information belongs to the information within the data range maintained by the target cache, and the market information can be stored in the target cache and the target memory in synchronization, so as to support the downstream to complete the reading operation from the target cache quickly when reading data. If no, it means that the target cache does not need to store the market information, so the market information can be stored only in the target memory, and when the target cache needs the data, it can be read from the target memory.
[0099] That is, the cache and DDR / HBM of the FPGA hardware synchronously receive market information, and when writing, the market information can be directly written to the DDR / HBM, and when writing to the cache, it is necessary to determine whether the price and quantity in the market information are within the range of the optimal buy / sell position table maintained by the cache, if so, it can be written, otherwise it needs to be discarded. When building the subsequent order book data, the data can be quickly read from the cache, and when the data in the optimal buy / sell position table maintained by the cache is insufficient, the corresponding data is read from the DDR / HBM to complete it, so that the cache always maintains a complete optimal buy / sell position table. By fully utilizing the logical resources of the cache and DDR / HBM in the FPGA, the entire construction process is implemented through pure hardware, which can accelerate the construction of the order book, avoiding the low-speed problem of pure software implementation and the frequent interaction between hardware and software in the combination of software and hardware implementation.
[0100] In addition, in addition to the detection processing before writing data to the target cache as described above, data detection processing can be performed after the market information is synchronously sent to the target cache and the target memory and both complete the writing operation. It can be understood that after the tick-by-tick data obtained at the current time is constructed into market information, the market information can be selected to be synchronously stored in the target cache and the target memory. Since the target cache only maintains the optimal buy / sell position table (such as the optimal buy / sell ten position table), if this part of data belongs to part of the optimal buy / sell ten position table, it can be stored in the target cache and updated with the structured data of the optimal buy / sell ten position table. Similarly, the structured data in the target memory will also be updated. When this part of data does not belong to the optimal buy / sell ten position table, storing it in the target cache does not affect the structure and content of the table, so this part of data can be released from the target cache after being synchronously stored in the target cache and the target memory, that is, deleting this part of data from the target cache, to avoid wasting storage resources. The target memory as a full storage strategy will not be released, so this part of data can be stored and the structured data can be updated.
[0101] In specific implementation, for the market information written to the target cache and the target memory, it can be selected to judge whether the market information needs to be written to the target cache before writing, or it can be selected to judge whether the data needs to be released after writing, so that the data not belonging to the target cache can be selectively discarded, to improve the resource utilization rate and avoid wasting the storage resources of the cache.
[0102] Further, after storing the market information in the target cache, in order to support subsequent rapid reading of data from the cache to build the order book, the optimal buy / sell position table can be constructed. In this embodiment, the specific implementation is as follows:
[0103] In the case that the market information is successfully stored in the target cache, the market information stored in the target cache is analyzed, and an optimal buying and selling position table is constructed according to the analysis result, and order book data is obtained based on the optimal buying and selling position table, wherein the position elements of the optimal buying and selling position table are more than or equal to the position elements of the order book data.
[0104] Specifically, the optimal buying and selling position table refers to a table structure of selecting a certain number of position elements, for example, in a securities trading scenario, an optimal buying and selling ten-position table needs to be constructed, and 20 data with optimal buying and selling prices can be selected to construct, as shown in Table 2 below, which can be set according to actual needs, and the embodiment does not make any limitation here.
[0105] In the optimal buying and selling ten-position table, the higher the buying price, the higher the priority of the corresponding data, and the lower the selling price, the higher the priority of the corresponding data. The position information includes a plurality of position elements, and the position elements include position, quantity, and price, such as buy1-1000-10.04 in Table 2.
[0106] Table 2: Optimal buying and selling ten-position table
[0107]
[0108] Based on this, in the case that the market information is successfully stored in the target cache, in order to quickly complete the construction of the order book data through the position information stored in the target cache, the data stored in the target cache can be analyzed, and an optimal buying and selling position table is constructed according to the analysis result, so as to realize maintaining the optimal buying and selling position table through the target cache, and support directly reading the structured data of the optimal buying and selling position table from the target cache when the order book data needs to be constructed, thereby improving the construction speed of the order book.
[0109] In addition, in the actual processing process, the optimal buying and selling position table may be missing due to order cancellation or complete transaction, and therefore more position elements than the order book data can be maintained in the optimal buying and selling position table. For example, the finally constructed order book data includes 20 position elements in the optimal buying and selling ten-position table, but the optimal buying and selling fifteen-position table (30 position elements) can be maintained in the optimal buying and selling position table in the target cache. In this way, when the position of the optimal buying and selling position table in the target cache is missing, it can be quickly filled, and there is no need to read the position elements of the next position from the target memory, so that the construction of the order book data can be faster.
[0110] Furthermore, when new market information is received in real time, the data in the cache needs to be updated dynamically, so as to support more accurate subsequent construction of the order book and meet the current trading needs. In the embodiment, the specific implementation manner is as follows:
[0111] receive target market information, and determine order price information and quantity information corresponding to the target market information;
[0112] In the case that the order price information is associated with the optimal bid-ask table and belongs to a non-increased price, the structured data corresponding to the optimal bid-ask table is updated according to the quantity information;
[0113] In the case that the order price information is associated with the optimal bid-ask table and belongs to an increased price, a to-be-updated position element is determined according to the order price information and the quantity information, and the structured data corresponding to the optimal bid-ask table is updated based on the to-be-updated position element;
[0114] In the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to a cancellation or complete transaction, a candidate position element is read from the target memory and stored in the target cache, and the structured data corresponding to the optimal bid-ask table is updated based on the candidate position element;
[0115] In the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to a cancellation or complete transaction, and the number of position elements of the optimal bid-ask table is greater than that of the order book data, a to-be-updated position element is determined according to the order price information and the quantity information, and the structured data corresponding to the optimal bid-ask table is updated based on the to-be-updated position element; in an idle state or when the number of position elements of the optimal bid-ask table is less than a set threshold, a candidate position element is read from the target memory and stored in the target cache, and the structured data corresponding to the optimal bid-ask table is updated based on the candidate position element;
[0116] The order book data is constructed based on the updated structured data.
[0117] Specifically, the target market information specifically refers to the received new market information; the order price information specifically refers to the order price or the transaction price recorded in the target market information, and the quantity information specifically refers to the order quantity of the buy order or the sell order. Correspondingly, the structured data specifically refers to the data structure corresponding to the optimal bid-ask table.
[0118] Correspondingly, in the case that the order price information is associated with the optimal bid-ask table and is of an increased type, the order price information is not in the original optimal bid-ask table, but belongs to the price information that needs to be maintained in the optimal bid-ask table. The to-be-updated position element refers to the position element that needs to be inserted and / or deleted in the current optimal bid-ask table, and the position element includes position, price and quantity.
[0119] Correspondingly, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the case of canceling or completely completing, specifically, the order / deal (buy or sell) of a certain position becomes 0, the corresponding position element in the optimal bid-ask table needs to be deleted, but in order to ensure the integrity of the position quantity, the position element needs to be supplemented. The supplemented position element is the candidate position element, and the candidate position element is read from the target memory.
[0120] Correspondingly, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the case of canceling or completely completing, and the position elements of the optimal bid-ask table are more than the position elements of the order book data, specifically, the order / deal (buy or sell) of a certain position becomes 0 due to canceling or completely completing, and the corresponding position element in the optimal bid-ask table needs to be deleted, and at this time, the position elements of the optimal bid-ask table are more than the position elements of the order book data, so the next position element in the optimal bid-ask table can be directly used to supplement. The to-be-updated position element refers to the position element that needs to be adjusted and / or deleted in the current optimal bid-ask table, and the position element includes the position, price and quantity. The idle state refers to the case that no new market information is received, or the new market information is not the market information of the stock, and other cases that do not affect the current processing speed of the target memory and the target cache. In the idle state, or when the position elements of the optimal bid-ask table are less than a set threshold, a certain number of candidate position elements can be read from the target memory and stored in the target cache.
[0121] Based on this, considering that the order book displayed at this time is constructed based on the position information in the target cache, and the new market information will cause the order book to change, it is necessary to determine the order price information and the quantity information corresponding to the target market information, and then determine how to update the corresponding order book data after the current trading operation.
[0122] In the first aspect, in the case that the order price information is determined to be associated with the optimal bid-ask table and belongs to the case of non-new price, it is indicated that the order price associated with the target market information is located in the price range included in the optimal bid-ask table, and the price is the same as that of one of the positions, but the transaction quantity has changed. For example, the original sell quantity of A price in the list is 10000, and the new market information adds a new order for this transaction with a quantity of 1000, so the original quantity needs to be updated.
[0123] In the second aspect, in the case that the order price information is associated with the optimal bid-ask table and the order price information is of the new type, the order price corresponding to the target market information is between the first and last prices of the optimal bid-ask table, and is not equal to the price recorded in the table, so the optimal bid-ask table needs to be reconstructed. The bid-ask elements that need to be inserted and the bid-ask elements that need to be deleted can be determined according to the target market information. Then, the structured data corresponding to the optimal bid-ask table can be updated according to the bid-ask elements to be updated, which can be understood as inserting new bid-ask elements and deleting old bid-ask elements exceeding the set bid-ask requirement, such as deleting the bid-ask element with the lowest buy price or the bid-ask element with the highest sell price, so as to construct the order book data from the updated structured data.
[0124] In the third aspect, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the case of canceling or complete transaction, the delegation / transaction (buy or sell) of a certain bid-ask element is canceled to 0, and the corresponding bid-ask element in the optimal bid-ask table needs to be deleted. However, in order to maintain the integrity of the bid-ask quantity, the bid-ask element needs to be completed. In this embodiment, because the target memory stores the full market information, the target cache can directly read the required candidate bid-ask information from the memory and insert the candidate bid-ask information into the corresponding position of the optimal bid-ask table, so as to maintain the complete optimal bid-ask table.
[0125] In the fourth aspect, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the case of canceling or complete transaction, when the number of bid-ask elements in the optimal bid-ask table is more than the number of bid-ask elements in the order book data, the bid-ask element of the next bid-ask in the optimal bid-ask table can be directly used to fill in. In the idle state, or when the number of bid-ask elements in the optimal bid-ask table is less than the set threshold, a certain number of candidate bid-ask elements are read from the target memory and stored in the target cache. For example, the order book data needs 20 bid-ask elements of the optimal ten bid-asks, and the optimal bid-ask table contains 30 bid-ask elements of the optimal fifteen bid-asks. When the third bid-ask of the sell side in the optimal bid-ask table is canceled to 0, the fourth bid-ask of the sell side can be directly updated to the third bid-ask, and the following bid-ask elements can be updated in turn, without the need to read the bid-ask elements of the eleventh bid-ask from the target memory. When the optimal fifteen bid-asks are less than the set threshold, such as only the optimal ten bid-asks, the bid-ask elements of the optimal bid-ask eleven to fifteen can be read from the target memory as candidate bid-ask elements, stored in the target cache, and the optimal bid-ask table is updated. Of course, in the idle state, such as when there is no new delegation, or when the new delegation is for other stocks, a certain number of candidate bid-ask elements can be read from the target memory and stored in the target cache.
[0126] In specific implementation, after the FPGA synchronously sends the market information to the cache module, the FPGA calculates and stores the price optimal buy / sell position table through the cache module, as shown in Table 2. At this time, the structure corresponding to the table can be constructed based on the data in the cache, so as to ensure that the update can be quickly realized when the order or the transaction is received in real time. In the case where the order price is outside the ten buy / sell prices, the board data does not need to be updated. In the case where the order price is within the ten buy / sell prices and is the same as one of the prices, only the buy / sell quantity corresponding to the price needs to be updated. In the case where the order price is within the ten buy / sell prices and is not recorded in the table, the price corresponding to the position is added, the original position not meeting the list requirement is removed, and the new list is reconstructed. In the case of order cancellation or complete transaction, the corresponding price of the position is deleted, the new position element is read from the DDR / HBM, and is inserted into the corresponding position of the ten buy / sell table, so as to reconstruct the new list. If the position elements (buy / sell fifteen positions) in the cache are more than the position elements (buy / sell ten positions) required by the order book, in the case of order cancellation or complete transaction, the corresponding price of the position is deleted, the position elements of the next position in the cache are sequentially promoted, until the position elements in the cache are less than a certain number or are in the idle state, then the new position element is read from the DDR / HBM, and is inserted into the corresponding position of the optimal buy / sell position table, so as to reconstruct the new list, which is used to generate the position information with higher real-time performance and accuracy.
[0127] For example, in the securities trading scenario, after the transaction market data of a stock is submitted to the FPGA, the FPGA constructs the market information through data decoding and reorganization, and then synchronously sends the market information to the DDR / HBM and the cache. In order to improve the purpose of quickly generating the order book at the user end in the centralized bidding and continuous bidding stages, the FPGA can maintain the price optimal buy / sell ten position table corresponding to the stock in the cache, which records the prices and quantities corresponding to buy 1 to buy 10 and the prices and quantities corresponding to sell 1 to sell 10. Meanwhile, the structure of the price optimal buy / sell ten position table is constructed, and the ten buy / sell information corresponding to the stock can be quickly generated according to the structure in the cache.
[0128] Further, if new order data is received, the buy / sell price and the transaction quantity corresponding to the order data need to be determined. If the buy / sell price is not within the price range corresponding to the list, the structure in the cache can not be updated at this time. If the buy / sell price is within the price range corresponding to the list and is the same as a price in the list, for example, the buy price is 10.02, which corresponds to the third buy price in the list, the transaction quantity can be added to the transaction quantity corresponding to the third buy price at this time, and the position information is updated in real time. If the buy price is within the price range corresponding to the list and is not the same as a price in the list, for example, the buy price is 10.00, which is not included in the list and the lowest buy price is 9.95, the buy price 10.00 and the corresponding transaction quantity can be inserted in the list at this time, and the price and quantity corresponding to 9.95 are deleted, and the position information is updated in real time.
[0129] Further, if new order data is received, the buy / sell price and the transaction quantity corresponding to the order data need to be determined. If the buy / sell price is not within the price range corresponding to the list, the structure in the cache can not be updated at this time. If the buy / sell price is within the price range corresponding to the list and is the same as a price in the list, for example, the buy price is 10.02, which corresponds to the third buy price in the list, the transaction quantity can be added to the transaction quantity corresponding to the third buy price at this time, and the position information is updated in real time. If the buy price is within the price range corresponding to the list and is not the same as a price in the list, for example, the buy price is 10.00, which is not included in the list and the lowest buy price is 9.95, the buy price 10.00 and the corresponding transaction quantity can be inserted in the list at this time, and the price and quantity corresponding to 9.95 are deleted, and the position information is updated in real time.
[0130] In summary, as Figure 2aAs shown in the schematic diagram, the FPGA-based order book data construction method provided in this embodiment, after the exchange / broker submits multi-source heterogeneous data to the FPGA, in order to improve the order book data construction speed and reduce the impact caused by slow data access, at this time, the multi-source heterogeneous data will be filtered first to eliminate the trading market data irrelevant to the final order book, and the trading market data will be obtained according to the filtering result. At this time, the trading market data can be decoded to obtain the per-transaction data, and then the per-transaction data is reorganized to obtain the market information corresponding to the per-transaction order; in order to support the subsequent rapid completion of the construction of order book data, the market information can be sent to the cache and DDR / HBM simultaneously, and since the cache has limited storage space, it can be detected whether the market information needs to be stored, so that the cache can maintain the data associated with a specific data structure; on this basis, the order book data can be quickly constructed based on the market information in the cache. In this way, the cache of the FPGA is used to accelerate the market data reading, and the support of the data reading operation of the DDR / HBM of the FPGA is realized, so as to improve the order book data construction speed while ensuring that the business can normally run, and in the trading scenario, the downstream business can respond to the dynamically changing trading market more conveniently.
[0131] In addition, considering that the target cache storage resource in the FPGA is limited, in order to better improve the utilization rate of hardware resources, after the data is reorganized, the market information can be divided into first market information and second market information, and the target cache only stores the first market information, while the second market information can be read and used when constructing the order book data. In this embodiment, the specific implementation is as follows:
[0132] In the case where the market information includes first market information and second market information, the first market information is sent to the target memory and the target cache simultaneously, and the first market information in the target cache is used to construct the position information; the position information is read from the target cache, and the position information and the second market information are spliced to construct the order book data.
[0133] Specifically, the first market information includes the price, quantity, starting storage address and maximum position number of the per-transaction order, and the second market information includes the channel, security code, time and other information of the per-transaction order. It can be understood that the information with lower update frequency or not requiring real-time update is the second market information, and the information with higher update frequency or requiring real-time update is the first market information. Correspondingly, the position information specifically refers to the information composed of one or more position elements, and it can be understood that the position information only maintains the price, position, quantity and other information of a stock, and the stock name does not belong to the position information.
[0134] Based on this, after the decoded transaction market data is reorganized according to the preset format, the first market information and the second market information will be obtained at this time, and in order to save the storage resources of the target cache, the first market information can be sent to the target memory and the target cache simultaneously. This process can be understood as that by reorganizing the decoded per-transaction data, one-to-one mapping of price and position can be completed according to the price and quantity of per-transaction order, and by the starting storage address of the first market information and the maximum number of positions, the allocation of the storage address of each stock in the target memory DDR / HBM can be completed, so as to be used as index information when subsequent data storage is performed. After the reorganized first market information is input to the target cache, it can be directly stored in the corresponding list without reconstruction, so that when it is used, it can be directly read and used. The second market information can include channel, security code, order time, transaction time, market category and other information, so the second market information does not need to enter the target memory and the target cache, and can be directly combined with the real-time position information in the target cache to obtain the order book data.
[0135] Further, since the position information is the information corresponding to different buy / sell positions of per-transaction data, and the second market information is the stock, time, channel and other information of the per-transaction data, after the position information is constructed according to the first market information in the target cache, the position information can be assembled with the second market information through a preset assembly protocol, so that the final order book data can be obtained according to the assembly result.
[0136] In specific implementation, considering that after the per-transaction data is reorganized, the first market information and the second market information will be obtained, the first market information will be sent to the target cache and the target memory simultaneously, and the second market information is a necessary element of the order book data, after the second market information order book is obtained, the second market information order book can be stored in a module for assembling position information and market information, such as the schematic diagram shown in Figure 2b After the position information is read from the cache, it can be directly assembled with the second market information stored in the assembly module, and then the order book data is obtained for subsequent sending to the user end.
[0137] In summary, by dividing the market information into the first market information and the second market information after data reorganization, and only sending the first market information to the target cache and the target memory simultaneously, the storage resources of the target cache can be effectively saved, and at the same time, the order book data construction speed will not be affected, which can ensure the trading needs of the user end.
[0138] In practical applications, there is a processing operation of issuing a piece of market information every 3s in the A-share market, which can be understood as summarizing the highest price, the lowest price, the trading volume, etc. in 3s into a piece of fast market information and sending it to the downstream system. In this example, the preprocessed transaction market data includes not only real-time piece-by-piece data but also 3s snapshot data. Therefore, there is a case that the 3s snapshot data is output to the user end faster than the order book data at a certain time. In order to build the order book data more quickly, the snapshot data and the order book data can be compared and optimized to select the faster data to synthesize the optimal order book data. The specific implementation is as follows:
[0139] According to the decoding result, the piece-by-piece data and the snapshot data are determined, and the piece-by-piece data is reorganized according to the preset format to obtain market information. The market information is sent to the target memory and the target cache. The order book data is constructed based on the market information in the target cache.
[0140] Specifically, the data sending stage refers to the stage of sending the order book data to the user end. Accordingly, the order book data and the snapshot data are compared, which can be understood as comparing the trading volume, trading price and / or trading number of the order book data and the snapshot data. The trading volume, trading price and / or trading number can represent which data is more matched with the real-time market. It can be understood that since the order information is incremental, the larger the trading volume, trading price and / or trading number of the order book data and the snapshot data recorded for the order, the closer it is to the real-time market.
[0141] Based on this, in combination with the sending logic of the snapshot data, when the piece-by-piece data and the snapshot data are obtained, the piece-by-piece data can continue to be reorganized and sent to the target cache. When the order book data corresponding to the current stage is constructed from the piece-by-piece data, there can be two cases. One is that the snapshot data is the latest snapshot data issued at the current time, and the snapshot data can be faster and more accurate than the order book data in sending real-time market information to the user end. The other is that the snapshot data is the snapshot data that has been issued for more than a certain time length and has not been updated, and the order book data can be faster and more accurate in sending real-time market information to the user end. Therefore, in the data sending stage, the order book data and the snapshot data can be compared to determine the optimal order book data according to the comparison result, which can be sent to the user end.
[0142] Referring to Figure 2cAs shown in the schematic diagram, after the tick-by-tick data and the snapshot data are decoded, the tick-by-tick data is reorganized inside the FPGA until the order book data is obtained, and the snapshot data can be directly sent to the user end. In order to send the optimal order book data to the user end, the order book data and the snapshot data corresponding to the current time can be compared after the order book data and the snapshot data corresponding to the current time are obtained, and the data determined as the optimal order book data according to the comparison result can be sent to the user end to display the latest and most accurate trading market information to the user end.
[0143] In addition, since the optimization processing of the order book data and the snapshot data occurs before the order book data is sent to the user end, the optimization processing process does not affect the reorganization of the tick-by-tick data inside the FPGA and the process of splitting the market information into first market information and second market information after reorganization for processing. That is, referring to Figure 2d As shown in the schematic diagram, after the tick-by-tick data and the snapshot data are decoded, the tick-by-tick data is reorganized to obtain first market information and second market information, the first market information is sent to the DDR / HBM and the cache at the same time, at this time, the gear information can be constructed based on the first market information in the cache, then the gear information and the second market information can be spliced to obtain the order book data, then the snapshot data and the order book data can be compared to determine the optimal order book data to be sent to the user end. The contents not described in detail can be referred to the same or corresponding description above, and the present embodiment will not be described in detail here.
[0144] Further, in order to improve the data processing speed of the whole process, multi-channel setting can be performed, and the preprocessing, decoding, reorganization, and gear information construction of each data are processed in parallel, and finally the multi-channel data is unified and summarized into order book data. The specific implementation manner is as follows:
[0145] The multi-source heterogeneous data is obtained, and the multi-source heterogeneous data is split into at least two complementary multi-source heterogeneous sub-data, each multi-source heterogeneous sub-data is taken as the multi-source heterogeneous data, and the preprocessing step for the multi-source heterogeneous data is performed to obtain the trading market data, until the order book data construction stage, the order book sub-data corresponding to each channel is determined, and the order book sub-data corresponding to each channel is merged to obtain the order book data.
[0146] Specifically, the at least two complementary multi-source heterogeneous sub-data specifically refers to multi-source heterogeneous data being split according to a set rule to obtain multi-source heterogeneous sub-data that does not affect each other and can be processed individually, for processing each corresponding multi-source heterogeneous sub-data through a different channel. Correspondingly, the order book sub-data is the order book data obtained after each multi-source heterogeneous data is processed through its corresponding channel, and the order book data is obtained by splicing each corresponding order book sub-data. The processing process of each order book sub-data can be referred to the description of the process of constructing order book data by FPGA, which is not limited in this embodiment.
[0147] Referring to Figure 2e As shown in the schematic diagram, after obtaining multi-source heterogeneous data, the multi-source heterogeneous data can be split into at least two complementary multi-source heterogeneous sub-data, and then each multi-source heterogeneous sub-data can be filtered, decoded, and reorganized. After obtaining the market information sub-data corresponding to its own channel, the market information sub-data can be sent to the cache and DDR / HBM corresponding to its own channel, so as to construct the order book sub-data corresponding to each channel based on the market information sub-data in the cache. After each channel constructs the order book sub-data, the order book data can be obtained by summarizing.
[0148] In addition, in order to speed up the efficiency of constructing order book sub-data of each channel and save the storage resources of cache in each channel, after the reorganization processing operation of each channel, the market information can be split into first market information sub-data and second market information sub-data. Referring to Figure 2f As shown in the schematic diagram, the first market information sub-data in any channel is sent to the DDR / HBM and cache at the same time. At this time, the gear information corresponding to the channel can be constructed based on the first market information sub-data in the cache. Then, the gear information and the second market information sub-data can be spliced to obtain the order book sub-data corresponding to the channel. Then, the order book data can be obtained by summarizing each corresponding order book sub-data, which is used for subsequent processing. After obtaining the order book data, the order book data can also be compared with the snapshot data to complete the optimization processing and realize sending the optimal order book data to the user end. The contents not described in detail can be referred to the same or corresponding description above, which will not be described in detail in this embodiment.
[0149] Further, in order to provide more accurate and real-time order book data to the user end, the related gear elements can also be compensated in the case of packet loss. In this embodiment, the specific implementation is as follows:
[0150] In a case where the target market information is in a packet loss state and the associated market information is received, an associated position element corresponding to the associated market information is determined in the structured data corresponding to the optimal buying and selling position table; in a case where the structured data satisfies the data update condition according to the associated market information and the associated position element, the associated position element is deleted and / or adjusted in the structured data, and the order book data is constructed according to the deletion and / or adjustment result.
[0151] Specifically, the associated market information specifically refers to the market information received after the target market information, the associated position element specifically refers to the position element corresponding to the associated market information, and the data update condition specifically refers to the condition that the associated position element has abnormal data due to packet loss. At this time, the associated position element needs to be deleted and / or adjusted to realize packet loss compensation, so that the order book data can still quickly display accurate market information.
[0152] Based on this, when the packet loss problem occurs in the order book data synthesis process, the price and quantity of the optimal buying and selling position table will be inaccurate, but continuous bidding needs to be quickly completed. When several orders are lost, the order book position information after packet loss can be calculated on the basis of cache packet loss, and the subsequent buy one and sell one position is refreshed and compensated. However, there is a situation that the quantity of a certain position after calculation and synthesis is negative or the order is completed by skipping. When the quantity is negative or the order is completed by skipping, in order to avoid affecting the rapid construction of the order book data, the associated position element can be deleted and / or adjusted from the structured data, and the order book data is constructed according to the deletion and / or adjustment result.
[0153] For example, part of the order book data corresponding to the current time is shown in Table 3 as follows:
[0154] Table 3: Normal order book position element
[0155]
[0156] If the order corresponding to the newly received market information is a cancellation (10700), a new order (9600), an order completion (11300), and a completion (9900). The order book data generated without packet loss is shown in Table 4 as follows:
[0157] Table 4: Order book position element without packet loss
[0158]
[0159] On this basis, if the cancellation (10700) and the new order (9600) are lost, and the subsequent order completion (11300) and completion (9900) are lost, the order book data generated after packet loss is shown in Table 5 as follows:
[0160] Table 5: Order Book Item Elements of Packet Loss
[0161]
[0162] Therefore, when it is found that the sell order at level 2 (11 300) was successfully executed, according to market trading logic, it means that a sell order at level 1 was canceled or executed, but the data may have been lost. To ensure the accuracy of the order book data, it is necessary to delete and / or adjust the related level elements, that is, delete the original sell order at level 1 (10 700), and adjust the latest transaction (11500) - (11300) = (11200) to the new sell order at level 1, and then adjust the level elements after the new sell order at level 1 in turn. In addition, when it is found that the quantity of buy order at level 1 (9-300) becomes negative, it means that a new order at level 1 was lost. At this time, it is necessary to delete the level 1, adjust the original buy order at level 2 (8400) to the new buy order at level 1, and then adjust the level elements after the new buy order at level 1 in turn. The order book data after the data loss compensation is shown in Table 6 below.
[0163] Table 6: Order Book File Elements After Packet Loss Compensation
[0164]
[0165] It should be noted that although the compensated buy price (8400) after packet loss differs from the actual buy price (9300) in the order book without packet loss, the continuous bidding phase aims for a transaction. When the actual transaction price reaches buy price (8400), the corresponding price level will automatically refresh to maintain the latest data, thus ensuring the accuracy of the order book data. In other words, through the above packet loss compensation steps, it is possible to ensure that even if a packet is lost at a certain point in time, the correct price level can be quickly compensated by continuously and dynamically updating the sell and buy prices, thus improving the accuracy and real-time performance of the order book data.
[0166] See Figure 3 , Figure 3 A flowchart is shown of a second FPGA-based order book data construction method according to an embodiment of this specification, which is applied to a programmable logic component and specifically includes the following steps.
[0167] Step S302: Obtain transaction market data and decode the transaction market data.
[0168] This embodiment describes a second FPGA-based order book data construction method. Any content not described in detail can be found in the same or corresponding descriptions in the above embodiments. This embodiment will not elaborate further here.
[0169] Further, considering that the data obtained in the transaction scenario can come from different nodes, the obtained data can be preprocessed, and then decoded according to the set protocol. In the embodiment, the specific implementation manner is as follows:
[0170] The multi-source heterogeneous data is acquired, preprocessed, and transaction market data is obtained. The transaction market data is decoded according to a binary protocol or an information exchange protocol, and the transaction market data is decoded according to a binary protocol or an information exchange protocol. On this basis, the decoded transaction market data is reorganized according to a preset format to obtain first market information and second market information, including: reorganizing the transaction data according to the preset format to obtain the first market information and the second market information.
[0171] Specifically, the multi-source heterogeneous data specifically refers to the data issued by multiple market sources when inputting a programmable logic component, including multiple types of data, and therefore needs to be preprocessed. The preprocessing refers to filtering the multi-source heterogeneous data, removing non-transaction market data, and deleting transaction market data irrelevant to the final order book, such as constructing a securities order book, and deleting bond market data in advance. Correspondingly, the binary protocol and the information exchange protocol specifically refer to the business coding format protocol of the exchange, the binary protocol is Binary Protocol, and the information exchange protocol is FAST protocol (Financial Information eXchange).
[0172] In specific implementation, the transaction market data is decoded according to the business coding format of the exchange, and the transaction market data is decoded according to the business coding format of the exchange. The decoding module in the FPGA can complete the decoding, and the decoding module itself does not cache data, and can realize full-speed passing of data. The decoded transaction data can be used for reorganization, thereby improving the data processing efficiency.
[0173] Step S304, the decoded transaction market data is reorganized according to a preset format to obtain first market information and second market information.
[0174] Specifically, the preset format specifically refers to the format used for reorganizing the transaction market data. The first market information includes the price, quantity, starting storage address and maximum gear number of the transaction order, and the second market information includes the channel, security code, time and other information of the transaction order.
[0175] By reorganizing the decoded per-pen data, one-to-one mapping of price and level can be completed according to the price and quantity of the per-pen order. Through the starting storage address of the first market information and the maximum number of levels, the storage address of each stock in the target memory DDR / HBM can be allocated, so as to be used as index information when subsequent data storage is performed. After the reorganized first market information is input into the target cache, it can be directly stored in the corresponding list without reconstruction, so that it can be directly read and used when used.
[0176] The second market information can include channel, security code, order time, transaction time, market category and the like. The second market information does not need to enter the target memory and the target cache, and can be directly combined with the real-time level information in the target cache to obtain the order book data.
[0177] In actual application, the data reorganization processing of transaction market data can be realized by a reorganization module in a programmable logic component. The reorganization module can reorganize the field data output by the decoding module into a structure according to the output format to obtain the first market information and the second market information.
[0178] In step S306, the first market information is synchronously sent to the target memory and the target cache, and the level information is constructed based on the first market information in the target cache.
[0179] Specifically, the target memory is DDR / HBM in the programmable logic component, and the target cache is cache in the programmable logic component. The reading time of the target cache is much less than that of the target memory (the reading speed of cache only needs a few nanoseconds, and the reading of DDR / HBM needs a few hundred nanoseconds).
[0180] Further, in order to improve the order book construction speed by cooperation of the cache and the memory in the FPGA hardware, the first market information can be synchronously sent to the target cache and the target memory. However, the target cache has limited storage space, and therefore whether the first market information is stored in the target cache in real time needs to be detected.
[0181] The first market information is detected whether it meets the storage condition of the target cache. If yes, the first market information is synchronously stored in the target cache and the target memory. If no, the first market information is stored in the target memory.
[0182] Specifically, the storage condition specifically refers to detecting whether the first market information belongs to information within the target cache maintenance data range. Based on this, after obtaining the first market information, the first market information can be sent to the target cache and the target memory at the same time. However, due to the limited storage space of the target cache, it is impossible to maintain the full amount of data. Therefore, before the first market information is written into the target cache, it is necessary to detect whether it meets the storage condition of the target cache. If yes, it means that the first market information belongs to the information within the target cache maintenance data range, and the first market information can be stored in the target cache and the target memory at the same time, so as to support the downstream to directly read the data from the target cache to quickly complete the read operation. If no, it means that the target cache does not need to store the first market information, so the first market information can only be stored in the target memory, and when the target cache needs the data, it can be read from the target memory.
[0183] That is, the cache and DDR / HBM of the FPGA hardware will synchronously receive the first market information. When writing, the first market information can be directly written into the DDR / HBM, and when writing into the cache, it is necessary to judge whether the price and quantity in the first market information are within the range of the optimal buy / sell position table maintained by the cache. If yes, it can be written, otherwise it needs to be discarded. Subsequent order book data construction can preferentially read data from the cache, and when the optimal buy / sell position table maintained by the cache is insufficient, corresponding data can be read from the DDR / HBM to complete the construction, so as to ensure that the cache always maintains a complete optimal buy / sell position table. By fully utilizing the logical resources of the cache and DDR / HBM in the FPGA, the entire construction process is realized by pure hardware, which can accelerate the construction of the order book, avoid the low-speed problem in pure software implementation, and avoid the frequent interaction between hardware and software in the combination of software and hardware implementation.
[0184] Further, after storing the first market information into the target cache, in order to support subsequent rapid reading of data from the cache to construct the order book, the optimal buy / sell position table can be constructed. In this embodiment, the specific implementation is as follows:
[0185] In the case that the first market information is successfully stored in the target cache, the data stored in the target cache is analyzed, and an optimal buy / sell position table is constructed according to the analysis result. The position information is obtained based on the optimal buy / sell position table, wherein the number of position elements of the optimal buy / sell position table is more than or equal to the number of position elements of the position information.
[0186] Specifically, the optimal bid-ask table refers to a table structure of selecting a certain number of levels, for example, in the securities trading scenario, an optimal bid-ask ten-level table needs to be constructed, and 20 data with optimal bid-ask prices can be selected for construction, as shown in Table 2 above, which can be set according to actual needs, and the present embodiment does not make any limitation. In the optimal bid-ask ten-level table, the higher the buy price, the higher the priority of the corresponding data, and the lower the sell price, the higher the priority of the corresponding data. The level information includes a plurality of level elements, and the level element includes a level, a quantity, and a price, such as buy 1-1000-10.04 in Table 2.
[0187] Based on this, in the case that the first market information is successfully stored in the target cache, in order to quickly complete the construction of the order book data through the level information stored in the target cache, the data stored in the target cache can be analyzed, and an optimal bid-ask table is constructed according to the analysis result, so as to realize maintaining the optimal bid-ask table through the target cache, and support that when the order book data needs to be constructed, the structured data of the optimal bid-ask table in the target cache can be directly read as level information for subsequent order book data construction, thereby improving the order book data construction speed.
[0188] In addition, in the actual processing process, the optimal bid-ask table may be missing due to order cancellation or complete execution, and therefore more level elements than the level information can be maintained in the optimal bid-ask table. For example: the order book data finally constructed based on the level information can include 20 level elements in the optimal bid-ask ten-level table, but the optimal bid-ask table in the target cache can maintain an optimal bid-ask fifteen-level table (30 level elements). In this way, when the level of the optimal bid-ask table in the target cache is missing, it can be quickly filled, and there is no need to read the level element of the next level from the target memory, and the construction of the order book data can be faster.
[0189] Further, when new market information is received in real time, the data in the cache needs to be updated dynamically, so that the order book data constructed subsequently is more accurate and meets the current trading needs. In the present embodiment, the specific implementation is as follows:
[0190] Receiving target market information and determining order price information and quantity information corresponding to the target market information;
[0191] In the case that the order price information is associated with the optimal bid-ask table and belongs to a non-increased price, updating the structured data corresponding to the optimal bid-ask table according to the quantity information;
[0192] In the case that the order price information is associated with the optimal bid-ask table and belongs to a newly added price, a to-be-updated position element is determined according to the order price information and the quantity information, and the structured data corresponding to the optimal bid-ask table is updated based on the to-be-updated position element;
[0193] In the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to a cancellation or complete transaction, a candidate position element is read from the target memory and stored in the target cache, and the structured data corresponding to the optimal bid-ask table is updated based on the candidate position element;
[0194] In the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to a cancellation or complete transaction, and the number of position elements of the optimal bid-ask table is greater than the number of position elements of the position information, a to-be-updated position element is determined according to the order price information and the quantity information, and the structured data corresponding to the optimal bid-ask table is updated based on the to-be-updated position element; in an idle state or when the number of position elements of the optimal bid-ask table is less than a set threshold, a candidate position element is read from the target memory and stored in the target cache, and the structured data corresponding to the optimal bid-ask table is updated based on the candidate position element;
[0195] The updated structured data is taken as the position information.
[0196] Specifically, the target market information specifically refers to the received new market information; the order price information specifically refers to the order price or the transaction price recorded in the target market information, and the quantity information specifically refers to the order quantity of the buy order or the sell order. Correspondingly, the structured data specifically refers to the data structure corresponding to the optimal bid-ask table.
[0197] Correspondingly, in the case that the order price information is associated with the optimal bid-ask table and is of a newly added type, the order price information is not in the original optimal bid-ask table, but belongs to the price information that needs to be maintained in the optimal bid-ask table. The to-be-updated position element refers to the position element that needs to be inserted and / or deleted in the current optimal bid-ask table, and the position element includes position, price and quantity.
[0198] Correspondingly, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to a cancellation or complete transaction, the order / deal (buy or sell) of a certain position is changed to 0, and the corresponding position element in the optimal bid-ask table needs to be deleted, but in order to ensure the integrity of the position quantity, the position element needs to be supplemented. The supplemented position element is the candidate position element, and the candidate position element is read from the target memory.
[0199] Correspondingly, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the case of canceling or complete transaction, and the number of the elements of the optimal bid-ask table is more than the number of the elements of the order information, specifically, the number of the elements of the optimal bid-ask table is more than the number of the elements of the order information due to the canceling or complete transaction, the corresponding element of the optimal bid-ask table needs to be deleted because the order / deal (buy or sell) of a certain element is 0, and the element of the next element of the optimal bid-ask table can be directly used to fill in the gap. The to-be-updated element refers to the element that needs to be adjusted and / or deleted in the current optimal bid-ask table, and the element includes the element, price and quantity. The idle state refers to the case that no new market information is received, or the new market information is not the market information of the stock, and other cases that do not affect the current processing speed of the target memory and the target cache. In the idle state, or when the number of the elements of the optimal bid-ask table is less than the set threshold, a certain number of candidate elements can be read from the target memory and stored in the target cache.
[0200] Based on this, considering that the displayed order book at this time is based on the element information in the target cache, and the new market information will cause the order book to change, it is necessary to determine the order price information and the quantity information corresponding to the target market information, and then determine how to update the corresponding element information after the current transaction operation.
[0201] In the first aspect, in the case that the order price information is associated with the optimal bid-ask table and belongs to the case of non-new price, it is indicated that the order price associated with the target market information is located in the price range included in the optimal bid-ask table, and the price of one of the elements is the same, but the transaction quantity has changed, such as the original sell quantity of A price in the list is 10000, and the new market information adds a new order for the transaction, and the quantity is 1000, so the original quantity needs to be updated.
[0202] In the second aspect, in the case that the order price information is associated with the optimal bid-ask table and the order price information is a new type, the order price corresponding to the target market information is located between the first element and the last element of the optimal bid-ask table, and is not equal to the price recorded in the table, so the optimal bid-ask table needs to be reconstructed. The to-be-updated element that needs to be inserted and the element that needs to be deleted can be determined according to the target market information, and then the structured data corresponding to the optimal bid-ask table can be updated according to the to-be-updated element, which can be understood as inserting a new element and deleting an old element that exceeds the set element requirement from the table, such as deleting the element with the lowest buy price or the element with the highest sell price, so that the updated structured data can be constructed as element information.
[0203] In the third aspect, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the cancel order or the complete transaction, it is explained that the order / transaction (buy or sell) of a certain position is canceled to 0 at this time, and the corresponding position element in the optimal bid-ask table needs to be deleted, but in order to ensure the integrity of the position quantity, the position element needs to be completed. In this embodiment, because the target memory stores the full quantity of market information, the target cache can directly read the required candidate position information from the memory and insert the candidate position information into the corresponding position of the optimal bid-ask table, so as to maintain the complete optimal bid-ask table.
[0204] In the fourth aspect, in the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to the cancel order or the complete transaction, when the position elements of the optimal bid-ask table are more than the position elements of the order price information, the next position element of the optimal bid-ask table can be directly used to fill in. In the idle state, or when the position elements of the optimal bid-ask table are less than a set threshold, a certain number of candidate position elements are read from the target memory and stored in the target cache. For example, the order price information needs 20 position elements of the optimal ten positions, and the optimal bid-ask table contains 30 position elements of the optimal fifteen positions. When the third position of the sell order in the optimal bid-ask table is canceled to 0, the fourth position of the sell order can be directly updated to the third position, and the subsequent position elements are updated in turn, without the need to read the position elements of the eleventh position from the target memory. Until the optimal fifteen positions are less than the set threshold, such as only the optimal ten positions, the position elements of the optimal bid-ask eleven to fifteen positions can be read from the target memory as candidate position elements, stored in the target cache, and the optimal bid-ask table is updated. Of course, in the idle state, such as no new order, or the new order is for other stocks, a certain number of candidate position elements are read from the target memory and stored in the target cache.
[0205] In specific implementation, after the FPGA synchronously sends the first market information to the cache module, the FPGA calculates and stores a price-optimal buying and selling position table through the cache module, as shown in Table 2. At this time, the structure corresponding to the table can be constructed based on the data in the cache, to ensure that when a commission or a transaction is received in real time, the update can be implemented quickly. In the case where the order price of the commission or the transaction is outside the ten buying and selling prices, the board data does not need to be updated. In the case where the order price is within the ten buying and selling prices and is the same as one of the prices, only the buying and selling quantity corresponding to the price needs to be updated at this time. In the case where the order price is within the ten buying and selling prices and is not recorded in the table, the price corresponding to the position needs to be added, and the position that does not meet the requirements of the list is removed, and a new list is reconstructed. When the order is canceled or completely transacted, the corresponding price of the position is deleted, and the new position element is read from the DDR / HBM and inserted into the corresponding position of the ten buying and selling table, and a new list is reconstructed. If the position element (buying and selling fifteen positions) in the cache is more than the position element (buying and selling ten positions) required by the position information, when the order is canceled or completely transacted, the corresponding price of the position is deleted, and the position element of the next position in the cache is promoted in turn until the position element in the cache is less than a certain number or is in an idle state, and then the new position element is read from the DDR / HBM and inserted into the corresponding position of the optimal buying and selling position table, and a new list is reconstructed, which is used to generate the position information with higher real-time performance and accuracy.
[0206] For example, in a securities trading scenario, after the transaction market data of a stock is submitted to the FPGA, the first market information and the second market information are constructed through data decoding and reorganization, and then the first market information is synchronously sent to the DDR / HBM and the cache. On this basis, in order to improve the purpose of quickly generating the order book at the user end in the centralized bidding and continuous bidding stages, the price-optimal buying and selling ten-position table corresponding to the stock can be maintained in the cache, which records the prices and quantities corresponding to buying 1 to buying 10 and the prices and quantities corresponding to selling 1 to selling 10, and the structure of the price-optimal buying and selling ten-position table is constructed, and the ten buying and selling information corresponding to the stock can be quickly generated according to the structure in the cache.
[0207] Further, if new order data is received, the buy / sell price and the transaction quantity corresponding to the order data need to be determined. If the buy / sell price is not within the price range corresponding to the list, the structure in the cache can not be updated at this time. If the buy / sell price is within the price range corresponding to the list and is the same as a price in the list, for example, the buy price is 10.02, which corresponds to the third buy price in the list, the transaction quantity can be added to the transaction quantity corresponding to the third buy price at this time, and the position information is updated in real time. If the buy price is within the price range corresponding to the list and is not the same as a price in the list, for example, the buy price is 10.00, which is not included in the list and the lowest buy price is 9.95, the buy price 10.00 and the corresponding transaction quantity can be inserted in the list at this time, and the price and quantity corresponding to 9.95 are deleted, and the position information is updated in real time.
[0208] Further, if new order data is received, the buy / sell price and the transaction quantity corresponding to the order data need to be determined. If the buy / sell price is not within the price range corresponding to the list, the structure in the cache can not be updated at this time. If the buy / sell price is within the price range corresponding to the list and is the same as a price in the list, for example, the buy price is 10.02, which corresponds to the third buy price in the list, the transaction quantity can be added to the transaction quantity corresponding to the third buy price at this time, and the position information is updated in real time. If the buy price is within the price range corresponding to the list and is not the same as a price in the list, for example, the buy price is 10.00, which is not included in the list and the lowest buy price is 9.95, the buy price 10.00 and the corresponding transaction quantity can be inserted in the list at this time, and the price and quantity corresponding to 9.95 are deleted, and the position information is updated in real time.
[0209] In addition, in addition to the detection processing before writing data to the target cache as described above, data detection processing can be performed after the first market information is synchronously sent to the target cache and the target memory, and both complete the write operation. It can be understood that the per-transaction data obtained at the current time is selected to be stored in the target cache and the target memory after the first market information is constructed. Since the target cache only maintains the optimal buy / sell position table (such as the optimal buy / sell ten table), if this part of the data belongs to the optimal buy / sell ten table, it can be stored in the target cache and updated with the structured data of the optimal buy / sell ten table. Similarly, the structured data in the target memory will also be updated. When this part of the data does not belong to the optimal buy / sell ten table, storing it in the target cache does not affect the structure and content of the table, so this part of the data can be released from the target cache after being synchronously stored in the target cache and the target memory, that is, deleting this part of the data from the target cache, to avoid consuming storage resources. The target memory as a full storage strategy will not be released, so this part of the data can be stored and the structured data can be updated.
[0210] In specific implementation, for the first market information written to the target cache and the target memory, it can be selected to judge whether the first market information needs to be written to the target cache before writing, or it can be selected to judge whether the data needs to be released after writing, so that the data not belonging to the target cache can be selectively discarded, thereby improving the resource utilization rate and avoiding the waste of cache storage resources.
[0211] Step S308, reading the position information from the target cache, and assembling the position information and the second market information to construct order book data.
[0212] Specifically, the position information is information corresponding to different buy / sell positions of per-transaction data, and the second market information is stock, time, channel, etc. information of the per-transaction data. Through a preset assembly protocol, the position information and the second market information can be assembled to obtain the final order book data, such as Table 1. The order book data can be pushed to users and institutions for order book display, transaction decision, etc.
[0213] In specific implementation, considering that per-transaction data will obtain first market information and second market information after reorganization, and the first market information is synchronously sent to the target cache and the target memory, and the second market information is a necessary element of order book data, after obtaining the second order book data, the second order book data can be stored in a module that assembles position information and market information, such as Figure 2bAs shown in the schematic diagram, the second market information can be stored to the assembling module, and after the gear information is read from the cache, the second market information stored in the assembling module can be directly assembled, and then the order book data is obtained for subsequent sending to the user end.
[0214] In summary, by dividing the market information into first market information and second market information after data reorganization, and only synchronously sending the first market information to the target cache and the target memory, the storage resources of the target cache can be effectively saved, and the order book data construction speed will not be affected, which can ensure the transaction demand of the user end.
[0215] In practical application, there is a processing operation of A-share market every 3s to send a piece of market information, which can be understood as summarizing the highest price, the lowest price, the trading volume, etc. in 3s into a piece of fast cooking market information and sending it to the downstream system. In this example, the preprocessed transaction market data includes not only real-time piece-by-piece data, but also 3s snapshot data, so there is a case that the 3s snapshot data will be output to the user end faster than the order book data at a certain moment. In order to build the order book data more quickly, the snapshot data and the order book data can be compared and optimized to select the faster data to synthesize the optimal order book data. The specific implementation mode is as follows:
[0216] According to the decoding result, the piece-by-piece data and the snapshot data are determined, and the data reorganization of the piece-by-piece data according to the preset format is performed to obtain the first market information and the second market information. The first market information is synchronously sent to the target memory and the target cache, and the gear information is constructed based on the first market information in the target cache. The gear information is read from the target cache, and the gear information and the second market information are assembled to construct the order book data. In the data sending stage, the order book data and the snapshot data are compared, and the optimal order book data is determined according to the comparison result.
[0217] Specifically, the data sending stage specifically refers to the stage of sending the order book data to the user end. Correspondingly, comparing the order book data and the snapshot data can be understood as comparing the trading volume, the trading price and / or the trading number contained in the order book data and the snapshot data. The trading volume, the trading price and / or the trading number can represent which data is more matched with the real-time market. It can be understood that since the order information is incremental, the larger the trading volume, the trading price and / or the trading number of the order recorded by the order book data and the snapshot data, the closer it is to the real-time market.
[0218] Based on this, combined with the sending logic of snapshot data, when the tick-by-tick data and snapshot data are obtained, the subsequent reorganization and synchronization sending to the target cache can be continued for the tick-by-tick data. When the order book data corresponding to the current stage in real time is constructed from the tick-by-tick data, there can be two cases. One is that the snapshot data is the latest snapshot data issued at the current time, and at this time, the snapshot data can exist faster and more accurate real-time market situation sending to the user end than the order book data. The other is that the snapshot data is the snapshot data that has not been updated for more than a set time length at the current time, and at this time, the order book data can exist faster and more accurate real-time market situation sending to the user end. Therefore, in the data sending stage, the order book data and the snapshot data can be compared, so that the optimal order book data can be determined according to the comparison result, and then sent to the user end.
[0219] Referring to Figure 2d The schematic diagram shows that after decoding the tick-by-tick data and the snapshot data, the tick-by-tick data will be reorganized to obtain the first market information and the second market information. The first market information will be sent to the DDR / HBM and the cache at the same time. At this time, the gear information can be constructed based on the first market information in the cache. Then the gear information and the second market information can be spliced to obtain the order book data. Then the snapshot data and the order book data can be compared to determine the optimal order book data to send to the user end. The contents not described in detail can be referred to the same or corresponding description above, and the embodiment will not be described in detail here.
[0220] Further, in order to improve the data processing speed of the whole process, multi-channel setting can be performed, and the preprocessing, decoding, reorganization, and gear information construction of each data can be processed in parallel. Finally, the multi-channel data is unified and summarized into order book data. The specific implementation mode is as follows:
[0221] The multi-source heterogeneous data is obtained, and the multi-source heterogeneous data is split into at least two complementary multi-source heterogeneous sub-data. Each multi-source heterogeneous sub-data is taken as the multi-source heterogeneous data, and the preprocessing for the multi-source heterogeneous data is performed to obtain the transaction market data. Until the order book data construction stage, the order book sub-data corresponding to each channel is determined, and the order book sub-data corresponding to each channel is merged to obtain the order book data.
[0222] Specifically, the at least two complementary multi-source heterogeneous sub-data specifically refers to multi-source heterogeneous data split according to a set rule, obtaining multi-source heterogeneous sub-data that does not affect each other and can be processed individually, for processing each corresponding multi-source heterogeneous sub-data through different channels. Correspondingly, the order book sub-data is the order book data obtained after each corresponding multi-source heterogeneous data is processed through its corresponding channel. The order book data is obtained by splicing each corresponding order book sub-data. The processing process of each order book sub-data can be referred to the above description of the process of constructing order book data by FPGA, which is not limited in this embodiment.
[0223] Referring to Figure 2f The first market sub-information in any one of the channels is synchronously sent to the DDR / HBM and the cache. At this time, the gear information corresponding to the channel can be constructed based on the first market sub-information in the cache. Then, the gear information and the second market sub-information can be spliced to obtain the order book sub-data corresponding to the channel. Then, the order book sub-data corresponding to each channel can be summarized to obtain the order book data for subsequent processing. After obtaining the order book data, the order book data can be compared with the snapshot data to complete the optimization processing and realize the sending of the optimal order book data to the user end. The contents not described in detail can be referred to the same or corresponding description above, which will not be described in detail in this embodiment.
[0224] Further, in order to provide more accurate and real-time order book data to the user end, the related gear elements can also be deleted in the case of packet loss event. In this embodiment, the specific implementation is as follows:
[0225] In the case that the target market information is in a packet loss state and the associated market information is received, the associated gear element corresponding to the associated market information is determined in the structured data corresponding to the optimal buy / sell gear table. In the case that the structured data satisfies the data update condition according to the associated market information and the associated gear element, the associated gear element is deleted and / or adjusted in the structured data, and the gear information is constructed according to the deletion and / or adjustment result.
[0226] Specifically, the associated market information specifically refers to the market information submitted after the target market information, and the associated gear element specifically refers to the gear element corresponding to the associated market information. The data update condition specifically refers to the condition that the associated gear element has abnormal data due to packet loss. At this time, the associated gear element needs to be deleted and / or adjusted to realize packet loss compensation, so that the order book data can still quickly display accurate market information.
[0227] Based on this, when the packet loss problem occurs in the price information synthesis process, the price and quantity of the optimal buy and sell price table will be inaccurate at this time, but since continuous bidding needs to be quickly completed. When several price levels are lost, the order book price information after packet loss can be calculated based on the cache, and the subsequent buy one and sell one price levels are refreshed to compensate. However, there are cases where the quantity of a certain price level after calculation and synthesis is negative or the transaction is skipped. When the quantity is negative or the transaction is skipped, in order to avoid affecting the rapid construction of order book data, the associated price level elements can be deleted and / or adjusted from the structured data, and the price level information can be constructed based on the deletion and / or adjustment results.
[0228] Referring to Figure 4 , Figure 4 A flowchart of a third FPGA-based order book data construction method according to an embodiment of the present specification is shown, which is applied to a programmable logic component and specifically includes the following steps.
[0229] Step S402, acquiring transaction market data and decoding the transaction market data to obtain per-transaction data and snapshot data.
[0230] Step S404, data reorganization of the per-transaction data according to a preset format to obtain market information.
[0231] Step S406, synchronously sending the market information to a target memory and a target cache, and constructing order book data based on the market information in the target cache.
[0232] Step S408, comparing the order book data and the snapshot data, and determining the optimal order book data according to the comparison result.
[0233] In an optional embodiment, the step of synchronously sending the market information to a target memory and a target cache, and constructing order book data based on the market information in the target cache includes:
[0234] In the case where the market information includes first market information and second market information, the first market information is synchronously sent to the target memory and the target cache, and the first market information in the target cache is used to construct price level information; the price level information is read from the target cache, and the price level information and the second market information are spliced to construct order book data.
[0235] In an optional embodiment, the step of acquiring transaction market data and decoding the transaction market data to obtain per-transaction data and snapshot data includes:
[0236] Obtaining multi-source heterogeneous data, and preprocessing the multi-source heterogeneous data to obtain transaction market data; decoding the transaction market data according to a binary protocol or an information exchange protocol to obtain per-transaction data and snapshot data.
[0237] In an optional embodiment, the obtaining multi-source heterogeneous data, and preprocessing the multi-source heterogeneous data to obtain transaction market data comprises:
[0238] Obtaining multi-source heterogeneous data, and splitting the multi-source heterogeneous data into at least two routes of complementary multi-source heterogeneous sub-data, taking each route of multi-source heterogeneous sub-data as the multi-source heterogeneous data, and performing the step of preprocessing the multi-source heterogeneous data to obtain transaction market data; until the order book data construction stage, determining each route of corresponding order book sub-data, and merging each route of corresponding order book sub-data to obtain order book data.
[0239] The third FPGA-based order book data construction method provided in this embodiment is described, and details not described in this embodiment can be referred to the same or corresponding description in the above embodiments, which will not be described in this embodiment.
[0240] Referring to Figure 5 , Figure 5 A flowchart of a fourth FPGA-based order book data construction method provided according to an embodiment of the present specification is shown, which is applied to a programmable logic component, and specifically includes the following steps.
[0241] Step S502, obtaining multi-source heterogeneous data, and splitting the multi-source heterogeneous data into at least two routes of complementary multi-source heterogeneous sub-data.
[0242] Step S504, processing each route of corresponding multi-source heterogeneous sub-data to obtain each route of corresponding market sub-information.
[0243] Step S506, sending each route of corresponding market sub-information to a corresponding target memory and target cache, and constructing each route of corresponding order book sub-data based on the market sub-information in the target cache.
[0244] Step S508, merging each route of corresponding order book sub-data to obtain order book data.
[0245] In an optional embodiment, the processing of the first multi-source heterogeneous sub-data of any one of the at least two routes of complementary multi-source heterogeneous sub-data comprises:
[0246] The first multi-source heterogeneous sub-data is processed to obtain transaction market information sub-data; the transaction market information sub-data is decoded according to a binary protocol or an information exchange protocol to obtain sub-data of each transaction; and the sub-data of each transaction is reorganized according to a preset format to obtain market information sub-data.
[0247] In an optional embodiment, the construction of the order book sub-data corresponding to the second multi-source heterogeneous sub-data of any one of the at least two complementary multi-source heterogeneous sub-data includes:
[0248] In a case where the market information sub-data corresponding to the second multi-source heterogeneous sub-data includes first market information sub-data and second market information sub-data, the first market information sub-data is synchronously sent to the target memory and the target cache, and gear sub-information is constructed based on the first market information sub-data in the target cache; the gear sub-information is read from the target cache, and the gear sub-information and the second market information sub-data are spliced to construct order book sub-data.
[0249] In an optional embodiment, the method further includes:
[0250] According to the decoding result, sub-data of each transaction and snapshot sub-data are determined, and the following steps are performed: the sub-data of each transaction is reorganized according to a preset format to obtain market information, the market information corresponding to each channel is sent to a corresponding target memory and target cache, order book sub-data corresponding to each channel is constructed based on the market information in the target cache, and the order book sub-data corresponding to each channel is merged to obtain order book data; in a data sending stage, the snapshot sub-data corresponding to each channel is merged to obtain snapshot data; the order book data and the snapshot data are compared, and optimal order book data is determined according to a comparison result.
[0251] The fourth FPGA-based order book data construction method provided in this embodiment is described, and details not described in this embodiment can be referred to the same or corresponding descriptions in the above embodiments, which will not be described in this embodiment.
[0252] Referring to Figure 6 , Figure 6 A flowchart of a fifth FPGA-based order book data construction method provided according to an embodiment of the present specification is shown, which is applied to a programmable logic component and specifically includes the following steps.
[0253] In step S602, transaction market data is obtained, and the transaction market data is decoded.
[0254] In step S604, the decoded transaction market data is reorganized according to a preset format to obtain market information.
[0255] Step S606, the market information is synchronously sent to the target memory and the target cache, an optimal buying and selling position table is constructed based on the market information in the target cache, and order book data is constructed according to the optimal buying and selling position table.
[0256] Step S608, in a case where the structured data corresponding to the optimal buying and selling position table satisfies a data update condition, associated position elements in the structured data are deleted and / or adjusted, and target order book data is constructed according to a deletion and / or adjustment result.
[0257] The fifth FPGA-based order book data construction method provided in the embodiment is described, and details not described in the embodiment can be referred to the same or corresponding description in the above-described embodiments, which will not be described in the embodiment.
[0258] Corresponding to the above method embodiments, the specification also provides a first FPGA-based order book data construction system embodiment, Figure 7 A structural schematic diagram of the first FPGA-based order book data construction system provided by an embodiment of the specification is shown. As shown in Figure 7 The FPGA-based order book data construction system 700 includes a server 710 and a terminal 720, wherein the server 710 is configured with a programmable logic component, including:
[0259] The server 710 is configured to obtain transaction market data through the programmable logic component, and decode the transaction market data; reorganize the decoded transaction market data according to a preset format to obtain market information; synchronously send the market information to a target memory and a target cache, and construct order book data based on the market information in the target cache; and send the order book data to the terminal;
[0260] The terminal 720 is configured to render a transaction market list in a transaction page and display based on the order book data; or execute a transaction strategy based on the order book data.
[0261] Corresponding to the above method embodiments, the specification also provides a second FPGA-based order book data construction system embodiment, Figure 8 A structural schematic diagram of the second FPGA-based order book data construction system provided by an embodiment of the specification is shown. As shown in Figure 8 The FPGA-based order book data construction system 800 includes a server 810 and a terminal 820, wherein the server 810 is configured with a programmable logic component, including:
[0262] The server 810 is configured to acquire transaction market data through the programmable logic component, decode the transaction market data, reorganize the decoded transaction market data according to a preset format to obtain first market information and second market information, synchronously send the first market information to a target memory and a target cache, construct gear information based on the first market information in the target cache, read the gear information from the target cache, splice the gear information and the second market information to construct order book data, and send the order book data to the terminal.
[0263] The terminal 820 is configured to render and display a transaction market list in a transaction page based on the order book data, or execute a transaction strategy based on the order book data.
[0264] Corresponding to the above method embodiments, the specification also provides a third FPGA-based order book data construction system embodiment, Figure 9 A structural schematic diagram of the third FPGA-based order book data construction system provided by an embodiment of the specification is shown. As shown in Figure 9 The FPGA-based order book data construction system 900 includes a server 910 and a terminal 920, wherein the server 910 is configured with a programmable logic component, including:
[0265] The server 910 is configured to acquire transaction market data through the programmable logic component, decode the transaction market data to obtain per-transaction data and snapshot data, reorganize the per-transaction data according to a preset format to obtain market information, synchronously send the market information to a target memory and a target cache, construct order book data based on the market information in the target cache, compare the order book data and the snapshot data, determine optimal order book data according to a comparison result, and send the optimal order book data to the terminal.
[0266] The terminal 920 is configured to render and display a transaction market list in a transaction page based on the optimal order book data, or execute a transaction strategy based on the optimal order book data.
[0267] Corresponding to the above method embodiments, the specification also provides a fourth FPGA-based order book data construction system embodiment, Figure 10 A structural schematic diagram of the fourth FPGA-based order book data construction system provided by an embodiment of the specification is shown. As shown in Figure 10 The FPGA-based order book data construction system 1000 includes a server 1010 and a terminal 1020, wherein the server 1010 is configured with a programmable logic component, including:
[0268] The server 1010 is configured to acquire multi-source heterogeneous data through a programmable logic component, split the multi-source heterogeneous data into at least two paths of complementary multi-source heterogeneous sub-data, process each path of corresponding multi-source heterogeneous sub-data to obtain each path of corresponding market information, send each path of corresponding market information to a corresponding target memory and target cache, construct each path of corresponding order book sub-data based on the market information in the target cache, merge each path of corresponding order book sub-data to obtain order book data, and send the order book data to the terminal.
[0269] The terminal 1020 is configured to render a transaction market list in a transaction page based on the order book data and display the transaction market list, or execute a transaction strategy based on the order book data.
[0270] Corresponding to the method embodiments described above, the specification also provides a fifth FPGA-based order book data construction system embodiment, Figure 11 A structure diagram of the fifth FPGA-based order book data construction system provided by an embodiment of the specification is shown. As shown in Figure 11 The FPGA-based order book data construction system 1100 includes a server 1110 and a terminal 1120, wherein the server 1110 is configured with a programmable logic component, including:
[0271] The server 1110 is configured to acquire transaction market data through a programmable logic component, decode the transaction market data, reorganize the decoded transaction market data according to a preset format to obtain market information, synchronize the market information to a target memory and a target cache, construct an optimal buy / sell position table based on the market information in the target cache, and construct order book data according to the optimal buy / sell position table. In the case that the structured data corresponding to the optimal buy / sell position table meets the data update condition, delete and / or adjust the associated position elements in the structured data, and construct target order book data according to the deletion and / or adjustment results. The target order book data is sent to the terminal.
[0272] The terminal 1120 is configured to render a transaction market list in a transaction page based on the target order book data and display the transaction market list, or execute a transaction strategy based on the target order book data.
[0273] The above is a schematic scheme of the order book data construction system based on the FPGA of the embodiment. It should be noted that the technical scheme of the order book data construction system based on the FPGA and the technical scheme of the order book data construction method based on the FPGA described above belong to the same concept. The technical scheme of the order book data construction system based on the FPGA, which is not described in detail, can be seen from the description of the technical scheme of the order book data construction method based on the FPGA.
[0274] An embodiment of the specification provides an electronic device, which is a programmable logic component, and the programmable logic component is used to execute the steps of the order book data construction method based on the FPGA.
[0275] The above is a schematic scheme of an electronic device of the embodiment. It should be noted that the technical scheme of the electronic device and the technical scheme of the order book data construction method based on the FPGA described above belong to the same concept. The technical scheme of the electronic device, which is not described in detail, can be seen from the description of the technical scheme of the order book data construction method based on the FPGA.
[0276] The above describes specific embodiments of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than the order in which they are recited in the embodiments and still achieve desirable results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.
[0277] It should be noted that for the foregoing method embodiments, in order to facilitate description, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the embodiments of the specification are not limited by the order of the described actions, because according to the embodiments of the specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily necessary for the embodiments of the specification.
[0278] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be seen from the related description of other embodiments.
[0279] The preferred embodiments of the present specification disclosed above are only used to help illustrate the present specification. The alternative embodiments do not describe all the details and do not limit the present application to the specific embodiments described. Obviously, many modifications and variations can be made in light of the contents of the present specification. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and utilize the present specification.
Claims
1. A FPGA-based order book data construction method, characterized in that, The application is applied to a programmable logic component, wherein the programmable logic component comprises a target memory and a target cache, and comprises: Obtaining transaction market data and decoding the transaction market data, wherein the decoding operation is completed by a decoding module in the FPGA; Reorganizing the decoded transaction market data according to a preset format to obtain market information, wherein the reorganization operation is completed by a reorganization module in the FPGA; Synchronously sending the market information to the target memory and the target cache, and constructing order book data based on the market information in the target cache, wherein the construction of the order book data comprises: analyzing the market information stored in the target cache in the case that the market information is successfully stored in the target cache; constructing an optimal buying and selling position table according to the analysis result; updating the structured data corresponding to the optimal buying and selling position table based on the order price information and the quantity information corresponding to the received target market information, and constructing the order book data based on the updated structured data, wherein the number of position elements of the optimal buying and selling position table is more than or equal to that of the order book data.
2. The method of claim 1, wherein, The obtaining transaction market data and decoding the transaction market data comprises: Obtaining multi-source heterogeneous data and pre-processing the multi-source heterogeneous data to obtain transaction market data; Decoding the transaction market data according to a binary protocol or an information exchange protocol to obtain per-transaction data; The reorganizing the decoded transaction market data according to a preset format to obtain market information comprises: Reorganizing the per-transaction data according to a preset format to obtain market information.
3. The method of claim 1, wherein, After the step of synchronously sending the market information to the target memory and the target cache, the method further comprises: Detecting whether the market information meets the storage condition of the target cache; If yes, synchronously storing the market information to the target cache and the target memory; If no, storing the market information to the target memory.
4. The method of claim 1, wherein, The constructing order book data based on the market information in the target cache comprises: Receiving the target market information and determining the order price information and the quantity information corresponding to the target market information; In the case that the order price information is associated with the optimal buying and selling position table and belongs to a non-newly-added price, updating the structured data corresponding to the optimal buying and selling position table according to the quantity information; In the case that the order price information is associated with the optimal buying and selling position table and belongs to a newly-added price, determining the to-be-updated position element according to the order price information and the quantity information, and updating the structured data corresponding to the optimal buying and selling position table based on the to-be-updated position element; In the case that the order price information and the quantity information are associated with the optimal buying and selling position table and belong to order cancellation or complete transaction, reading the candidate position element in the target memory and storing it to the target cache, and updating the structured data corresponding to the optimal buying and selling position table based on the candidate position element; In the case that the order price information and the quantity information are associated with the optimal bid-ask table and belong to cancel order or complete transaction, and the number of elements of the optimal bid-ask table is more than that of the order book data, the element to be updated is determined according to the order price information and the quantity information, the corresponding structured data of the optimal bid-ask table is updated based on the element to be updated; in the idle state or when the number of elements of the optimal bid-ask table is less than a set threshold, the candidate element is read from the target memory and stored in the target cache, and the corresponding structured data of the optimal bid-ask table is updated based on the candidate element; The order book data is constructed based on the updated structured data.
5. The method according to any one of claims 1 to 4, characterized in that, The market information is synchronously sent to the target memory and the target cache, and the order book data is constructed based on the market information in the target cache, including: In the case that the market information includes first market information and second market information, the first market information is synchronously sent to the target memory and the target cache, and the position information is constructed based on the first market information in the target cache; The position information is read from the target cache, and the position information and the second market information are spliced to construct the order book data.
6. The method according to any one of claims 2-4, characterized in that, Further comprising: According to the decoding result, the step of determining the per-pen data and the snapshot data, and performing data reorganization on the per-pen data according to the preset format to obtain the market information, and synchronously sending the market information to the target memory and the target cache, and constructing the order book data based on the market information in the target cache is performed. In the data sending stage, the order book data and the snapshot data are compared, and the optimal order book data is determined according to the comparison result.
7. The method of claim 2, wherein, The multi-source heterogeneous data is obtained, and the multi-source heterogeneous data is preprocessed to obtain the transaction market data, including: The multi-source heterogeneous data is obtained, and the multi-source heterogeneous data is split into at least two complementary multi-source heterogeneous sub-data, each multi-source heterogeneous sub-data is taken as the multi-source heterogeneous data, and the step of pre-processing the multi-source heterogeneous data to obtain the transaction market data is performed; Until the order book data construction stage, the corresponding order book sub-data of each path is determined, and the order book sub-data corresponding to each path is merged to obtain the order book data.
8. The method of claim 4, wherein, Further comprising: In the case that the target market information is in the packet loss state and the associated market information is received, the associated position element corresponding to the associated market information is determined in the structured data corresponding to the optimal bid-ask table; In the case that the structured data satisfies the data update condition according to the associated market information and the associated position element, the associated position element is deleted and / or adjusted in the structured data, and the order book data is constructed according to the deletion and / or adjustment result.
9. An FPGA-based order book data construction method, characterized in that, Applied to a programmable logic component, wherein the programmable logic component includes a target memory and a target cache, including: Acquire transaction market data, and decode the transaction market data, wherein the decoding operation is completed by a decoding module in the FPGA; Reorganize the decoded transaction market data according to a preset format to obtain first market information and second market information, wherein the reorganization operation is completed by a reorganization module in the FPGA; Synchronously send the first market information to a target memory and a target cache, and construct gear information based on the first market information in the target cache; Read the gear information from the target cache, and assemble the gear information and the second market information to construct order book data, wherein the construction of the order book data comprises: constructing an optimal buying and selling gear table according to the gear information and the second market information; updating structured data corresponding to the optimal buying and selling gear table based on order price information and quantity information corresponding to the received target market information, and constructing order book data based on the updated structured data, wherein the number of gear elements of the optimal buying and selling gear table is more than or equal to that of the order book data.
10. The method of claim 9, wherein, The acquisition of transaction market data and the decoding of the transaction market data comprises: Acquire multi-source heterogeneous data, and pre-process the multi-source heterogeneous data to obtain transaction market data; Decode the transaction market data according to a binary protocol or an information exchange protocol to obtain per-transaction data; The reorganization of the decoded transaction market data according to a preset format to obtain first market information and second market information comprises: Reorganize the per-transaction data according to a preset format to obtain first market information and second market information.
11. The method of claim 10, wherein, After the decoding of the transaction market data, the steps further comprise: According to the decoding result, determine per-transaction data and snapshot data, and execute the steps of reorganizing the per-transaction data according to a preset format to obtain first market information and second market information, synchronously sending the first market information to a target memory and a target cache, constructing gear information based on the first market information in the target cache, reading the gear information from the target cache, and assembling the gear information and the second market information to construct order book data; In the data sending stage, compare the order book data and the snapshot data, and determine optimal order book data according to the comparison result.
12. The method according to claim 10 or 11, characterized in that, The acquisition of multi-source heterogeneous data and the pre-processing of the multi-source heterogeneous data to obtain transaction market data comprises: Acquire multi-source heterogeneous data, and split the multi-source heterogeneous data into at least two complementary multi-source heterogeneous sub-data, take each multi-source heterogeneous sub-data as the multi-source heterogeneous data, and execute the pre-processing of the multi-source heterogeneous data to obtain transaction market data; Until the order book data construction stage, determine order book sub-data corresponding to each path, merge the order book sub-data corresponding to each path to obtain order book data.
13. An FPGA-based order book data construction method, characterized in that, Applied to a programmable logic component, wherein the programmable logic component comprises a target memory and a target cache, and comprises: Acquire transaction market data, and decode the transaction market data to obtain per-transaction data and snapshot data, wherein the decoding operation is completed by a decoding module in the FPGA; Reorganize the per-transaction data according to a preset format to obtain market information, wherein the reorganization operation is completed by a reorganization module in the FPGA; Synchronously send the market information to a target memory and a target cache, and construct order book data based on the market information in the target cache, wherein the construction of the order book data comprises: analyzing the market information stored in the target cache in the case that the market information is successfully stored in the target cache; constructing an optimal buying and selling position table according to the analysis result; updating the structured data corresponding to the optimal buying and selling position table based on the order price information and the quantity information corresponding to the target market information received, and constructing order book data based on the updated structured data, wherein the number of position elements of the optimal buying and selling position table is more than or equal to that of the order book data; Compare the order book data and the snapshot data, and determine optimal order book data according to the comparison result.
14. The method of claim 13, wherein, The step of synchronously sending the market information to a target memory and a target cache, and constructing order book data based on the market information in the target cache comprises: In the case that the market information comprises first market information and second market information, synchronously send the first market information to the target memory and the target cache, and construct position information based on the first market information in the target cache; Read the position information from the target cache, and assemble the position information and the second market information to construct order book data.
15. The method of claim 13, wherein, The step of acquiring transaction market data, and decoding the transaction market data to obtain per-transaction data and snapshot data comprises: Acquire multi-source heterogeneous data, and pre-process the multi-source heterogeneous data to obtain transaction market data; Decode the transaction market data according to a binary protocol or an information exchange protocol to obtain per-transaction data and snapshot data.
16. The method of claim 15, wherein, The step of acquiring multi-source heterogeneous data, and pre-processing the multi-source heterogeneous data to obtain transaction market data comprises: Acquire multi-source heterogeneous data, and split the multi-source heterogeneous data into at least two routes of complementary multi-source heterogeneous sub-data, take each route of multi-source heterogeneous sub-data as the multi-source heterogeneous data, and perform the step of pre-processing the multi-source heterogeneous data to obtain transaction market data; Until the order book data construction stage, determine the order book sub-data corresponding to each route, and merge the order book sub-data corresponding to each route to obtain order book data.
17. A FPGA-based order book data construction method, characterized in that, Applied to a programmable logic component, wherein the programmable logic component comprises a target memory and a target cache, and comprises: Acquire multi-source heterogeneous data, and split the multi-source heterogeneous data into at least two routes of complementary multi-source heterogeneous sub-data; The multi-source heterogeneous sub-data corresponding to each channel is processed to obtain market sub-information corresponding to each channel, wherein the processing of the multi-source heterogeneous sub-data includes a decoding operation and a reorganization operation, the decoding operation is completed by a decoding module in the FPGA, and the reorganization operation is completed by a reorganization module in the FPGA; The market sub-information corresponding to each channel is sent to a corresponding target memory and a target cache, and order book sub-data corresponding to each channel is constructed based on the market sub-information in the target cache; The order book sub-data corresponding to each channel is merged to obtain order book data, wherein the construction of the order book data includes: in the case that the market sub-information is successfully stored in the target cache, the market sub-information stored in the target cache is analyzed; an optimal buying and selling position table is constructed according to the analysis result; the structured data corresponding to the optimal buying and selling position table is updated based on the received order price information and quantity information corresponding to the target market information, and order book data is constructed based on the updated structured data, wherein the number of position elements of the optimal buying and selling position table is more than or equal to the number of position elements of the order book data.
18. The method of claim 17, wherein, The processing of the first multi-source heterogeneous sub-data of any one of the at least two complementary multi-source heterogeneous sub-data includes: The first multi-source heterogeneous sub-data is processed to obtain transaction market sub-data; The transaction market sub-data is decoded according to a binary protocol or an information exchange protocol to obtain per-sub-data; The per-sub-data is reorganized according to a preset format to obtain market sub-information.
19. The method of claim 17, wherein, The construction of order book sub-data corresponding to the second multi-source heterogeneous sub-data of any one of the at least two complementary multi-source heterogeneous sub-data includes: In the case that the market sub-information corresponding to the second multi-source heterogeneous sub-data includes first market sub-information and second market sub-information, the first market sub-information is synchronously sent to the target memory and the target cache, and position sub-information is constructed based on the first market sub-information in the target cache; The position sub-information is read from the target cache, and the position sub-information and the second market sub-information are spliced to construct order book sub-data.
20. The method of claim 18, wherein, Further comprising: According to the decoding result, per-sub-data and snapshot sub-data are determined, and the per-sub-data is reorganized according to a preset format to obtain market sub-information, the market sub-information corresponding to each channel is sent to a corresponding target memory and a target cache, order book sub-data corresponding to each channel is constructed based on the market sub-information in the target cache, and order book data is obtained by merging the order book sub-data corresponding to each channel; In the data sending stage, the snapshot sub-data corresponding to each channel is merged to obtain snapshot data; The order book data and the snapshot data are compared, and the optimal order book data is determined according to the comparison result.
21. A FPGA-based order book data construction method, characterized in that, The application is applied to a programmable logic component, wherein the programmable logic component includes a target memory and a target cache, and includes: Transaction market data is obtained and decoded, wherein the decoding operation is completed by a decoding module in the FPGA; The decoded transaction market data is reorganized according to a preset format to obtain market information, wherein the reorganization is completed by a reorganization module in the FPGA; The market information is synchronously sent to the target memory and the target cache, the optimal buy / sell position table is constructed based on the market information in the target cache, the structured data corresponding to the optimal buy / sell position table is updated based on the order price information and the quantity information corresponding to the received target market information, and the order book data is constructed based on the updated structured data, wherein the number of position elements of the optimal buy / sell position table is greater than or equal to that of the order book data; In a case where the structured data corresponding to the optimal buy / sell position table meets a data update condition, the associated position elements are deleted and / or adjusted in the structured data, and the target order book data is constructed according to the deletion and / or adjustment result.
22. An FPGA-based order book data construction system, comprising: The service end is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The service end is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The service end is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes:
23. An FPGA-based order book data construction system, comprising: The terminal is configured to render a transaction market list in a transaction page based on the order book data and display, or execute a transaction strategy based on the order book data. The server is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The server is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes:
24. An FPGA-based order book data construction system, comprising: The server is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The server is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The server is configured with a programmable logic component, and the programmable logic component includes a target memory and a target cache, and includes: The terminal is configured to render a transaction market list in a transaction page based on the optimal order book data and display; or, is configured to execute a transaction strategy based on the optimal order book data. The terminal is configured to render a transaction market list in a transaction page based on the optimal order book data and display; or, is configured to execute a transaction strategy based on the optimal order book data. The terminal is configured to render a transaction market list in a transaction page based on the optimal order book data and display; or, is configured to execute a transaction strategy based on the optimal order book data.
25. An FPGA-based order book data construction system, comprising: The application relates to a system for processing multi-source heterogeneous data, comprising a server and a terminal, wherein the server is configured with a programmable logic component, the programmable logic component comprises target memory and target cache, and the server comprises: The server is used for acquiring multi-source heterogeneous data through the programmable logic component, and splitting the multi-source heterogeneous data into at least two-way complementary multi-source heterogeneous sub-data; each-way corresponding multi-source heterogeneous sub-data is processed to obtain each-way corresponding market information, wherein the processing of the multi-source heterogeneous sub-data comprises decoding operation and reorganization operation, the decoding operation is completed through a decoding module in the FPGA, and the reorganization operation is completed through a reorganization module in the FPGA; each-way corresponding market information is sent to corresponding target memory and target cache, and each-way corresponding order book sub-data is constructed based on the market information in the target cache; each-way corresponding order book sub-data is merged to obtain order book data, wherein the construction of the order book data comprises: in the case that the market information is successfully stored in the target cache, the market information stored in the target cache is analyzed; an optimal buying and selling position table is constructed according to the analysis result; the structured data corresponding to the optimal buying and selling position table is updated based on the received order price information and quantity information corresponding to the target market information, and the order book data is constructed based on the updated structured data, wherein the position elements of the optimal buying and selling position table are more than or equal to the position elements of the order book data; and the order book data is sent to the terminal. The terminal is used for rendering a transaction market list in a transaction page based on the order book data and displaying, or is used for executing a transaction strategy based on the order book data.
26. An FPGA-based order book data construction system, comprising: The application relates to a system for processing multi-source heterogeneous data, comprising a server and a terminal, wherein the server is configured with a programmable logic component, the programmable logic component comprises target memory and target cache, and the server comprises: The server is used for acquiring transaction market data through the programmable logic component, and decoding the transaction market data, wherein the decoding operation is completed through a decoding module in the FPGA; the decoded transaction market data is reorganized according to a preset format to obtain market information, wherein the reorganization operation is completed through a reorganization module in the FPGA; the market information is synchronously sent to target memory and target cache, an optimal buying and selling position table is constructed based on the market information in the target cache, structured data corresponding to the optimal buying and selling position table is updated based on received order price information and quantity information corresponding to the target market information, and order book data is constructed based on the updated structured data, wherein the position elements of the optimal buying and selling position table are more than or equal to the position elements of the order book data; in the case that the structured data corresponding to the optimal buying and selling position table satisfies a data update condition, associated position elements in the structured data are deleted and / or adjusted, and target order book data is constructed according to the deletion and / or adjustment result; and the target order book data is sent to the terminal. The terminal is configured to render a transaction market list in a transaction page based on the target order book data and display the transaction market list; or execute a transaction strategy based on the target order book data. 27.An electronic device, comprising: The electronic device is a programmable logic component, and the programmable logic component is configured to execute the steps of the method of any one of claims 1-21.
Citation Information
Patent Citations
Market data reconstruction method and related device
CN111815445A
Low-delay high-throughput real-time order book generation method
CN114549129A