CN-122019259-A - Data recovery method for futures counter
Abstract
A method for recovering data of futures counter includes storing private stream data of exchange to local data file by counter in trade process, checking data when data is stored. And step S02, when the counter is restarted, the local data file is mapped to the memory, the counter recovers the private stream data from the memory, and the data is checked at the same time. And S03, after the local file data recovery is completed, subscribing and collecting the remained new private stream data from the exchange through the designated sequence number. And step S04, after the counter receives all old running water of the current transaction day, the counter recovers funds and the holding of the warehouse is finished, and the state is switched to be normal. The public stores the private stream data to the local file in real time during the transaction, and the local file data is preferentially transmitted during the recovery, and then the subsequent new private stream is received to the transaction exchange in a continuous transmission mode, so that the integrity and reliability of the data recovery are ensured, and the high efficiency of the data recovery is also ensured.
Inventors
- Qin Diexuan
- WANG LIUXIANG
Assignees
- 南京艾科朗克信息科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241106
Claims (9)
- 1. A method of data recovery for a futures counter, comprising the steps of: Step S01, in the transaction process, the counter stores private stream data of the exchange to a local data file, and checks the data while storing the data; Step S02, when the counter is restarted, the local data file is mapped to the memory, the counter recovers the private stream data from the memory, and the data is checked at the same time; S03, after the local file data recovery is completed, subscribing and collecting the remained new private stream data from the exchange through the appointed sequence number; And step S04, after the counter receives all old running water of the current transaction day, the counter recovers funds and the holding of the warehouse is finished, and the state is switched to be normal.
- 2. The method for recovering the data of the future counter according to claim 1, wherein in the step S01, the specific method for storing the private stream data of the exchange to the local data file by the counter during the transaction process is that after receiving the private stream return data of each exchange during the counter operation process, the counter processes the data into two parts, namely a data head and a data field, wherein the data head comprises a timestamp, the type of the exchange, the private stream serial number and checksum information, and the data field converts the private stream data of the exchange into a unified data structure in the counter for storage.
- 3. The method for recovering data of future counters according to claim 2, wherein in step S01, the private stream data of different exchanges are subjected to unified data structure conversion so as to achieve that the module can be compatible with the processing of the difference data of different exchanges, and meanwhile, the data head is added to record the private stream feature data.
- 4. The method for restoring data to a futures counter according to claim 2, wherein in step S01, the data header and the data field perform a checksum operation and the result is also stored in the data header.
- 5. The method for restoring the data of the future counter according to claim 2, wherein in step S02, the processed data is written into the specified file in a memory mapped manner, and the header information is updated, wherein the header information mainly comprises a file size and a maximum value of the recorded private stream sequence number.
- 6. The method for recovering data from a futures counter according to claim 5, wherein in step S02, each piece of private stream data is read, and the verification includes whether the time stamp and the stream number are incremented, whether the exchange type matches the counter after restarting, and the checksum is recalculated for each piece of private stream data and compared with the checksum recorded in the data header.
- 7. The method of claim 6, further comprising checking a next piece of private stream data if the checking is successful, recording the maximum private stream sequence number in the header of the file at the same time, stopping reading data from the local place if the checking is failed, and recording the current maximum private stream sequence number.
- 8. The method for recovering data of futures counter according to claim 7, wherein in step S03, after the local data recovery is completed, the counter subscribes the exchange to the private stream data of the subsequent serial number with the recorded recovered maximum private stream data serial number until the counter receives all the old private stream data, so as to complete the recovery of funds and holding the warehouse before restarting the counter.
- 9. The method of claim 8, wherein the counter assigns a serial number to the exchange to subscribe to the private stream data after the local data recovery is completed, and the exchange is allowed to transmit the subsequent private stream data.
Description
Data recovery method for futures counter Technical Field The invention belongs to the field of financial futures counters, and relates to a data recovery method of a futures counter. Background In a financial futures counter system, when a counter switches and restarts day and night or a person in the counter restarts, the counter needs to receive private flow data existing before the current trading day of a trading exchange to restore funds and a warehouse of the counter to be normal. However, when the transaction amount of the exchange is relatively large, the private stream data is usually in the level of millions or even tens of millions, if the existing private stream data is obtained from the exchange through the TCP for data recovery, the process depends on the network environment and is relatively time-consuming, and especially when the network environment is poor or the transaction system has flow control, the time consumption is more obvious, the data recovery efficiency of the counter is affected, and the transaction timeliness of investors at the counter is further affected. Disclosure of Invention 1. The technical problems to be solved are as follows: When a counter switches over to a day and night disk or a person in the disk is restarted, the private stream data is usually in the order of millions or even tens of millions, and all the data is recovered from the existing private stream acquired from the exchange through the TCP, which is dependent on the network environment and is time-consuming. 2. The technical scheme is as follows: in order to solve the above problems, the present invention provides a method for recovering data of a futures counter, comprising the following steps: And step S01, in the transaction process, the counter stores private stream data of the exchange to a local data file, and verifies the data while storing the data. And step S02, when the counter is restarted, the local data file is mapped to the memory, and the counter recovers the private stream data from the memory and verifies the data. And S03, after the local file data recovery is completed, subscribing and collecting the remained new private stream data from the exchange through the designated sequence number. And step S04, after the counter receives all old running water of the current transaction day, the counter recovers funds and the holding of the warehouse is finished, and the state is switched to be normal. In step S01, the specific method for the counter to store the private stream data of the exchange to the local data file in the transaction process is that after receiving the private stream return data of each exchange in the counter operation process, the counter processes the data into two parts, namely a data head and a data field, wherein the data head comprises a time stamp, the type of the exchange, the private stream serial number and checksum information, and the data field converts the private stream data of the exchange into a unified data structure in the counter for storage. In step S01, the private stream data of different exchanges are subjected to unified data structure conversion, so that the module can be compatible with the processing of the difference data of different exchanges. And simultaneously, a data head is added, and the private stream characteristic data is recorded. In step S01, the data header and the data field perform a checksum operation, and the result is also saved in the data header. In step S02, the processed data is written into the specified file in a memory mapping manner, and the header information is updated at the same time, where the header information mainly includes the file size and the maximum value of the recorded private stream sequence number. In step S02, each piece of private stream data is checked, including whether the time stamp and the stream number are incremented, whether the exchange type matches the counter after restarting, and the checksum is recalculated for each piece of private stream data and compared with the checksum of the record in the header. And if the verification of one piece of private stream data is successful, continuing to verify the next piece of private stream data until all private stream data are recovered, simultaneously recording the maximum private stream sequence number in the file header, and if the verification of one piece of private stream data fails, stopping reading data from the local, and simultaneously recording the current recovered maximum private stream data sequence number. In step S03, after the local data recovery is completed, the counter subscribes to the private stream data of the subsequent serial number from the exchange with the recorded recovered maximum private stream data serial number until the counter receives all the old private stream data, so as to complete the recovery of funds and holding the warehouse before restarting the counter. After the local data recovery is completed, the