CN114549129A - Low-delay high-throughput real-time order book generation method - Google Patents
Low-delay high-throughput real-time order book generation method Download PDFInfo
- Publication number
- CN114549129A CN114549129A CN202210164141.1A CN202210164141A CN114549129A CN 114549129 A CN114549129 A CN 114549129A CN 202210164141 A CN202210164141 A CN 202210164141A CN 114549129 A CN114549129 A CN 114549129A
- Authority
- CN
- China
- Prior art keywords
- order book
- contract
- price
- gear
- small
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000012545 processing Methods 0.000 claims abstract description 21
- 230000008569 process Effects 0.000 claims abstract description 12
- 230000015654 memory Effects 0.000 claims description 12
- 238000012546 transfer Methods 0.000 claims description 6
- 230000008901 benefit Effects 0.000 abstract description 7
- 238000013461 design Methods 0.000 description 10
- 230000001960 triggered effect Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 230000035515 penetration Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012163 sequencing technique Methods 0.000 description 2
- 238000011144 upstream manufacturing Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000001174 ascending effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000000470 constituent Substances 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0633—Lists, e.g. purchase orders, compilation or processing
- G06Q30/0635—Processing of requisition or of purchase orders
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/76—Architectures of general purpose stored program computers
- G06F15/78—Architectures of general purpose stored program computers comprising a single central processing unit
- G06F15/7807—System on chip, i.e. computer system on a single chip; System in package, i.e. computer system on one or more chips in a single package
- G06F15/781—On-chip cache; Off-chip memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2379—Updates performed during online database operations; commit processing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Databases & Information Systems (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Data Mining & Analysis (AREA)
- Marketing (AREA)
- Development Economics (AREA)
- Computing Systems (AREA)
- Microelectronics & Electronic Packaging (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a low-delay high-throughput real-time order book generation method, which uses FPGA hardware and combines the advantages of software to realize low delay and high throughput of order book generation. The technical scheme is as follows: on one hand, the FPGA hardware is used for replacing the traditional software to realize the real-time processing and generation of the contract order book; on the other hand, the invention adopts a storage structure (a large table and a small table) for storing the contract order book in a split mode, and respectively processes the small table and the large table by utilizing the advantages of high concurrency and low delay of FPGA hardware and large flexible software storage capacity, thereby increasing the practicability of the invention and reducing the use cost.
Description
Technical Field
The invention relates to an information processing technology in a financial market system, in particular to an order book generation technology for updating order market in real time in a soft and hard combination mode.
Background
The mainstream market system of the current electronic trading generally forwards snapshot market published by a trading exchange at regular time. With the rise of programmed and quantitative trading, traders have higher and higher market frequency and real-time requirements. The traditional timing snapshot market is gradually unable to satisfy. Therefore, domestic and foreign exchange provides market information on each order consignment and deal to market receivers. Based on the market quotation, the quotation receiver can generate a snapshot of the market quotation by itself, so that market quotation information can be fully acquired.
The current market-by-market system is mainly implemented by software. The software system has the advantages of convenience in development, high flexibility, but poor performance, and on one hand, the penetration delay of the software system is high, and the general delay is more than 100 microseconds; on the other hand, the throughput of the software system is low, and when the market traffic is large, obvious performance degradation occurs, such as increase of penetration delay.
Disclosure of Invention
The following presents a simplified summary of one or more aspects in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
The invention aims to solve the problems and provides a low-delay high-throughput real-time order book generation method, which uses FPGA hardware and combines the advantages of software to realize low delay and high throughput of contract order book generation.
The technical scheme of the invention is as follows: the invention discloses a low-delay high-throughput real-time order book generation method, which comprises the following steps:
step 1: acquiring a market information item by item issued by a trading exchange, and searching a corresponding contract order book according to a contract number in the market information item by item;
step 2: updating the searched corresponding contract order book by using the acquired market information one by one in the step 1;
and step 3: extracting the required gear quotation from the contract order book updated in the step 2;
and 4, step 4: and generating market information based on the gear market extracted in the step 3 and pushing the market information.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, the acquiring of the market information one by one in step 1 is receiving a network message containing market information and analyzing the network message, wherein the receiving and analyzing of the network message are both realized by FPGA hardware.
According to an embodiment of the method for generating the low-delay high-throughput real-time order book, the contract order book is a storage structure for segmenting and storing the contract order book, the contract order book is divided into a large table and a small table, the small table is stored in the contract order book of FPGA hardware, the large table is stored in the contract order book of software, contents of the large table and the small table are mutually exclusive, and the large table and the small table jointly form a complete contract order book.
According to an embodiment of the method for generating a low-latency high-throughput real-time order book of the present invention, the large table and the small table are respectively ordered.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, in the update process of the contract order book, if the price in the currently processed market message belongs to the price range in the small table, the corresponding order number is updated in the small table, and if the price in the currently processed market message belongs to the price range in the large table, the corresponding order number is updated in the large table.
According to an embodiment of the low-delay high-throughput real-time order book generation method, when a small table is filled and a new order price is inserted, one order price in the small table is transferred to a large table for storage; when a withdrawal or deal occurs to reduce the price in the small table to some critical value, data is transferred from the large table to the small table.
According to an embodiment of the low-latency high-throughput real-time order book generation method, under the condition that data of a small table is triggered to be transferred to a large table, only the gear of the last gear of the small table is transmitted to the large table, so that the delay of the small table is minimized; when the data of the large table is triggered to be transferred to the small table, a plurality of gears of the large table are transmitted to the small table in a batch mode.
According to an embodiment of the low-latency high-throughput real-time order book generation method, a storage structure of a small table of a contract order book is in a structured array mode, contract addresses are used as indexes, different data fields in the same contract are obtained by simultaneously accessing a plurality of different FPGA chip memory BRAMs, so that all contract information can be simultaneously obtained in one clock cycle, wherein each contract information corresponds to a unique contract address.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, the market information messages include consignation messages and transaction messages, and the contract order book updates corresponding to step 2 include contract order book updates for the consignation messages and contract order book updates for the transaction messages.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, the order book update for each delegation message further comprises:
after acquiring a transaction order-by-transaction entrusting message issued by a transaction exchange, judging a processing object of the entrusting message according to an entrusting price in the entrusting message: if the entrusting price is larger than the optimal price in the contract order book correspondingly processed by the software, the entrusting message is processed by FPGA hardware, otherwise, the entrusting message is processed by the software to update the contract order book of the software, namely a large table;
in the contract order book updating process of the FPGA hardware processing, firstly, judging whether the entrusting type is a new report or a cancel report, if the entrusting type is the new report and the price gear in the small table exists, finding the corresponding price gear in the small table and adding the entrusting quantity to the current gear quantity; if the price gear does not exist in the new report, the price gear is newly added at the tail part of the small watch so as to restore the orderliness of the small watch in the subsequent sorting operation; if the order is a withdrawal order, finding out a corresponding price gear on a contract order book of FPGA hardware and subtracting the entrusted quantity from the current quantity of the gear;
performing sorting operation on the updated contract order book of the FPGA hardware, and recovering the price gear ordering of the contract order book of the FPGA hardware;
checking the state of the contract order book of the updated and sequenced FPGA hardware, and if the price gear in the small table overflows due to the newly added entrusts, moving the position gear to the contract order book of the software, namely the large table; if the price gear in the small table is insufficient due to the order withdrawing commission, partial gear is moved from the contract order book of the software, namely the large table, to the small table.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, the contract order book update for each transaction message further comprises:
after acquiring the transaction messages issued by the exchange one by one, judging the processing object of the transaction message according to the transaction price in the transaction message: if the transaction price is larger than the optimal price in the contract order book of the software, namely the large table, the transaction message is processed by FPGA hardware, otherwise, the transaction message is processed by the software to update the contract order book of the software, namely the large table;
for the way that the transaction message is processed by FPGA hardware, the transaction message is updated to a contract order book, namely a small table, of the FPGA hardware, the corresponding price gear is searched in the small table, and the transaction quantity in the transaction message is subtracted from the current quantity of the price gear;
performing sorting operation on the updated contract order book of the FPGA hardware, and recovering the price gear ordering of the contract order book of the FPGA hardware;
and checking the state of the contract order book of the updated and sequenced FPGA hardware, and if the price gear in the small table is insufficient due to transaction at the moment, moving part of gears from the large table of the contract order book of the software to the small table.
According to an embodiment of the low-latency high-throughput real-time order book generation method of the present invention, the step 3 of extracting the gear quotation is to extract a required gear quotation from an updated contract order book of the FPGA hardware.
Compared with the prior art, the invention has the following beneficial effects: on one hand, the invention uses FPGA hardware to replace the traditional software to realize the real-time processing and generation of the order book; on the other hand, the invention adopts a storage structure (a large table and a small table) for storing the contract order book in a split mode, and respectively processes the small table and the large table by utilizing the advantages of high concurrency and low delay of FPGA hardware and large flexible software storage capacity, thereby increasing the practicability of the invention and reducing the use cost.
Drawings
The above features and advantages of the present disclosure will be better understood upon reading the detailed description of embodiments of the disclosure in conjunction with the following drawings. In the drawings, components are not necessarily drawn to scale, and components having similar relative characteristics or features may have the same or similar reference numerals.
FIG. 1 shows a schematic of the composition of a contract order book.
FIG. 2 is a flow diagram illustrating an embodiment of a low latency high throughput real time order book generation method of the present invention.
Fig. 3 is a flowchart showing a batch order process in the real-time order book generating method shown in fig. 2.
Fig. 4 is a flowchart showing a transaction-by-transaction process in the real-time order book generation method shown in fig. 2.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments. It is noted that the aspects described below in connection with the figures and the specific embodiments are only exemplary and should not be construed as imposing any limitation on the scope of the present invention.
Fig. 1 shows components of an example of a contract order book, which is a main component of a snapshot market published by a trading exchange in a financial transaction as shown in fig. 1, and a main component of an order book rating table of a complete contract order book is screen information. The main constituent element of the information of the disk opening is the purchase and sale gear position, and generally, the purchase and sale has five-gear or ten-gear information (illustrated as ten-gear information), and each gear information includes a gear position price and a gear position statement quantity. All gears in the purchase and sale disk openings are respectively sorted according to the price of the disk openings, wherein the purchase disks are sorted according to the reverse order of the price, namely the purchase of one gear is the highest price of the purchase disks; the orders are sorted according to the ascending order of the prices, namely, the first grade is sold as the lowest price of the orders.
And the purchase and sale gears contained in a complete order book price dividing table are far beyond ten gears, and the complete order book price dividing table can be obtained through calculation according to market information. The one-by-one quotation message generally comprises one-by-one consignment message and one-by-one transaction message, the one-by-one consignment message is a consignment receipt of a trader, the content of the consignment receipt generally comprises a receipt price, a quantity, a type and a number, and the type of the receipt of the consignment receipt generally comprises two types of the receipt and a receipt withdrawal; the transaction messages are the corresponding transaction messages after the receipt transaction, and the contents of the transaction messages usually include transaction prices, quantities and consignment numbers of transaction buyers and sellers. The price of the entrusted order forms the gear price information in the order book price list, and the quantity of the entrusted order forms the gear order quantity information in the order book price list. Therefore, the information of the order book price-dividing list can be triggered and updated by utilizing each one-by-one market information, and the first five-gear or ten-gear information is extracted from the order book price-dividing list to form the plate opening information.
FIG. 2 illustrates a flow of an embodiment of a low latency high throughput real-time order book generation method of the present invention. As shown in fig. 2, the processing steps of the real-time order book generation method according to the present embodiment are described in detail as follows.
Step 1: acquiring a market information item by item issued by a trading exchange, and searching a corresponding contract order book according to a contract number in the market information item by item.
As described in fig. 1, the market by market messages issued by the exchange include entrustment by consignment messages and deal by deal messages.
The acquisition of the market information one by one in the step is to receive the network message containing the market information and analyze the network message, and the receiving and the analysis of the network message are realized by FPGA hardware without the intervention of an operating system and software, so the time consumption is low.
Because of the implementation in FPGA hardware, the storage of contract order books is a problem, subject to the limitations of hardware resources. Unlike software, FPGA hardware cannot flexibly and dynamically allocate memory space, so for each contract, the FPGA hardware must allocate memory space in advance for storing a contract order book. Even for an exchange with fluctuation and stop limits, the number of different prices in each contract order book may theoretically exceed 10000, and if each contract is allocated in advance, the consumption and waste of hardware storage resources are huge, which not only affects the operating efficiency of the system, but also affects the number of contracts supported by the system.
In this embodiment, the contract is a specific product, such as in the stock market, and the contract is a specific stock, such as the issuing bank (600000). The contract order book is the specific market information of the contract, which represents the current bidding situation of the buyer in the market, for example, the buying and selling five-gear market (buying one, buying two … … buying five) as seen in stock software is a part of the contract order book, and the complete contract order book is far more than the five-gear buying and selling bidding. Thus, each contract has its own order book, i.e., one contract for each contract order book.
In the storage structure of the contract order book, if all possible gears are simply reserved, a large amount of logic resources are required to be spent in storing and updating the order book rating table, which makes the number of contracts that a single FPGA card can accommodate limited. Therefore, how to design a reasonable storage structure of the order book rating table plays a decisive role in the contract quantity and performance delay that can be accommodated by the FPGA. In view of the above, the present invention adopts a design method of the rating table of the size table to solve the above problems.
The contract order book and order book rating form herein can be roughly understood as a matter of affairs. Strictly speaking, the contract order book is formed by combining the order book price-sharing table and the contract basic information. The order book rating table is the gear information composed of all quotes of the aforementioned contracts, and the contract basic information is information such as the latest price of the contract, the volume of the deal, etc. Since the focus of the present invention is on the rapid processing of the order book rating form, the statement of contract order book is used uniformly hereafter.
In the embodiment, a storage structure for storing the order book in a split manner is adopted to store the contract order book, and the storage structure is suitable for FPGA hardware. That is, the contract order book is divided into two parts, called size tables. The small table is stored in FPGA hardware, the large table is stored in a software system, contents between the two tables are mutually exclusive, and a complete contract order book is formed after combination.
In this embodiment, a small table with a length of 20 is maintained in the FPGA hardware, and the small table only stores the top 20 orders of data with the best purchase and sale prices in the contract order book, so that each contract only consumes a small amount of FPGA storage resources. If the ordered order book rating table is a buyer rating table (another possibility is a seller rating table), only the top 20 (price, quantity) tuples with the best (highest) prices are stored in the buyer rating table, which is called a small table. Then, the (price, quantity) tuple exceeding the first 20 prices is stored in a storage device outside the FPGA (such as a storage memory of a software system), and the table stored outside the FPGA is called a large table.
The following describes specific details of the size table design and how to ensure functional correctness. For convenience of discussion, only different situations of the buyer rating table will be described, and the seller rating table and the buyer rating table are the same, and are not repeated.
The first feature of the size table design is order invariance. Specifically, in the size table of the buyer rating table, two ordered rating tables need to be maintained, the small table and the large table are ordered respectively, and there is no overlapping portion between the prices of the two tables (i.e. a certain purchase price can only exist in the small table or the large table, but cannot exist in both the large table and the small table). For the buyer, the high price is superior, so the size tables of the buyer price-dividing tables are all sorted from large to small. The present invention ensures that in any case, the size table is ordered and is therefore referred to as an order invariant.
The second feature of the size table design is the principle of updating. Specifically, if the buyer price belongs to the small table price range, the order number is updated in the small table, and if the buyer price belongs to the large table range, the order number is updated in the large table.
A third feature of the size table design is the size table interaction. Specifically, the number of prices in the size table is not constant, and in practice, the price of an order in the size table and the number of orders placed at the price of the order may change quite frequently. Data exchange is required between the size tables. For example, when a trade is started, a customer continuously adds orders, new order prices are first inserted into the small table, and when the small table is filled and new order prices are inserted, one of the order prices (i.e., the current lowest price in the small table) needs to be transferred to the large table for storage. Or when a withdrawal or deal occurs to reduce the price in the small table to a certain threshold, the data needs to be replenished from the large table to the small table.
The basic principle of the size table interaction is to achieve as much overlap of computation and communication as possible and to trigger data interaction as little as possible. Taking the delegation message as an example, two operation types of adding and withdrawing are included. For small watches with limited size, too many insert orders may overflow the small watch gears, requiring a partial gear shift into the large watch; similarly, too many orders to withdraw will result in insufficient gears in the small table, requiring gears to be read from the large table to fill the small table. As previously mentioned, the key to ensuring the correctness of the size table is to ensure the orderliness of the size table, and the price in the small table is completely superior to the price in the large table. In order to distinguish the critical prices in the big and small watches, the sentinel is set to mark the optimal price in the big watch, and the order of the big and small watches also determines that the position pointed by the sentinel is the first position in the big watch.
In processing the order report stream, the small table will be triggered to transmit data to the large table when one of the following two conditions is met: 1. filling small meter gears; 2. the price gear belongs to the price range of a large meter.
When the small table gear is full, the last gear (i.e., the current lowest price gear in the small table) will be shifted to the large table. How many gears to shift into the large table is a matter of strategy. Shifting multiple gears at once reduces the number of shifts if new order types continue to appear later. However, if the order cancellation type continues to appear subsequently, the shift of multiple gears at one time may cause the gears of the small tables to be insufficient when the orders are continuously cancelled, and the probability of data transmission from the large tables to the small tables is increased. If a gear is transferred into the big table every time, the probability of transmitting data from the small table to the big table is increased when a new order is continuously added; when the cancel order continuously appears, the probability of transmitting data from the large table to the small table is reduced. From the perspective of the FPGA, hardware delay cannot be increased when the small table transmits data to the large table (when the small table transmits data to the large table, as long as a preset cache in the FPGA is not full, the FPGA processing kernel can continue to work only by sending the data to the cache, and the whole process does not need to wait, so that hardware delay cannot be affected). Based on this, the preferred process is to choose to transfer only the gear of the last gear of the small table into the large table to minimize the delay of the small table.
And when the continuous list removal occurs and the gear of the small meter is smaller than a preset threshold value, the large meter is triggered to transmit data to the small meter. In order to make all the five-gear (here, the five-gear is taken as an example, and may be changed into ten-gear according to actual conditions) required for releasing the quotation in the small table, the small table needs to ensure that at least five-gear quotation is provided at any time. When the order is removed, if the effective market is less than five grades, the small table requests data from the large table, and the large table transmits the optimal market with a plurality of grades to the small table. When the large table is triggered to transmit market data to the small table, the number of transmitted market data is user-defined. To reduce the number of times the large table is transferred to the small table, and reduce hardware latency, the large table will typically transfer the gear in bulk to the small table, typically in a number of half the size of the small table.
Because the storage access characteristic of FPGA hardware is different from the characteristic of software memory, besides the design of the storage structure of the large and small tables, the invention also designs a contract information storage scheme to accelerate the access speed of contract information. As previously mentioned, the contract order book is comprised of a contract pricing table and contract base information. The contract information refers to contract basic information, and is other states except contract gear information, such as the latest price and volume of a certain stock on the same day.
The contract information generally comprises contract numbers, latest prices, transaction stroke numbers, transaction total amount, sentinel positions of large and small tables and the like. Conventional software is stored as an Array Of Struct (AOS) data structure, that is, a cache is accessed by reading and writing an address over a plurality Of clock cycles, and the cache includes the above fields. The traditional software storage method is convenient to implement, but cannot exert the advantage Of FPGA hardware parallelism, so that the storage structure in FPGA hardware is changed into Struct Of Array (SOA) (namely structured Array). Each contract information corresponds to a unique contract address. And taking the unique contract address as an index, and simultaneously accessing different FPGA chip memories BRAM to obtain different data fields of the same contract so as to simultaneously acquire all contract information in one clock cycle. Similarly, when contract information needs to be updated (e.g., update the latest price, total amount of deals, sentinel position, etc.), the writing may be completed within one clock cycle. The contract information strictly refers to the contract basic information in the contract order book, i.e., a part of the information in the contract order book, and thus is updated in the contract order book, but only one component in the contract order book is updated.
Step 2: and (4) updating the searched corresponding contract order book by using the acquired market information one by one in the step (1).
According to whether the market quotation is entrusted or committed, respectively carrying out corresponding updating treatment:
for each consignation message, firstly judging the consignation type, if the consignation type is a newly increased report, newly increasing or updating the consignation quantity of the corresponding price gear on a contract order book, and if the consignation type is a cancelled report, finding the corresponding price gear on the contract order book and subtracting the consignation quantity;
for the transaction messages one by one, finding out the corresponding price gear on the contract order book and subtracting the transaction amount, and meanwhile, updating the fields of the latest price, the transaction total amount and the like in the quotation snapshot by using the transaction price and the transaction amount.
Likewise, the contract order book is time consuming to update, which results in high system latency. In the embodiment, the update processing is realized by adopting FPGA hardware instead of an operating system and software, so that the performance is remarkably improved compared with the software.
Specifically, the update processing that is delegated step by step is shown in fig. 3.
After acquiring a batch of entrusting messages issued by an exchange, judging a processing object of the entrusting message (the processing object comprises a large table processed by software or a small table processed by FPGA) according to an entrusting price in the entrusting message: if the entrusted price is larger than the optimal price (namely the sentinel position) in the contract order book (namely the large table in the storage structure of the contract order book) correspondingly processed by the software, the entrusted message is processed by FPGA hardware, otherwise, the entrusted message is processed by the software.
As for the way of processing the delegation message by the FPGA hardware, the delegation order in the delegation message is inserted into the contract order book (i.e. the small table in the order book storage structure) of the FPGA hardware to complete the update. In the order book updating process processed by FPGA hardware, firstly, judging whether the entrusting type is a newly-added report or a cancelled report, if the entrusting type is the newly-added report and the price gear in the small table exists, finding a corresponding price gear in the small table and adding the entrusting quantity to the current quantity of the gears; if the price gear does not exist in the new report, the price gear is newly added at the tail part of the small watch so as to restore the orderliness of the small watch in the subsequent sorting operation; if the order is a withdrawal order, finding the corresponding price gear in the contract order book and subtracting the consignment quantity from the current quantity of the gear.
The manner in which the delegation message is handled by the software is to transfer the delegation message to the software's contract order book for completion of the update.
And executing sequencing operation on the updated contract order book of the FPGA hardware, and recovering the price gear order of the contract order book.
Checking the state of the contract order book of the updated and sequenced FPGA hardware, and if the price gear in the small table overflows due to the newly added entrusts, moving the position gear to the large table of the contract order book of the software; if the price gear in the small table is insufficient due to the order withdrawing commission, the partial gear is moved from the large table of the contract order book of the software to the small table.
Specifically, the update process of step-by-step deal is as shown in fig. 4.
After acquiring the transaction messages issued by the exchange one by one, judging a processing object of the transaction message (the processing object comprises a large table processed by software or a small table processed by FPGA) according to the transaction price in the transaction message: if the transaction price is larger than the optimal price (namely the sentry position) in the contract order book (namely the large table in the order book storage structure) of the software, the transaction message is processed by FPGA hardware, otherwise, the transaction message is processed by the software.
The mode of processing the transaction message by the FPGA hardware is to update the transaction message to a contract order book (small table) of the FPGA hardware, and the specific operation is to look up a corresponding price gear in the small table and subtract the transaction amount in the transaction message from the current amount of the price gear.
The mode of processing the transaction message by the software is to transmit the transaction message to a contract order book of the software to complete updating.
And performing sequencing operation on the updated contract order book of the FPGA hardware, and recovering the price gear order of the contract order book of the FPGA hardware.
And checking the state of the updated and sequenced contract order book of the FPGA hardware, and if the price gear in the small table is insufficient due to the transaction at the moment, moving part of gears from the large table of the contract order book of the software to the small table.
And step 3: and (3) extracting the required gear market from the contract order book updated in the step (2).
The gear market is, for example, common trading five-gear drive information. Referring to fig. 3, the required gear quotation is extracted from the contract order book of the updated FPGA hardware.
And 4, step 4: and generating market information based on the gear market extracted in the step 3 and pushing the market information.
And pushing the market information in the step to a downstream system. Stock software typically presents stock quote information to users, but the quote information is not generated by the stock software, but is obtained from an upstream system, while the stock software is a downstream system.
The contract order book in this embodiment is generally a term used in a market system, and the pushed data is generally called market information. The contract order book is actually complete market information, and the market information is generally part of the content of a certain time node in the contract order book.
After testing, the software and hardware system realized by the invention is used, and the upstream uses the speed of 10Gb/s to play the incremental data, and the incremental data is input into the software and hardware system. And the downstream uses a trillion network card to receive snapshot market information and output the snapshot market information. And the input and the output are stamped with hardware time stamps through an arista switch. And subtracting the time stamp of the input data from the time stamp of the output data to obtain the penetration delay of the system. Through statistics of continuous 10000 data, the penetration delay of the system under the 10Gb/s flow is stable within 2us, and no obvious jitter burr is generated in the delay.
While, for purposes of simplicity of explanation, the methodologies are shown and described as a series of acts, it is to be understood and appreciated that the methodologies are not limited by the order of acts, as some acts may, in accordance with one or more embodiments, occur in different orders and/or concurrently with other acts from that shown and described herein or not shown and described herein, as would be understood by one skilled in the art.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. Any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a web site, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk (disk) and disc (disc), as used herein, includes Compact Disc (CD), laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks (disks) usually reproduce data magnetically, while discs (discs) reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. A low-delay high-throughput real-time order book generation method is characterized by comprising the following steps:
step 1: acquiring a market information item by item issued by a trading exchange, and searching a corresponding contract order book according to a contract number in the market information item by item;
step 2: updating the searched corresponding contract order book by using the acquired market information one by one in the step 1;
and 3, step 3: extracting the required gear quotation from the contract order book updated in the step 2;
and 4, step 4: and generating market information based on the gear market extracted in the step 3 and pushing the market information.
2. The method for generating a low-latency high-throughput real-time order book according to claim 1, wherein the acquiring of the market information in step 1 is receiving a network message containing market information and analyzing the network message, wherein the receiving and analyzing of the network message are both realized by FPGA hardware.
3. The method for generating a low-latency high-throughput real-time order book according to claim 1, wherein the contract order book is a storage structure for dividing and storing the contract order book, the contract order book is divided into a large table and a small table, the small table is stored in the contract order book of the FPGA hardware, the large table is stored in the contract order book of the software, contents of the large table and the small table are mutually exclusive, and the large table and the small table jointly form a complete contract order book.
4. The low latency high throughput real time order book generation method of claim 3, wherein the large and small tables are ordered separately.
5. The method according to claim 3, wherein in the update process of the contract order book, if the price in the currently processed market message belongs to the price range in the small table, the corresponding order number is updated in the small table, and if the price in the currently processed market message belongs to the price range in the large table, the corresponding order number is updated in the large table.
6. The method of claim 3, wherein when the small form is filled and a new order price is inserted, transferring one order price in the small form to the large form for storage; when a withdrawal or deal occurs to reduce the price gear in the small table to a certain threshold, then data is transferred from the large table to the small table.
7. The low latency high throughput real-time order book generation method of claim 6, wherein in case of triggering a small table data transfer to a large table, only the gear of the last gear of the small table is transferred to the large table to minimize the delay of the small table; in the case of triggering the transfer of the large table data to the small table, a plurality of gears of the large table are transferred to the small table in a batch manner.
8. The method for generating a low-latency high-throughput real-time order book according to claim 3, wherein a storage structure of a small table of a contract order book is in a structured array mode, a contract address is used as an index, different data fields in the same contract are obtained by simultaneously accessing a plurality of different FPGA on-chip memory BRAMs, so that all contract information can be obtained simultaneously in one clock cycle, and each contract information corresponds to a unique contract address.
9. A low-latency high-throughput real-time order book generating method as claimed in claim 3, wherein the market messages include delegation messages and deal messages, and the contract order book updates corresponding to step 2 include contract order book updates for delegation messages and contract order book updates for deal messages.
10. The low-latency high-throughput real-time order book generation method of claim 9, wherein contract order book updates for a commit-by-commit message further comprise:
after acquiring a transaction order-by-transaction entrusting message issued by a transaction exchange, judging a processing object of the entrusting message according to an entrusting price in the entrusting message: if the entrusting price is larger than the optimal price in the contract order book correspondingly processed by the software, the entrusting message is processed by FPGA hardware, otherwise, the entrusting message is processed by the software to update the contract order book of the software, namely a large table;
in the contract order book updating process of the FPGA hardware processing, firstly, judging whether the entrusting type is a new report or a cancel report, if the entrusting type is the new report and the price gear in the small table exists, finding the corresponding price gear in the small table and adding the entrusting quantity to the current gear quantity; if the price gear does not exist in the new report, the price gear is newly added at the tail part of the small watch so as to restore the orderliness of the small watch in the subsequent sorting operation; if the order is a withdrawal order, finding out a corresponding price gear on a contract order book of FPGA hardware and subtracting the entrusted quantity from the current quantity of the gear;
performing sorting operation on the updated contract order book of the FPGA hardware, and recovering the price gear ordering of the contract order book of the FPGA hardware;
checking the state of the contract order book of the updated and sequenced FPGA hardware, and if the price gear in the small table overflows due to the newly added entrusts, moving the position gear to the contract order book of the software, namely the large table; if the price gear in the small table is insufficient due to the order withdrawing commission, partial gear is moved from the contract order book of the software, namely the large table, to the small table.
11. The low-latency high-throughput real-time order book generation method of claim 9, wherein contract order book updates for a transaction message further comprise:
after acquiring the transaction messages issued by the exchange one by one, judging the processing object of the transaction message according to the transaction price in the transaction message: if the transaction price is larger than the optimal price in the contract order book of the software, namely the large table, the transaction message is processed by FPGA hardware, otherwise, the transaction message is processed by the software to update the contract order book of the software, namely the large table;
for the way that the transaction message is processed by FPGA hardware, the transaction message is updated to a contract order book, namely a small table, of the FPGA hardware, the corresponding price gear is searched in the small table, and the transaction quantity in the transaction message is subtracted from the current quantity of the price gear;
performing sorting operation on the updated contract order book of the FPGA hardware, and recovering the price gear ordering of the contract order book of the FPGA hardware;
and checking the state of the contract order book of the updated and sequenced FPGA hardware, and if the price gear in the small table is insufficient due to transaction at the moment, moving part of gears from the large table of the contract order book of the software to the small table.
12. The low-latency high-throughput real-time order book generation method according to claim 3, wherein the step 3 of extracting gear quotations is extracting required gear quotations from a contract order book of updated FPGA hardware.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210164141.1A CN114549129A (en) | 2022-02-22 | 2022-02-22 | Low-delay high-throughput real-time order book generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210164141.1A CN114549129A (en) | 2022-02-22 | 2022-02-22 | Low-delay high-throughput real-time order book generation method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114549129A true CN114549129A (en) | 2022-05-27 |
Family
ID=81677002
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210164141.1A Pending CN114549129A (en) | 2022-02-22 | 2022-02-22 | Low-delay high-throughput real-time order book generation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114549129A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116226155A (en) * | 2023-05-08 | 2023-06-06 | 中信建投证券股份有限公司 | Data updating method and device, electronic equipment and storage medium |
CN118674531A (en) * | 2024-08-23 | 2024-09-20 | 浙商证券股份有限公司 | Method, system and device for rapidly realizing order simulation matching |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451091A (en) * | 2017-08-02 | 2017-12-08 | 上海金融期货信息技术有限公司 | High speed information interactive system based on FPGA CPU mixed architectures |
CN108269188A (en) * | 2016-12-30 | 2018-07-10 | 上海金融期货信息技术有限公司 | A kind of exchange's quotation information processing method and system based on FPGA |
CN108768983A (en) * | 2018-05-17 | 2018-11-06 | 上海金融期货信息技术有限公司 | Mass network bursty data dissemination system based on FPGA |
CN111861743A (en) * | 2020-06-29 | 2020-10-30 | 浪潮电子信息产业股份有限公司 | Method, device and equipment for reconstructing market quotation based on stroke-by-stroke data |
CN112200683A (en) * | 2020-10-20 | 2021-01-08 | 南京艾科朗克信息科技有限公司 | Financial market member end holographic market information acquisition method |
CN112561664A (en) * | 2020-12-28 | 2021-03-26 | 中国金融交易中心 | Electronic transaction processing system and method based on order combination |
CN113064884A (en) * | 2020-12-02 | 2021-07-02 | 上海金融期货信息技术有限公司 | Dual-source market repetition removing method and system based on user-defined hash |
-
2022
- 2022-02-22 CN CN202210164141.1A patent/CN114549129A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108269188A (en) * | 2016-12-30 | 2018-07-10 | 上海金融期货信息技术有限公司 | A kind of exchange's quotation information processing method and system based on FPGA |
CN107451091A (en) * | 2017-08-02 | 2017-12-08 | 上海金融期货信息技术有限公司 | High speed information interactive system based on FPGA CPU mixed architectures |
CN108768983A (en) * | 2018-05-17 | 2018-11-06 | 上海金融期货信息技术有限公司 | Mass network bursty data dissemination system based on FPGA |
CN111861743A (en) * | 2020-06-29 | 2020-10-30 | 浪潮电子信息产业股份有限公司 | Method, device and equipment for reconstructing market quotation based on stroke-by-stroke data |
CN112200683A (en) * | 2020-10-20 | 2021-01-08 | 南京艾科朗克信息科技有限公司 | Financial market member end holographic market information acquisition method |
CN113064884A (en) * | 2020-12-02 | 2021-07-02 | 上海金融期货信息技术有限公司 | Dual-source market repetition removing method and system based on user-defined hash |
CN112561664A (en) * | 2020-12-28 | 2021-03-26 | 中国金融交易中心 | Electronic transaction processing system and method based on order combination |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116226155A (en) * | 2023-05-08 | 2023-06-06 | 中信建投证券股份有限公司 | Data updating method and device, electronic equipment and storage medium |
CN118674531A (en) * | 2024-08-23 | 2024-09-20 | 浙商证券股份有限公司 | Method, system and device for rapidly realizing order simulation matching |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5871619B2 (en) | Method and apparatus for high-speed processing of financial market depth data | |
WO2022001131A1 (en) | Method and apparatus for reconstructing market quotations based on quote-by-quote data, and device | |
CN114549129A (en) | Low-delay high-throughput real-time order book generation method | |
McKnight | Information management: strategies for gaining a competitive advantage with data | |
CN105684020A (en) | An order book management device in a hardware platform | |
CN106155630A (en) | Sequencing method, unserializing method, serializing device and unserializing device | |
CN107832463A (en) | A kind of finance data service platform | |
CN112052385A (en) | Investment and financing project recommendation method and device, electronic equipment and readable storage medium | |
CN111897838B (en) | A transaction query method, device, electronic device and readable storage medium thereof | |
Doekemeijer et al. | Key-Value Stores on Flash Storage Devices: A Survey | |
US11099960B2 (en) | Dynamically adjusting statistics collection time in a database management system | |
CN118052545A (en) | Account data processing method and device | |
CN107239962A (en) | The matching process and system of multi-dimensional data unit in electronic information | |
CN115712654A (en) | Method and device for inquiring transaction state | |
CN110928680B (en) | Order memory allocation method suitable for securities trading system | |
CN113625967A (en) | Data storage method, data query method and server | |
CN115221174A (en) | Data grading storage method, device, equipment and medium based on artificial intelligence | |
US20060129594A1 (en) | Computer-implemented method for management of electronic data | |
Bento et al. | Some Illustrative Examples on the Use of Hash Tables | |
CN112131258B (en) | Data splicing method, device and equipment and computer storage medium | |
CN117591564B (en) | Graph data query method for graph database and related equipment | |
Hu | Discussion and Sample Test of Big Financial Data Applied to NoSQL Database | |
CN111815451B (en) | Method for rapidly accessing newspaper list items of securities counter based on FPGA | |
Gurianov et al. | Analysis of factors and trends in the DBMS market in Russia | |
Beck et al. | A high-frequency data repository for financial time series |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |