Data recovery method for futures counter
By saving and verifying private stream data locally within the financial futures trading system, and combining local recovery with network retransmission methods, the problem of time-consuming data recovery under large data volumes is solved, achieving an efficient and reliable data recovery process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ACCELECOM INFORMATION & TECH CO LTD
- Filing Date
- 2024-11-06
- Publication Date
- 2026-05-12
AI Technical Summary
In financial futures trading systems, when the volume of private stream data is large, the time required to retrieve and restore data from the exchange via TCP is long, which affects trading efficiency, especially in poor network environments or when flow control is in place.
During the transaction, private stream data is saved to a local file and verified. Upon restart, the data is restored from local memory, and the remaining data is received by resuming transmission through a specified sequence number, thus combining local data recovery and network retransmission.
It improves the efficiency and reliability of data recovery, ensures transaction timeliness, and reduces the time consumption due to network dependence.
Smart Images

Figure CN122019259A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of financial futures counters and relates to a data recovery method for futures counters. Background Technology
[0002] In financial futures over-the-counter (OTC) systems, when the OTC trading session restarts after a day / night session or is manually restarted during trading hours, the OTC needs to receive existing private transaction data from the exchange prior to the current trading day to restore the OTC's funds and positions to normal. However, when the exchange's trading volume is high, private transaction data is typically in the millions or even tens of millions of units. If all data recovery is done by retrieving existing private transaction data from the exchange via TCP, this process is dependent on the network environment and is quite time-consuming. This is especially true when the network environment is poor or the trading system has flow control measures in place, which significantly increases the time consumption and affects the OTC's data recovery efficiency, further impacting investors' trading efficiency at the OTC. Summary of the Invention
[0003] 1. The technical problem to be solved: When the trading session restarts between day and night or is manually restarted during trading hours, the private flow data is usually in the millions or even tens of millions. All of this data is recovered by retrieving the existing private flow data from the exchange via TCP. This process depends on the network environment and is relatively time-consuming.
[0004] 2. Technical Solution: To address the above problems, this invention provides a data recovery method for futures trading platforms, comprising the following steps: Step S01: During the transaction process, the counter saves the exchange's private transaction data to a local data file and verifies the data while saving it.
[0005] Step S02: When the counter restarts, the local data file is first mapped to memory. The counter restores the private stream data from memory and verifies the data at the same time.
[0006] Step S03: After the local file data is restored, subscribe to the exchange using the specified sequence number to collect the remaining new private stream data.
[0007] Step S04: After the counter has received all the old transaction records for the current trading day, the counter resumes fund and position management and the status switches to normal.
[0008] In step S01, during the transaction process, the counter saves the private transaction data of the exchange to a local data file as follows: After receiving each private transaction data report from the exchange during the counter's operation, the data is processed into two parts: a data header and a data field; the data header includes a timestamp, exchange type, private transaction sequence number, and checksum information; the data field converts the private transaction data of the exchange into a unified data structure within the counter for storage.
[0009] In step S01, a unified data structure conversion is performed on the private flow data from different exchanges to ensure that the module can handle the differences in data from different exchanges. Simultaneously, a data header is added to record the private flow characteristic data.
[0010] In step S01, the data header and data field are checked and the result is also saved in the data header.
[0011] In step S02, the processed data is written to a specified file using memory mapping, and the file header information is updated. This file header information mainly includes the file size and the maximum value of the private stream sequence number of the record.
[0012] In step S02, each private stream data read is verified. The verification includes whether the timestamp and stream sequence number are incrementing and whether the exchange type matches the restarted counter. At the same time, the checksum of each private stream data read is recalculated and compared with the checksum of the record in the data header.
[0013] If all private stream data verifications are successful, continue verifying the next one until all private stream data is recovered. At the same time, record the maximum private stream sequence number in the file header. If any verification fails, stop reading data from the local machine, and also record the current maximum recovered private stream sequence number.
[0014] In step S03, after the local data recovery is completed, the counter subscribes to the exchange for the private stream data with the largest recorded recovery sequence number, until the counter has received all the old private stream data, thus completing the recovery of funds and positions before the counter restarts.
[0015] After the local data recovery is complete, the counter subscribes to the private flow data from the exchange using a specified sequence number, allowing the exchange to continue transmitting subsequent private flow data.
[0016] 3. Beneficial effects: This invention discloses a data recovery method for futures trading platforms. During trading, private transaction data is saved to a local file in real time. During recovery, the local file data is used first, and then new private transaction data is received from the exchange through a retransmission method. This method ensures both the integrity and reliability of data recovery, as well as its high efficiency. Attached Figure Description
[0017] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0018] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] like Figure 1 As shown, a data recovery method for a futures trading platform includes the following steps: Step S01: During the transaction process, the counter saves the exchange's private transaction data to a local data file and verifies the data while saving it.
[0020] Step S02: When the counter restarts, the local data file is first mapped to memory. The counter restores the private stream data from memory and verifies the data at the same time.
[0021] Step S03: After the local file data is restored, subscribe to the exchange using the specified sequence number to collect the remaining new private stream data.
[0022] Step S04: After the counter has received all the old transaction records for the current trading day, the counter resumes fund and position management and the status switches to normal.
[0023] In one embodiment, in step S01, after receiving each private flow return data from the exchange during the counter operation, the data is processed into two parts: a data header and a data field. The data header includes information such as timestamp, exchange type, private flow sequence number, and checksum. The data field is used to convert the private flow data of the exchange into a unified data structure within the counter for storage. A checksum operation is performed on the data header and the data field, and the result is also saved in the data header. In one embodiment, the data processed in step S01 is written to a specified file using memory mapping, and the file header information is updated simultaneously. This file header information mainly includes the file size and the maximum value of the private stream sequence number of the record.
[0024] In one embodiment, when the counter restarts, the saved private stream file is first mapped into memory, and then the private stream data is read from memory one by one. In one embodiment, each private stream data read is validated: the validation includes whether the timestamp and stream sequence number are incrementing, and whether the exchange type matches the restarted counter; simultaneously, the checksum of each private stream data read is recalculated and compared with the checksum recorded in the data header. If all the above validations are successful, the validation continues for the next private stream data until all data is restored, while recording the maximum private stream sequence number in the file header.
[0025] If a certain verification fails, it indicates that the saved data is abnormal. Data reading from the local machine will be stopped, and the sequence number of the largest private stream data being recovered will also be recorded.
[0026] In one embodiment, after local data recovery is complete, the counter subscribes to the exchange for private stream data with the private stream sequence number that is recovered the largest recorded number, until the counter has received all the old private stream data, thus completing the recovery of funds and positions before the counter restarts.
Claims
1. A data recovery method for futures trading platforms, comprising the following steps: Step S01: During the transaction process, the counter saves the exchange's private transaction data to a local data file and verifies the data while saving it. Step S02: When the counter restarts, the local data file is first mapped to memory. The counter restores the private stream data from memory and verifies the data at the same time. Step S03: After the local file data recovery is complete, subscribe to the exchange using the specified sequence number to collect the remaining new private stream data; Step S04: After the counter has received all the old transaction records for the current trading day, the counter resumes fund and position management and the status switches to normal.
2. The data recovery method for futures counters as described in claim 1, characterized in that: In step S01, during the transaction process, the counter saves the private transaction data of the exchange to a local data file as follows: After receiving each private transaction data report from the exchange during the counter's operation, the data is processed into two parts: a data header and a data field; the data header includes a timestamp, exchange type, private transaction sequence number, and checksum information; the data field converts the private transaction data of the exchange into a unified data structure within the counter for storage.
3. The data recovery method for futures counters as described in claim 2, characterized in that: In step S01, the private flow data from different exchanges is transformed into a unified data structure so that the module can be compatible with the processing of different exchange data. At the same time, a data header is added to record the private flow characteristic data.
4. The data recovery method for futures counters as described in claim 2, characterized in that: In step S01, the data header and data field are checked and the result is also saved in the data header.
5. The data recovery method for futures counters as described in claim 2, characterized in that: In step S02, the processed data is written to a specified file using memory mapping, and the file header information is updated. This file header information mainly includes the file size and the maximum value of the private stream sequence number of the record.
6. The data recovery method for futures counters as described in claim 5, characterized in that: In step S02, each private stream data read is verified. The verification includes whether the timestamp and stream sequence number are incrementing and whether the exchange type matches the restarted counter. At the same time, the checksum of each private stream data read is recalculated and compared with the checksum of the record in the data header.
7. The data recovery method for futures counters as described in claim 6, characterized in that: If all private stream data verifications are successful, continue verifying the next one until all private stream data is recovered. At the same time, record the maximum private stream sequence number in the file header. If any verification fails, stop reading data from the local machine, and also record the current maximum recovered private stream sequence number.
8. The data recovery method for futures counters as described in claim 7, characterized in that: In step S03, after the local data recovery is completed, the counter subscribes to the exchange for the private stream data with the largest recorded recovery sequence number, until the counter has received all the old private stream data, thus completing the recovery of funds and positions before the counter restarts.
9. The data recovery method for futures counters as described in claim 8, characterized in that: After the local data recovery is complete, the counter subscribes to the private flow data from the exchange using a specified sequence number, allowing the exchange to continue transmitting subsequent private flow data.