Data operation method and device

By using time index in the circular buffer to process market data, the problem of low efficiency in market data operation in the existing technology is solved, rapid access and writing are achieved, and the efficiency of market data processing is improved.

CN114035974BActive Publication Date: 2024-12-06HANGZHOU LONGBU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111198050.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-14
Publication Date
2024-12-06
Estimated Expiration
2041-10-14

AI Technical Summary

Technical Problem

In the prior art, the processing efficiency of market data is low, mainly due to frequent memory applications and releases and traversal of linked list operations, resulting in low efficiency in searching and modifying market data.

Method used

The circular buffer is used to store the market data, and by converting the time information into an index, it realizes quick access and write operations based on the index, avoiding the process of traversing the linked list.

Benefits of technology

Improve the operation efficiency of market data, directly accessing or writing data in the circular buffer through indexes, reducing the frequency of memory application and release, and improving the speed of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114035974B_ABST
    Figure CN114035974B_ABST
Patent Text Reader

Abstract

The present application discloses a data operation method and device, which relates to the field of Internet technology, in order to solve the technical problem that the existing technology has low efficiency in operating market data. The data operation method comprises: receiving an operation instruction; based on the operation instruction, obtaining market data, the market data comprises first time information and a first price corresponding to the first time information; converting the first time information into a first index corresponding to the first time information; based on the first time information and the first index, performing a target operation on the data at a position corresponding to the first index in a circular buffer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of Internet technology, and specifically relates to a data operation method and device. Background Art

[0002] In the securities industry, market data is the basic data of all data analysis systems. The changes in the quotation information of each security are data reflections of market changes. These data are used as references by investors during the investment process, thus directly affecting investors' investment behavior. In this context, how to process market data more efficiently has become a major problem faced by technical personnel in the industry.

[0003] Since market data has a large amount of data and is updated quickly, in the prior art, linked lists are often used to store market data.

[0004] However, this method of processing market data requires frequent memory allocation and release, and each time a market data is searched or modified, a linked list needs to be traversed, which results in low efficiency in operating market data.

[0005] Application Contents

[0006] The embodiments of the present application provide a data operation method and device, which can solve the problem of low efficiency in operating market data.

[0007] In a first aspect, an embodiment of the present application provides a data transmission method, the method comprising:

[0008] Receive operation instructions;

[0009] Based on the operation instruction, obtain market data, the market data including first time information and a first price corresponding to the first time information;

[0010] Converting the first time information into a first index corresponding to the first time information;

[0011] Based on the first time information and the first index, a target operation is performed on data at a position corresponding to the first index in the circular buffer.

[0012] Optionally, in one embodiment, the operation instruction is a read operation instruction, and the target operation performed on the data at the position corresponding to the first index in the circular buffer based on the first time information and the first index includes: based on the first index, obtaining a target timestamp of the data at the position corresponding to the first index in the circular buffer; determining whether the first time information matches the target timestamp; if the first time information matches the target timestamp, obtaining the data at the position corresponding to the first index in the circular buffer; and outputting the obtained data.

[0013] Optionally, in one embodiment, the operation instruction is a write operation instruction, and the performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index includes:

[0014] Determine whether the first time information is greater than the last update time, and whether the last update time is 0;

[0015] When the first time information is greater than the last update time and the last update time is not 0, the first price is written to the position corresponding to the first index in the circular buffer, and when there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, the market data corresponding to the last update is written into the blank part.

[0016] Optionally, in one embodiment, performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index also includes: writing the first price to a position corresponding to the first index in the circular buffer when the first time information is less than or equal to the last update time and the last update time is not 0.

[0017] Optionally, in one embodiment, converting the first time information into a first index corresponding to the first time information includes: obtaining a first timestamp corresponding to the first time information; obtaining a difference between the first timestamp and a preset reference timestamp; and obtaining a first index corresponding to the first time information based on the difference and the price cache time granularity.

[0018] Optionally, in one embodiment, the data in the circular buffer is stored in the form of an array, and the elements in the array all have an index; before receiving the operation instruction, the data operation method also includes: initializing the elements in the array in the circular buffer to assign values ​​to the elements in the array.

[0019] In a second aspect, an embodiment of the present application provides a data operation device, the device comprising:

[0020] A receiving module, used for receiving an operation instruction;

[0021] An acquisition module, configured to acquire market data based on the operation instruction, wherein the market data includes first time information and a first price corresponding to the first time information;

[0022] A conversion module, configured to convert the first time information into a first index corresponding to the first time information;

[0023] A processing module is used to perform a target operation on data at a position corresponding to the first index in a circular buffer based on the first time information and the first index.

[0024] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0025] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0026] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0027] In an embodiment of the present application, an operation instruction is received; based on the operation instruction, market data is obtained, the market data includes first time information and a first price corresponding to the first time information; the first time information is converted into a first index corresponding to the first time information; based on the first time information and the first index, a target operation is performed on the data at a position corresponding to the first index in the circular buffer. In this way, the circular buffer can be used to realize the circular writing of market data, and the time information in the market data can be converted into a general index for the circular buffer, so that the market data at the corresponding position in the circular buffer can be accessed based on the time index, or the market data can be written into the corresponding position in the circular buffer, thereby improving the operation efficiency of the market data. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0029] Figure 1 is a flow chart of a data operation method provided in an embodiment of the present application;

[0030] Figure 2 is a flow chart of another data operation method provided in an embodiment of the present application;

[0031] Figure 3 is a flow chart of another data operation method provided in an embodiment of the present application;

[0032] Figure 4 It is a flow chart of a data operation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0034] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.

[0035] The data operation method and device provided in the embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0036] Figure 1 1 is a flow chart of a data operation method provided in an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides a data operation method, and the execution subject of the method can be a terminal device. Among them, the terminal device can be a computer device, and the computer device can be composed of a single server or a server group composed of multiple servers. The data operation method provided in the embodiment of the present application can specifically include the following steps:

[0037] Step 110, receiving an operation instruction;

[0038] The operation instruction may be a read operation instruction or a write operation instruction.

[0039] In step 110, the server may receive the operation instruction in various ways. For example, the server responds to the update writing of the market source, or the server responds to the data reading requested by the client. After receiving the operation instruction, the server continues to execute the subsequent steps.

[0040] Step 120, based on the operation instruction, obtaining market data, the market data including first time information and a first price corresponding to the first time information;

[0041] Optionally, in one embodiment of the present application, when the acquired operation instruction is a write operation instruction, the server may acquire market data, wherein the market data includes first time information and a first price corresponding to the first time information. The market data may reflect the real-time trading price of the stock, for example, the price of Ping An of China at 10:00:00 on October 8, 2020 is 10 yuan per share. Similarly, when the acquired operation instruction is a read operation instruction, the server may also acquire market data, wherein the market data includes first time information and a first price corresponding to the first time information, and the first price may be valueless, that is, the previous data is read directly through the first time information.

[0042] In the embodiment of the present application, the first time information may be current time information or historical time information.

[0043] The first time information in the embodiment of the present application can have a variety of different formats. The first time information can be in the format of year, month, day, hour, minute, and second, or in the format of a timestamp. The timestamp refers to the number of seconds that have passed since January 1, 1970, ignoring leap seconds. For example, the timestamp corresponding to 0:00 on July 1, 2020 can be, for example, 1593532800.

[0044] Optionally, in one embodiment of the present application, the market data may also include a data identifier of an object (such as a stock). Specifically, different data identifiers may be assigned to different stocks. For example, the data identifier of the stock named Metersbonwe is determined to be A, and the data identifier of the stock named Ping An of China is determined to be B. The data identifier may also directly use the stock code (such as 600910), so that it is possible to determine which stock the acquired market data belongs to based on the data identifier, which facilitates targeted processing.

[0045] Step 130, converting the first time information into a first index corresponding to the first time information;

[0046] Optionally, in an embodiment of the present application, converting the first time information into a first index corresponding to the first time information may include: obtaining a first timestamp corresponding to the first time information, obtaining a difference between the first timestamp and a preset reference timestamp, and obtaining an index corresponding to the first time information based on the difference and the price cache time granularity. Among them, the use of the reference time can reduce the index size, the price cache time granularity can be a preset minimum update time interval, and the value of the preset price cache time granularity can be 3-10 seconds, for example, 3 seconds. Of course, the value of the price cache time granularity can also be set according to user needs.

[0047] Take the market data for stocks as an example. Specifically, since stocks are always in trading after opening, there will be new market data for each transaction, and users often pay attention to the latest stock market data, so the price cache time granularity can be preset to only save the market data after the preset update time interval. The price cache time granularity of 3 seconds is used as an example for explanation below. Since the stock opens at 9:30 on weekdays, the base timestamp can be determined to be 1628127000 (for example, corresponding to Beijing time: August 5, 2021 09:30:00). The server obtains three market data of stock A, 10.2 yuan per share at 09:30:01 on August 5, 2021, 10.5 yuan per share at 09:30:02 on August 5, 2021, and 10.4 yuan per share at 09:30:03 on August 5, 2021. At this time, according to the 3-second price cache time granularity, only the market data of 10.4 yuan per share at 09:30:03 on August 5, 2021 needs to be written into the circular buffer. Get the timestamp 1628127003 corresponding to the time information 09:30:03 on August 5, 2021, and subtract the base timestamp to get the difference 3. You can get the index value based on the remainder of the difference divided by the price cache time granularity. For example, if the difference is 3 and the price cache time granularity is 3 seconds, the remainder is 1. Continue to execute subsequent steps with 1 as the index value.

[0048] Step 140: Perform a target operation on data at a position corresponding to the first index in a circular buffer based on the first time information and the first index.

[0049] Optionally, in an embodiment of the present application, data in a circular buffer is stored in the form of an array, and array elements can be accessed through non-negative integers (for example, integers such as 0, 1, 2, 3, etc.). When initializing the array, all elements in the array are assigned uniformly. After obtaining the first index corresponding to the first time information, the array element can be accessed based on the first index, or the array element value can be modified. In the prior art, if you want to find / modify a data in a linked list, you can only traverse the linked list, and the efficiency of data operations is low. Random and fast reading and writing is an important feature of an array. Using array indexes, you can directly access / modify data in a circular buffer without traversal, which can improve the efficiency of data operations.

[0050] The embodiment of the present application provides a data operation method, receiving an operation instruction; based on the operation instruction, obtaining market data, the market data including first time information and a first price corresponding to the first time information; converting the first time information into a first index corresponding to the first time information; based on the first time information and the first index, performing a target operation on the data at a position corresponding to the first index in a circular buffer. In this way, the circular buffer can be used to realize the circular writing of market data, and the time information corresponding to the market data can be converted into a universal index of the circular buffer, so that the market data at the corresponding position in the circular buffer can be accessed based on the time index, or the market data can be written into the corresponding position in the circular buffer, thereby improving the operation efficiency of the market data.

[0051] Figure 2 is a flow chart of another data operation method provided in an embodiment of the present application. Figure 2 , the data operation method provided in the embodiment of the present application may include:

[0052] Step 210, receiving a read operation instruction;

[0053] Step 220, obtaining first time information based on the read operation instruction;

[0054] Step 230, converting the first time information into an index corresponding to the first time information;

[0055] Step 240, based on the first index, obtaining a target timestamp of data at a position corresponding to the first index in the circular buffer;

[0056] Step 250, determining whether the first time information matches the target timestamp;

[0057] Optionally, in an embodiment of the present application, the first time information matches the target timestamp may mean that the difference between the first time information and the target timestamp is not greater than a preset price cache time granularity, and the first time information does not match the target timestamp may mean that the difference between the first time information and the target timestamp is greater than a preset price cache time granularity. Specifically, for example, it can be determined that the base timestamp is 1628127000 (Beijing time: August 5, 2021 09:30:00), the price cache time granularity is 3 seconds, and the market data has been written into the circular buffer at 09:30:03 on August 5, 2021 (the corresponding timestamp is 1628127003, and the corresponding index is 1) at 10.4 yuan per share. The first time information is August 5, 2021 09:30:04 (the corresponding timestamp is 1628127004, and the corresponding index is 1), 1628127004-1628127003<3 (the value of the price cache time granularity), then the first time information matches the target timestamp.

[0058] Step 260: When the first time information matches the target timestamp, obtain data at a position corresponding to the first index in the circular buffer;

[0059] Optionally, in the embodiment of the present application, the first time information matches the target timestamp, indicating that the data at the position corresponding to the first index is valid data, and the corresponding data can be obtained. The first time information does not match the target timestamp, indicating that the data at the position corresponding to the first index is invalid data, and the corresponding data can be not obtained.

[0060] Step 270: output the acquired data.

[0061] Optionally, in an embodiment of the present application, when the first time information matches the target timestamp, valid data obtained through the first index is output; when the first time information does not match the target timestamp, no data may be output or a prompt may be given that the first time information does not match the target timestamp.

[0062] The embodiment of the present application determines whether the data stored in the circular buffer is valid data by determining whether the first time information matches the target timestamp, and when the first time information matches the target timestamp, obtains the valid data at the corresponding position of the circular buffer through the first index converted from the first time information, and when the first time information does not match the target timestamp, no data may be output or a prompt may be given that the first time information does not match the target timestamp. In this way, valid data can be quickly obtained through the time index, invalid data can be avoided, the efficiency of data reading operations is improved, and the accuracy of the data is ensured.

[0063] Figure 3is a flow chart of another data operation method provided in an embodiment of the present application. Figure 3 , the data operation method provided in the embodiment of the present application may include:

[0064] Step 310, receiving a write operation instruction;

[0065] Step 320: acquiring market data based on the write operation instruction, the market data including first time information and a first price corresponding to the first time information;

[0066] Step 330, determining whether the first time information is greater than the last update time, and whether the last update time is 0;

[0067] It can be understood that the last update time corresponds to the time information of the latest market data written into the circular buffer, such as a timestamp. If the last update time is 0, it means that no market data has been written into the circular buffer after the circular buffer is initialized, and the circular buffer is in the initial state. If the last update time is not 0, it means that market data has been written into the circular buffer after the circular buffer is initialized. If the first time information is greater than the last update time, it means that the market data has been updated and needs to be written into the circular buffer. If the first time information is less than or equal to the last update time, it means that the market data at this time is old data.

[0068] Step 340, when the first time information is greater than the last update time and the last update time is not 0, write the first price to the position corresponding to the first index in the circular buffer, and when there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, write the market data corresponding to the last update into the blank part.

[0069] In an embodiment of the present application, a blank portion may indicate that no new price appears for a specific object (e.g., a specific stock) within a certain period of time. In order to ensure that the market data in the circular buffer is continuous in time, it may be filled. In the case of a blank portion, the market data corresponding to the last update is written into the blank portion; specifically, the price corresponding to the last update may be written into the position corresponding to each index of the blank portion, and at the same time, the time information corresponding to each index may be written into the position corresponding to each index of the blank portion to ensure the continuity of time. It is pointed out here that the time information corresponding to each index may be different. The difference between the time information corresponding to two adjacent indexes may be the price cache time granularity. Specifically, if the base timestamp is 1628127000 (Beijing time: August 5, 2021 09:30:00), the price cache time granularity is 3 seconds, and the last updated market data was 09:30:03 on August 5, 2021 (corresponding timestamp is 1628127003) at 10.4 yuan per share, then the last update time is 1628127003, and the corresponding index value is 1. The first time information is 09:30:12 on August 5, 2021 (corresponding to the timestamp 1628127012), and the corresponding first price is 11 yuan per share. The index value corresponding to the first time information is 4, so the market data corresponding to the first time information is written to the index value 4 in the circular buffer, and the market data of 09:30:06 on August 5, 2021 (corresponding to the timestamp 1628127006, time index 2) is 10.4 yuan per share. Write the market data of 09:30:09 on August 5, 2021 (corresponding to the timestamp 1628127009, time index 3) is 10.4 yuan per share. Write the index value 3 in the circular buffer. After writing is completed, modify the last update time to the time information corresponding to the latest market data (in this example, the timestamp is 1628127012).

[0070] Optionally, in an embodiment of the present application, when the first time information is less than or equal to the last update time and the last update time is not 0, the first price is written to a position in the circular buffer corresponding to the first index.

[0071] Optionally, in an embodiment of the present application, the first time information is less than or equal to the last update time and the last update time is not 0, indicating that the market data at this time is old data before the last update time, and the market data only needs to be written to the position corresponding to the first index obtained after the first time information is converted. Specifically, if the last updated market data was 09:30:12 on August 5, 2021 (corresponding timestamp is 1628127012, time index is 4) and the price was 11 yuan per share, then the last update time is 1628127012, and the first time information is 09:30:09 on August 5, 2021 (corresponding timestamp is 1628127009, time index is 3) The corresponding first price is 10.4 yuan per share, then the market data corresponding to the first time information is directly written to the position with index value 3 in the circular buffer.

[0072] Optionally, in the embodiment of the present application, the last update time is 0, indicating that it is the first time to write market data to the circular buffer. The market data can be directly written to the location pointed to by the first index based on the first index obtained after the first time information in the market data is converted, and the update time is modified to the first time information (for example, in the form of a timestamp).

[0073] In the embodiment of the present application, it is determined whether the first time information is greater than the last update time and whether the last update time is 0; when the first time information is greater than the last update time and the last update time is not 0, the first price is written to the position corresponding to the first index in the circular buffer, and when there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, the market data corresponding to the last update is written to the blank part; when the first time information is less than or equal to the last update time and the last update time is not 0, the first price is written to the position corresponding to the first index in the circular buffer. In this way, market data can be written to the corresponding position in the circular buffer through the time index, thereby improving the writing efficiency of market data. After the market data is updated, if there is a blank part in the circular buffer, the price corresponding to the last update is written to the position corresponding to each index of the blank part, and the time information corresponding to each index can be written to the position corresponding to each index of the blank part, thereby ensuring that the market data stored in the circular buffer is continuous in time.

[0074] Figure 4 This is a structural block diagram of a data operation device provided in an embodiment of the present application. Figure 4 A data operation device 400 provided in an embodiment of the present application may include: a receiving module 410, an acquisition module 420, a conversion module 430 and a processing module 440.

[0075] The receiving module 410 is used to receive an operation instruction;

[0076] An acquisition module 420, configured to acquire market data based on the operation instruction, wherein the market data includes first time information and a first price corresponding to the first time information;

[0077] A conversion module 430, configured to convert the first time information into a first index corresponding to the first time information;

[0078] The processing module 440 is used to perform a target operation on the data at a position corresponding to the first index in the circular buffer based on the first time information and the first index.

[0079] The embodiment of the present application provides a data operation device, which receives an operation instruction; based on the operation instruction, obtains market data, the market data includes first time information and a first price corresponding to the first time information; converts the first time information into a first index corresponding to the first time information; based on the first time information and the first index, performs a target operation on the data at a position corresponding to the first index in a circular buffer. In this way, the circular buffer can be used to realize the circular writing of market data, and the time information corresponding to the market data can be converted into a universal index of the circular buffer, so that the market data at the corresponding position in the circular buffer can be accessed based on the time index, or the market data can be written into the corresponding position in the circular buffer, thereby improving the operation efficiency of the market data.

[0080] Optionally, in one embodiment, the operation instruction is a read operation instruction, and in the process of performing a target operation on the data at a position corresponding to the first index in the circular buffer based on the first time information and the first index, the processing module 440 is specifically used to: based on the first index, obtain a target timestamp of the data at the position corresponding to the first index in the circular buffer; determine whether the first time information matches the target timestamp; if the first time information matches the target timestamp, obtain the data at the position corresponding to the first index in the circular buffer; and output the obtained data.

[0081] Optionally, in one embodiment, the operation instruction is a write operation instruction, and in the process of performing a target operation on the data at a position corresponding to the first index in the circular buffer based on the first time information and the first index, the processing module 440 is used to: determine whether the first time information is greater than the last update time, and whether the last update time is 0; if the first time information is greater than the last update time and the last update time is not 0, write the first price to the position corresponding to the first index in the circular buffer, and if there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, write the market data corresponding to the last update into the blank part.

[0082] Optionally, in one embodiment, in the process of performing a target operation on the data at a position corresponding to the first index in the circular buffer based on the first time information and the first index, the processing module 440 is also used to: when the first time information is less than or equal to the last update time and the last update time is not 0, write the first price to the position corresponding to the first index in the circular buffer.

[0083] Optionally, in one embodiment, in the process of converting the first time information into a first index corresponding to the first time information, the conversion module 430 is specifically used to: obtain a first timestamp corresponding to the first time information; obtain the difference between the first timestamp and a preset reference timestamp; based on the difference and the price cache time granularity, obtain a first index corresponding to the first time information.

[0084] Optionally, in one embodiment, the data in the circular buffer is stored in the form of an array, and the elements in the array all have an index; the processing module 440 is also used to: initialize the elements in the array in the circular buffer before receiving an operation instruction to assign values ​​to the elements in the array.

[0085] It should be noted that the data operation device provided in the embodiment of the present application corresponds to the data operation method mentioned above. The relevant contents can refer to the description of the data operation method above, which will not be repeated here.

[0086] An embodiment of the present application also provides a terminal device, which includes a memory and a processor. The memory stores a program, and when the program is executed by the processor, any data operation method provided in the above embodiment of the present application is implemented.

[0087] An embodiment of the present application also provides a storage medium, which includes a memory and a processor. The memory stores a program, and when the program is executed by the processor, any data operation method provided in the embodiment of the present application is implemented.

[0088] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0089] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0090] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0091] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0092] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0093] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0094] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0095] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0096] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A data operation method, characterized in that: include: Receive operation instructions; Based on the operation instruction, obtain market data, the market data including first time information and a first price corresponding to the first time information; Converting the first time information into a first index corresponding to the first time information; Based on the first time information and the first index, perform a target operation on data at a position corresponding to the first index in the circular buffer; When the operation instruction is a write operation instruction, performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index includes: Determine whether the first time information is greater than the last update time, and whether the last update time is 0; When the first time information is greater than the last update time and the last update time is not 0, the first price is written into the position corresponding to the first index in the circular buffer, and when there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, the market data corresponding to the last update is written into the blank part; When the first time information is less than or equal to the last update time and the last update time is not 0, the first price is written into the position corresponding to the first index in the circular buffer.

2. The data operation method according to claim 1, characterized in that: When the operation instruction is a read operation instruction, performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index includes: Based on the first index, obtaining a target timestamp of data at a position corresponding to the first index in the circular buffer; determining whether the first time information matches the target timestamp; When the first time information matches the target timestamp, acquiring data at a position corresponding to the first index in the circular buffer; The acquired data is output.

3. The data operation method according to claim 1, characterized in that: The converting the first time information into a first index corresponding to the first time information comprises: Obtaining a first timestamp corresponding to the first time information; Obtaining a difference between the first timestamp and a preset reference timestamp; Based on the difference and the price cache time granularity, a first index corresponding to the first time information is obtained.

4. The data operation method according to claim 1, characterized in that: The data in the circular buffer is stored in the form of an array, and each element in the array has an index; Before receiving the operation instruction, the data operation method further includes: Initialize the elements in the array in the circular buffer to assign values ​​to the elements in the array.

5. A data operation device, characterized in that: The data operation device comprises: A receiving module, used for receiving an operation instruction; An acquisition module, configured to acquire market data based on the operation instruction, wherein the market data includes first time information and a first price corresponding to the first time information; A conversion module, configured to convert the first time information into a first index corresponding to the first time information; a processing module, configured to perform a target operation on data at a position corresponding to the first index in a circular buffer based on the first time information and the first index; When the operation instruction is a write operation instruction, in a process of performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index, the processing module is used to: Determine whether the first time information is greater than the last update time, and whether the last update time is 0; When the first time information is greater than the last update time and the last update time is not 0, the first price is written into the position corresponding to the first index in the circular buffer, and when there is a blank part between the first index and the target index corresponding to the last update in the circular buffer, the market data corresponding to the last update is written into the blank part; When the first time information is less than or equal to the last update time and the last update time is not 0, the first price is written into the position corresponding to the first index in the circular buffer.

6. The data operation device according to claim 5, characterized in that: The operation instruction is a read operation instruction. In a process of performing a target operation on data at a position corresponding to the first index in the circular buffer based on the first time information and the first index, the processing module is specifically used to: Based on the first index, obtaining a target timestamp of data at a position corresponding to the first index in the circular buffer; determining whether the first time information matches the target timestamp; When the first time information matches the target timestamp, acquiring data at a position corresponding to the first index in the circular buffer; The acquired data is output.