Market data processing method and device, equipment and storage medium
By obtaining and constructing real-time market data at the current running moment in the operation of the target quantitative strategy, the problem of asynchronous calculation and pushing of K-line data during different periods of market data is solved, and the synchronization of data and resource saving effect is achieved.
Patent Information
- Application Number
- CN202411928519.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-05-30
AI Technical Summary
In the prior art, the asynchronous calculation and asynchronous push of K-line data of different periods of market data lead to the asynchronous data of tens of ms when the client receives the K-line data, resulting in the quantitative strategy having a judgment logic error near the point when the new K-line data is generated.
By responding to the operation of the target quantization strategy, obtain the current running time, the operating target and the target time unit; determine whether the current time is the starting time point of the target time unit; if so, obtain the first market data from the cache data; if the first market data is not real-time data, obtain the second market data of the candidate time unit from the cache, and construct the real-time market data of the target time unit; execute the quantitative strategy based on the constructed real-time market data.
The synchronization of K-line data in different periods is achieved, which avoids the construction of unnecessary market data, saves computing resources and server bandwidth, and ensures the real-time and accuracy of the data.
Smart Images

Figure CN120070046A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of financial information processing, and particularly relates to a method, device, equipment and storage medium for processing market data. Background Art
[0002] K-line data (i.e., market data) is derived from the original tick-by-tick transaction data of the exchange by each data provider. Due to the large amount of K-line data and the need for frequent pushing, in order to save server costs, the K-line data of each period is usually separated, and the K-line data of different periods are subscribed and pushed separately. However, the market transaction changes in real time, and the asynchronous calculation and asynchronous pushing of the K-line data of each period result in a data asynchrony of dozens of milliseconds when the client receives the K-line data. As a result, the quantization strategy has a judgment logic error near the time point when a new K-line data is generated. This leads to the inability to push data in time at the closing moment and the inability to synchronize the K-line data of different periods. Therefore, there is an urgent need for a way to solve the above problems. Summary of the Invention
[0003] The embodiments of this application provide an implementation different from the prior art to solve the technical problems of the non-synchronization of K-line data of different periods at the closing moment and the untimely pushing of K-line data at the closing moment.
[0004] In a first aspect, this application provides a method for processing market data, including: in response to the running operation of a target quantization strategy, obtaining the current running time, the running target in the target quantization strategy, and the target time unit of the market data subscribed in the target quantization strategy; obtaining the resource category of the running target, and determining whether the current running time is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule; if so, obtaining the first market data corresponding to the running target and the target time unit from the cached data; if the first market data is not the real-time market data of the running target at the current running time, obtaining the second market data corresponding to the running target and the candidate time unit at the current running time from the cached data, and constructing the real-time market data of the running target at the target time unit at the current running time according to the second market data; and executing the target quantization strategy based on the real-time market data of the running target at the target time unit at the current running time.
[0005] In a second aspect, the present application provides a device for processing market data, including: an acquisition unit, configured to acquire, in response to an operation of running a target quantitative strategy, the current running time, the running target in the target quantitative strategy, and the target time unit of the market data subscribed in the target quantitative strategy; a determination unit, configured to acquire the resource category of the running target, and determine whether the current running time is a starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule; the acquisition unit is further configured to, if so, acquire first market data corresponding to the running target and the target time unit from the cached data; the acquisition unit is further configured to, if the first market data is not the real-time market data of the running target at the current running time, acquire second market data corresponding to the running target and a candidate time unit at the current running time from the cached data, and construct the real-time market data of the running target at the target time unit at the current running time according to the second market data; an execution unit, configured to execute the target quantitative strategy based on the real-time market data of the running target at the target time unit at the current running time.
[0006] In a third aspect, the present application provides an electronic device, including: a processor; and a memory, configured to store executable instructions of the processor; wherein, the processor is configured to execute any method in the first aspect or any possible implementation manner of the first aspect by executing the executable instructions.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any method in the first aspect or any possible implementation manner of the first aspect is implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, any method described in the first aspect or any possible implementation manner of the first aspect is implemented.
[0009] The solution provided by this application obtains the current running time, the running target in the target quantization strategy, and the target time unit of the market data subscribed in the target quantization strategy in response to the running operation of the target quantization strategy; obtains the resource category of the running target, and determines whether the current running time is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule; if so, obtains the first market data corresponding to the running target and the target time unit from the cached data; if the first market data is not the real-time market data of the running target at the current running time, obtains the second market data corresponding to the running target and the candidate time unit at the current running time from the cached data, and constructs the real-time market data of the running target at the target time unit at the current running time according to the second market data; executes the target quantization strategy based on the real-time market data of the running target at the target time unit at the current running time. Constructs the target real-time market data based on the existing market data. Avoids constructing unnecessary market data, avoids wasting computing resources, and does not need to wait for all market data related to the running target, and can also ensure that the market data related to the running target is synchronized at each moment. Only executes the target quantization strategy based on the target real-time market data, avoiding executing the target quantization strategy based on all market data related to the running target, which results in more redundant information and higher costs. For example, it avoids sending all market data related to the running target to the client, and the client only obtains the required target real-time market data, saving a lot of server bandwidth costs. Realizes the synchronization of market data on the basis of not causing delays in the closing time of market data, saving bandwidth resources and computing resources. Description of the Drawings
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to these drawings. In the drawings:
[0011] Figure 1 It is a schematic flowchart of a method for processing market data provided by an embodiment of the present application;
[0012] Figure 2 It is a schematic structural diagram of each module for processing market data provided by an embodiment of the present application;
[0013] Figure 3 It is a schematic timing diagram of market data synchronization processing provided by an embodiment of the present application;
[0014] Figure 4 A timing schematic diagram for obtaining market data provided by an embodiment of the present application;
[0015] Figure 5 A flowchart for obtaining market data of a target time unit provided by an embodiment of the present application;
[0016] Figure 6 A structural schematic diagram of a processing device for market data provided by an embodiment of the present application;
[0017] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0018] The embodiments of the present application will be described in detail below. The examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the present application, and should not be construed as a limitation to the present application.
[0019] Terms such as "first" and "second" in the specification, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0020] First, some terms in the embodiments of the present application will be explained below to facilitate the understanding of those skilled in the art.
[0021] Quantitative trading refers to the process of using computer technology to complete trading based on a pre-established quantitative strategy. Quantitative trading greatly reduces the impact of investors' emotional fluctuations and avoids making irrational investment decisions in extremely enthusiastic or pessimistic market conditions.
[0022] The quantitative strategy specifically includes trading objects, pre-established trading conditions, and trading operations triggered after the trading conditions are met (such as placing orders, canceling orders, etc.); among them, the trading conditions include, but are not limited to, that technical indicators related to the market data of the trading object need to meet specific conditions. For example, taking the quantitative strategy as the golden cross opening strategy of moving averages, when the moving average of the k-line data of the trading object specified in the quantitative strategy crosses the moving average of its k-line data in a certain long period within a certain short period (that is, the quantitative condition is met), then execute the buy order operation on the trading object.
[0023] The k-line data (market data) is derived based on the original tick-by-tick transaction data of the exchange. The k-line data usually includes multiple fields such as the highest price, the lowest price, the opening price, the closing price, the trading volume, the turnover, and the turnover rate. When each tick-by-tick transaction occurs, it will affect the closing price, trading volume, turnover, and other fields of the latest k-line data. Due to the large amount of k-line data and the need for frequent pushing, compared with other data service scenarios, the pushing of k-line data occupies more network bandwidth. In order to save server costs, the k-line data of each period is usually separated, and the k-line data of different periods are subscribed and pushed separately. However, considering the real-time change of market data transactions and network latency, the asynchronous calculation and asynchronous pushing of the k-line data of each period result in a certain data asynchrony of the k-line data of different periods when the client receives the k-line data, thus causing a judgment logic error when the quantitative strategy executes the judgment of its corresponding trading conditions, resulting in the inability to trigger trading operations or mis-triggering trading operations. For example, especially near the time point when a new k-line data is generated, due to network latency, the lack of k-line data leads to a judgment logic error.
[0024] For example, when the quantitative strategy triggers the order operation on the trading object when the 5-minute k-line and the 10-minute k-line of the specified trading object both meet the preset conditions. If the current running time is 10:00, and this is the opening time of the 5-minute k-line and the 10-minute k-line. If the k-line data of the new k-line generated at 10:00 of the 5-minute k-line (or 10-minute k-line) is missing due to network latency, it often causes a judgment logic error when the quantitative strategy executes the judgment of its corresponding trading conditions, resulting in the inability to trigger trading operations or mis-triggering trading operations.
[0025] In the prior art, in order to synchronize the k-line data of different periods, the following methods are usually adopted: Method 1 is to push the k-line data of different periods in a combined package; Method 2 is to wait for the k-lines of different periods to be collected at the start time of the k-line data; Method 3 is to construct the k-line data of other periods based on the k-line data of one period. However, there is a large amount of redundancy in the k-line data pushed by Method 1, and the server bandwidth cost is relatively high; Method 2 increases the delay at the closing time of the k-line data and cannot meet the requirements of high frequency and low latency; Method 3 will construct the k-line data of periods that have not been requested by the strategy, wasting computing resources. In addition, it is also possible not to process the k-lines of different periods asynchronously, which requires the quantitative strategy to handle by itself, increasing the management difficulty of the upper-layer application. Especially in the field of high-frequency trading, asynchrony of dozens of milliseconds will cause the strategy judgment to be incorrect. Therefore, there is an urgent need for a method to solve the above problems.
[0026] Figure 1 FIG. is a schematic flowchart of a method for processing market data provided by an exemplary embodiment of the present application. The execution subject of this method can be a terminal device, and this method at least includes the following steps S101-S106:
[0027] S101. In response to the running operation of the target quantitative strategy, obtain the current running time, the running target in the target quantitative strategy, and the target time unit of the market data subscribed in the target quantitative strategy;
[0028] Optionally, an application program client with the function of running a quantitative strategy is installed on the terminal device. When the client in the terminal device receives a user-triggered running operation of the quantitative strategy, the client of the terminal device can request market data from the cached data. If there is no first market data or second market data in the cache, it waits for the background server (i.e., the server) to push the market data.
[0029] Optionally, the running operation of the target quantitative strategy is an operation used to trigger the execution of the target quantitative strategy; for example, it can be a click operation by the user on the button provided by the client in the terminal device to run the quantitative strategy.
[0030] Optionally, the target quantitative strategy includes a trading object (i.e., the running target), pre-established trading conditions, and trading operations triggered after the trading conditions are met. Among them, the trading object, that is, the running target, can refer to financial products, including but not limited to stocks, options, and futures, etc. The trading conditions include but are not limited to that the market data of the trading object or the technical indicators related to the market data need to meet specific conditions. After receiving the running operation of the target quantitative strategy, in response to this running operation, the client can obtain the market data of the trading object (i.e., the running target) from the cached data or the background server, and perform logical judgments corresponding to the trading conditions based on the market data. If the trading conditions are met, the corresponding trading operation is executed.
[0031] Optionally, the current running time refers to the time in response to the running operation of the target quantization strategy, and the market data refers to the data information reflecting the real-time or historical trading conditions of the running target (such as stocks, futures, foreign exchange, etc.). Specifically, the market data can be K-line data, which is used to represent the price changes within a specific time period. For the relevant content of K-line data, reference can be made to the prior art and will not be elaborated here.
[0032] Optionally, the target time unit is used to represent the data period of the market data; taking the K-line data as an example, the target time unit refers to the time unit when the K-line is formed. For example, the K-line data can include but is not limited to 1-minute K-line data, 5-minute K-line data, 1-hour K-line, daily K-line, weekly K-line, etc.; among them, the 3-minute K-line data refers to the K-line data with a target time unit of 3 minutes, and each K-line represents the price change information within 3 minutes, that is, the time duration between the opening time and the closing time is 3 minutes. The 5-minute K-line data refers to the K-line data with a target time unit of 5 minutes, and each K-line represents the price change information within 5 minutes, that is, the 5-minute market data refers to the time duration between the opening time and the closing time is 5 minutes, and so on without further examples.
[0033] Optionally, reference can be made to Figure 2 , and based on the interface protocol docking between the policy acquisition module in the server and the API of the client, the information in the target quantization strategy of the client (the running target in the target quantization strategy and the target time unit of the market data subscribed in the target quantization strategy) can be parsed. For the explanation of the interface protocol, reference can be made to the prior art and will not be elaborated here.
[0034] Specifically, when the client receives the running operation of the target quantization strategy, it can obtain the current running time, analyze the target quantization strategy, and determine its running target and the target time unit of the market data used in its trading conditions from the target quantization strategy.
[0035] Exemplarily, the terminal device receives the running operation of the target quantization strategy of the client, determines that the current running time is 10:06, analyzes the target quantization strategy, and obtains the running target A of the target quantization strategy, such as the underlying stock A, and the target time units of the market data, such as 3 minutes, 5 minutes, and 15 minutes, etc. That is to say, during the running process of the target quantization strategy, it requires the 3-minute K-line data, 5-minute K-line data, and 15-minute K-line data of the underlying stock A.
[0036] S102. Obtain the resource category of the running target, and determine whether the current running time is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule;
[0037] Optionally, the resource category includes the market type corresponding to the underlying and the resource type of the underlying, where the market type includes types such as the Chinese market, the US market, and the European market, and the resource type includes, but is not limited to, types such as underlying stocks, funds, and futures.
[0038] Optionally, the resource category trading schedule records trading time period information corresponding to different resource types in different markets, such as the opening time and the closing time.
[0039] Optionally, reference can be made to Figure 2 The resource category trading schedule is cached and managed by the trading schedule management module. The resource category trading schedule can be maintained through an excel sheet. During the program initialization phase, the trading time period information corresponding to the resource category of the underlying is loaded and parsed from the excel sheet. For subsequent new types, the excel sheet can be directly modified.
[0040] Specifically, obtain the market type and resource type of the underlying in the target quantitative strategy. Then, based on the market type and the resource type, search for the corresponding trading time information in the resource category trading schedule. Further, based on the trading time information, determine whether the current running time is the starting time point corresponding to the target time unit of the market data subscribed in the target quantitative strategy, where the starting time point corresponding to the target time unit can refer to the opening line time point of the market data of the target time unit subscribed in the target quantitative strategy.
[0041] It can be understood that if the current running time is the starting time point corresponding to the target time unit of the market data subscribed in the target quantitative strategy, it means that the market data of the target time unit has been generated in the new time period; taking the market data as k-line data as an example, if the current running time is the starting time point corresponding to the target time unit of the k-line data subscribed in the target quantitative strategy, it means that a new k-line can be generated for the k-line of the target time unit at the current running time, that is, the k-line of the time period with the current running time as the starting time point and the duration as the target time unit has been opened, and the shape of the k-line at the current running time is a horizontal bar.
[0042] Optionally, in the foregoing S102, the determining whether the current running time is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule includes the following steps S1021 - S1023:
[0043] S1021. Query the opening time corresponding to the resource category of the underlying from the resource category trading schedule;
[0044] Specifically, after obtaining the market type and resource category of the target quantitative strategy, the opening time of the corresponding resource category in the corresponding market type can be found from the resource category trading schedule.
[0045] Continuing with the above example, assuming that the resource category of the underlying A is of the Chinese market type and the resource category is the type of common stock, the opening times corresponding to the common stock in the Chinese market can be found from the resource category trading schedule, such as 9:30 and 15:00.
[0046] S1022. Obtain the first time period between the current running time and the opening time;
[0047] Specifically, if there are multiple opening times, the first time period obtained is the one between the opening time before the current running time and closest to the current running time.
[0048] Continuing with the above example, if the current running time is 10:06, then the first time period between 9:30 and 10:06 is obtained, and the first time period is 36 minutes.
[0049] S1023. If the target time unit multiplied by N is equal to the first time period, determine that the current running time is the starting time point corresponding to the target time unit, where N is a positive integer greater than or equal to 1.
[0050] Specifically, if there are multiple target time units, separately compare whether each target time unit multiplied by N is equal to the first time period for each target time unit, and separately determine whether the current running time is the starting time point for each target time unit. For the target time unit for which the target time unit multiplied by N is equal to the first time period, determine that the current running time is the starting time point corresponding to this target time unit. For the target time unit for which the target time unit multiplied by N is not equal to the first time period, determine that the current running time is not the starting time point corresponding to this target time unit.
[0051] Continuing with the above example, the target time units are 3 minutes, 5 minutes, and 15 minutes. The first time period is 36 minutes. For 1 minute, 3 minutes multiplied by 12 is equal to 36 minutes, and 12 is a positive integer greater than 1, so the current running time is the starting time point corresponding to 3 minutes. For 5 minutes, 5 minutes multiplied by 7.2 is equal to 36 minutes, and 7.2 is not a positive integer, so the current running time is not the starting time point corresponding to 5 minutes. For 15 minutes, 15 minutes multiplied by 2.4 is equal to 36 minutes, and 2.4 is not a positive integer, so the current running time is not the starting time point corresponding to 15 minutes.
[0052] S103. If so, obtain the first market data corresponding to the underlying and the target time unit from the cached data;
[0053] Among them, the first market data refers to the latest market data cached in the cache data.
[0054] Specifically, if the current running time is the starting time point corresponding to the target time unit, the first market data corresponding to the running target and the target time unit can be obtained from the cache data, and the real-time market data of the running target at the current running time on the target time unit can be obtained based on the first market data.
[0055] Optionally, reference can be made to Figure 2 , and the cache data is cached and managed by the cache management module.
[0056] Specifically, during the actual trading operation of the target quantitative strategy by the client of the terminal device, the K-line data corresponding to the running target and the target time unit will be subscribed to the background server (located on the server). After subscription, the background server will continuously push the K-line data of the target time unit to the buffer for caching. When the first market data needs to be obtained, it is preferentially searched from the cache data in the buffer.
[0057] Continuing with the above example, reference can be made to Figure 3 , when the user triggers the actual trading operation of the target quantitative strategy through the client, the market data of 3 minutes, 5 minutes, and 15 minutes of the running target A can be synchronously pulled and subscribed to the background server. Subsequently, the background server continuously pushes the market data of 3 minutes, 5 minutes, and 15 minutes to the client, so that the client caches the market data to the buffer area, so that when the client executes the target quantitative strategy again, the real-time market data of the subscribed running target A can be preferentially obtained from the cache. In addition, other market data to be sent to the client can be sent to the user after data synchronization processing. Among them, the data synchronization processing is executed by the data synchronization processing module.
[0058] In summary, by pushing the market data to the cache of the terminal device, when the market data needs to be frequently obtained, the client can directly obtain it from the cache without having to call the background server multiple times to obtain the market data, which improves the efficiency of obtaining the market data and can meet the requirements of high frequency and low latency.
[0059] Furthermore, the method further includes: if the current running time is not the starting time point corresponding to the target time unit, obtaining the first market data corresponding to the running target and the target time unit from the cache data; determining the first market data as the real-time market data of the running target at the current running time on the target time unit; and executing the target quantitative strategy based on the real-time market data of the running target at the current running time on the target time unit.
[0060] Specifically, if the current running time is not the starting time point corresponding to the target time unit, the first market data corresponding to the running target and the target time unit can be obtained from the cached data, and this first market data can be directly determined as the real-time market data of the running target at the target time unit at the current running time. Then, based on the real-time market data of the running target at the target time unit at the current running time, the target quantitative strategy is executed.
[0061] Continuing with the above example, if the current running time is 10:06, the opening time of the running target A is 9:30, and the current running time is not the opening time corresponding to the 5-minute K-line data of the running target. At this time, the first market data, that is, the latest data of the 5-minute K-line data in the cached data, is the K-line data of the 5-minute K-line from 10:05 to 10:10. At this time, this first market data can be directly pushed and used as the real-time market data of the running target at the target time unit at the current running time to execute the target quantitative strategy. Another example is that the current running time is not the opening time corresponding to the 15-minute K-line data of the running target. At this time, the first market data, that is, the latest data of the 15-minute K-line data in the cached data, is the K-line data of the 15-minute K-line from 10:00 to 10:15. At this time, this first market data can be directly pushed and used as the real-time market data of the running target at the target time unit at the current running time to execute the target quantitative strategy.
[0062] S104. If the first market data is not the real-time market data of the running target at the current running time, obtain the second market data corresponding to the running target and the candidate time unit at the current running time from the cached data, and construct the real-time market data of the running target at the target time unit at the current running time according to the second market data.
[0063] Optionally, if the closing time corresponding to the first market data obtained from the cache is the current running time, then the first market data is not the real-time market data of the running target at the current running time.
[0064] It can be understood that, as described above, if the current running time is the starting time point corresponding to the target time unit of the market data subscribed in the target quantitative strategy, it means that the new market data of this target time unit has been generated at the current running time, and logical judgment needs to be made according to the new market data when executing the target quantitative strategy. If the first market data is not the real-time market data of the running target at the current running time, it means that the new market data of this target time unit is missing at the current running time, and directly using this first market data will cause a judgment logic error when the quantitative strategy judges its corresponding trading conditions, resulting in the inability to trigger trading operations or mis-triggering trading operations.
[0065] Optionally, the candidate time unit refers to a time unit smaller than the time unit corresponding to the first market data. Specifically, the market data of the candidate time unit is used to construct the market data of the target time unit. Taking the market data as the k-line data as an example, the 3-minute k-line data can be constructed using the 1-minute k-line data, and the 15-minute k-line data can be constructed using the 3-minute k-line data.
[0066] Optionally, the second market data is the real-time market data of the underlying asset at the candidate time unit at the current running moment.
[0067] In one embodiment, for the target time unit of the market data subscribed in the target quantitative strategy, the candidate time unit corresponding to the target time unit can be preset; specifically, before the step of obtaining the first market data corresponding to the underlying asset and the target time unit from the cache data, it further includes: obtaining the candidate time unit matching the target time unit; determining the cache parameter according to the candidate time unit; obtaining the target market data corresponding to the underlying asset and the target time unit from the background server, and storing the target market data in the first buffer; obtaining the candidate market data corresponding to the underlying asset and the candidate time unit from the background server, and storing the candidate market data in the second buffer, where the second buffer is used to store the candidate market data according to the cache parameter, and the cache parameter may include the cache refresh frequency for indicating the second buffer.
[0068] It can be understood that the above-mentioned target market data and candidate market data are both stored in the buffer (including the first buffer and the second buffer) as cache data. Obtaining the first market data corresponding to the underlying asset and the target time unit from the cache data can specifically be obtaining the first market data corresponding to the underlying asset and the target time unit from the cache data in the first buffer; obtaining the second market data corresponding to the underlying asset and the candidate time unit at the current running moment from the cache data can specifically be obtaining the second market data corresponding to the underlying asset and the candidate time unit from the cache data in the second buffer. In addition, the cache refresh frequency of the second buffer is different from that of the first buffer. Since the candidate market data is not the market data actually used by the quantitative strategy, the cache refresh frequency of the second buffer is greater than that of the first buffer. The high refresh frequency ensures that the candidate market data corresponding to the candidate time unit continuously stored in the second buffer is the latest data while deleting the historical data to save storage space; further, the cache parameter can be inversely proportional to the candidate time unit, that is, the larger the candidate time unit, the smaller the cache parameter, and the smaller the candidate time unit, the smaller the cache parameter.
[0069] Further, when storing the target market data, multiple storage media and their corresponding storage methods can be set. For example, it can include memory, hard disk media, cloud storage media, etc. Furthermore, based on the time point corresponding to the target market data, the target market data can be cached in different storage media in different storage methods; specifically, information such as the running duration Tie of the target quantitative strategy, the time point Tmom(i) corresponding to the target market data, and the current running time Tcurr can be obtained, and then the storage parameter of the target market data is calculated based on the above information as:
[0070]
[0071] Among them, w represents the importance degree corresponding to the i-th target market data, and (Tcurr - Tmom(i)) represents the time interval length between the time point corresponding to the i-th target market data and the current running time. During the current running process of the target quantitative strategy, the importance of the i-th target market data decreases in inverse proportion to the time interval length between it and the current running time, and will further decrease as the running duration Tie increases. After obtaining the storage parameter w corresponding to the i-th target market data through the above method, the storage medium and storage method are determined based on the parameter threshold range of the storage parameter w. For example, the larger the storage parameter w, that is, the higher the importance degree of the i-th target market data, that is, the higher the probability that the target quantitative strategy uses this data, the i-th target market data can be stored in the memory for caching to improve the access speed of this market data in a faster storage medium; the smaller the storage parameter w, that is, the lower the importance degree of the i-th target market data, that is, the lower the probability that the target quantitative strategy uses this data, the i-th target market data can be stored in a storage medium with a slower access speed such as hard disk media or cloud storage media.
[0072] By using the target market data corresponding to the target time unit as cache data and storing it in the first cache area constructed with different storage media according to its importance degree, the storage efficiency of market data and the data acquisition efficiency are improved, and thus the running efficiency of the target quantitative strategy is improved.
[0073] Specifically, refer to Figure 2 , the data synchronization processing module depends on the trading schedule management module to judge whether the current running time is the opening time of the target time unit, and judges whether it is the latest market data of the target time unit according to the market data in the current cache.
[0074] Continuing with the above example, refer to Figure 2 and Figure 3, for the market data with a target time unit of 3 minutes, that is, the k-line data of the 3-minute k-line, the time period corresponding to the first market data obtained is 10:03 - 10:06, and the current running time is also 10:06, which means that the first market data obtained from the cache is not the k-line data of a new k-line corresponding to the 3-minute k-line of the running target A at 10:06 (that is, the real-time market data corresponding to the target time unit). Then, the k-line data of a new k-line corresponding to the 1-minute K-line pair of the running target A at 10:06 can be obtained from the cache data (that is, the second market data), and this k-line data is used to construct the k-line data of a new k-line corresponding to the 3-minute K-line at 10:06.
[0075] Specifically, refer to Figure 2 , in the data synchronization processing module, there is a method for constructing market data of the target time unit. According to the latest obtained second market data, the real-time market data of the running target at the target time unit at the current running time is constructed. Regarding the relevant content of constructing K-line data of other cycles based on K-line data of different cycles, refer to the prior art and will not be elaborated here. The data synchronization processing process in Figure 2 is executed in the data synchronization processing module.
[0076] For example, if the current time is 10:00, the K-line data of a new k-line of the 5-minute k-line corresponding to the running target has been obtained, and the K-line data of a new k-line of the 10-minute k-line is missing. At this time, based on the latest K-line data of the 5-minute K-line of the running target A obtained, the latest K-line data of the 10-minute K-line of the running target A can be constructed, that is, the corresponding real-time market data is obtained.
[0077] In summary, by obtaining the K-line data of other cycles (candidate time units) with the current running time as the opening time of the k-line, and constructing the real-time market data of the target time unit with the current running time as the opening time of the k-line, it is ensured that the obtained real-time market data of the target time unit is the latest data, ensuring the synchronization of data of different cycles, and only constructing the real-time market data of the target time unit required by the client, without the need to construct the real-time market data of all time units corresponding to the running target, saving a large amount of computing resources.
[0078] Optionally, in the foregoing S104, the constructing the real-time market data of the running target at the target time unit at the current running time according to the second market data includes the following steps S1051 - S1052:
[0079] S1051. Obtain the opening price, highest price, lowest price, closing price, and trading volume of the second market data;
[0080] S1052. Construct the real-time market data of the underlying asset at the current running moment in the target time unit based on the opening price, the highest price, the lowest price, the closing price, and the trading volume.
[0081] Specifically, regarding how to construct the real-time market data of the underlying asset at the current running moment in the target time unit based on the opening price, the highest price, the lowest price, the closing price, and the trading volume, reference can be made to the prior art, and details are not elaborated herein.
[0082] Optionally, the method further includes the following steps: If the second market data corresponding to the underlying asset and the candidate time unit at the current running moment is not obtained from the cached data, enter the waiting state until the real-time market data corresponding to the underlying asset and the target time unit at the current running moment is obtained, and execute the target quantitative strategy based on the real-time market data of the underlying asset at the current running moment in the target time unit.
[0083] Specifically, reference can be made to Figure 2 , and in the K-line data synchronization processing module, there is also a method for synchronously waiting for the background server to push the market data of the target time unit. Specifically, the real-time market data corresponding to the target time unit is obtained by setting the waiting state, and the latest real-time market data corresponding to the target time unit is obtained by setting the waiting state with an ignorable duration, avoiding the problem of out-of-sync real-time market data of the same underlying asset with different time units sent to the client. The synchronization of real-time market data with different time units is achieved based on the ignorable waiting duration, which can meet the scenarios with high requirements for timeliness.
[0084] Optionally, the method further includes that if the second market data corresponding to the underlying asset and the candidate time unit at the current running moment is not obtained from the cached data, enter the waiting state until the third market data corresponding to the underlying asset and the candidate time unit at the current running moment is obtained, execute to construct the real-time market data of the underlying asset at the current running moment in the target time unit based on the third market data, and execute the target quantitative strategy based on the real-time market data of the underlying asset at the current running moment in the target time unit.
[0085] Optionally, entering the waiting state includes: starting to time and repeatedly detecting whether there is real-time market data corresponding to a time period with a starting time of the current running time and a duration of the target time unit. If so, it is regarded as obtaining the real-time market data corresponding to the running target and the target time unit at the current running time, or repeatedly detecting whether there is fourth market data corresponding to a time period with a starting time of the current running time and a duration of the candidate time unit. If so, it is regarded as obtaining the third market data corresponding to the running target and the candidate time unit at the current running time, where the fourth market data is the third market data.
[0086] S105. Execute the target quantitative strategy based on the real-time market data of the running target in the target time unit at the current running time.
[0087] Among them, after obtaining the real-time market data of the running target in the target time unit, trigger the execution of the target quantitative strategy; specifically, executing the target quantitative strategy can be specifically to obtain the technical index data indicated by the trading conditions in the target quantitative strategy based on the real-time market data in the target time unit, and then compare whether the technical index data meets the specific conditions specified by the trading conditions. When the technical index corresponding to the running target meets the specific conditions specified by the trading conditions in the target quantitative strategy, execute the trading operation triggered after the trading conditions in the target quantitative strategy are met; for example, taking the target quantitative strategy as the moving average golden cross opening strategy as an example, after obtaining the real-time market data of the running target, such as daily k-line data, the 5-day moving average data and 20-day moving average data of the running target can be obtained based on the daily k-line, and then judge whether the moving average chart corresponding to the 5-day moving average data penetrates the moving average chart corresponding to the 20-day moving average data. If so, execute the trading operation triggered by the trading conditions, such as the buy order operation.
[0088] Optionally, the method further includes: when it is detected that the duration of entering the waiting state has exceeded the preset duration, end the waiting state, use the first market data as the real-time market data of the running target in the target time unit at the current running time, and execute the target quantitative strategy based on the real-time market data of the running target in the target time unit at the current running time.
[0089] Specifically, the preset duration can be set according to the actual situation. For example, the preset duration can be set to 2 seconds.
[0090] Optionally, if the duration of the waiting state has exceeded the preset duration, it is defaulted that the market is in a closed state, then end the waiting state, and return the latest market data of the running target corresponding to the target time unit in the cache data.
[0091] Specifically, in order to improve the efficiency of obtaining market data of the target time unit, a multi-threaded processing mode can be used to obtain data. For example, a data fetching thread and a background data processing thread are set. The data fetching thread is used to push the market data of the target time unit required by the client to the client and perform a delay wait. The background data processing thread is used to notify the data fetching thread to cancel the delay wait and push the market data to the buffer area.
[0092] Specifically, reference can be made to Figure 2 , the background data processing thread is managed by the background data processing module and is used to handle protocol docking with the background, pull data, process and push data, and parse it into quantitative internal data and store it in the buffer.
[0093] Exemplarily, as Figure 4 shown, Figure 4 is a timing schematic diagram of obtaining market data provided by an exemplary embodiment of the present application. The data fetching thread obtains the market data of the latest A time unit of the running target required by the client from the buffer area. If it fails to obtain, the data fetching thread enters a delay wait. The background data processing thread is used to obtain the latest market data of the A time unit from the background server. If the real-time market data of the target time unit is obtained within the preset duration or the third market data corresponding to the running target and the candidate time unit at the current running moment is obtained, the data fetching thread is notified to stop waiting, and the real-time market data of the target time unit or the real-time market data of the target time unit constructed based on the third market data is pushed to the buffer. The data fetching thread pushes the real-time market data of the target time unit to the client. If the real-time market data of the target time unit is not obtained and the third market data corresponding to the running target and the candidate time unit at the current running moment is not obtained after exceeding the preset duration, the data fetching thread is notified to stop waiting, and the data fetching thread pushes the latest market data of the target time unit in the buffer to the client. Among them, the latest market data of the target time unit in the buffer refers to the market data corresponding to the time period whose closing time is the current running moment or a moment before the current running moment, and this time period is the latest time period recorded in the buffer. At the same time, the background data processing thread will process the background data in real time and push the subscribed market data to the buffer in real time.
[0094] Optionally, reference can be made to Figure 5 , Figure 5 is a flowchart of obtaining market data of the target time unit provided by an exemplary embodiment of the present application. Specifically:
[0095] The background server continuously pushes the market data subscribed by the client. For example, at 10:06, the background server pushes the 5-minute market data subscribed by the client. When receiving the market data requested by the client's API, it first determines whether it is necessary to construct the market data. For those that need to be constructed, construction processing is carried out, and those that do not need to be constructed enter the waiting state. For example, at 10:06, when receiving the 3-minute market data of the underlying asset A requested by the client's API, it first determines whether it is necessary to construct the 3-minute market data of the underlying asset A. If there is no latest 3-minute market data of the underlying asset A in the cache, but there is the latest market data of other time units of the underlying asset A, it is determined that construction is required, and the 3-minute market data is constructed based on the latest market data of other time units and returned to the client.
[0096] After entering the waiting state, it is determined whether the waiting duration exceeds the preset duration. If it does not exceed, it is determined whether there is the latest 3-minute market data in the cache. If there is, it is directly returned to the client. Or it is determined whether there is market data of other time units of the underlying asset A in the cache. If there is, the 3-minute market data is directly constructed based on the latest market data of other time units and returned to the client.
[0097] If the waiting duration exceeds the preset duration, the previous 3-minute market data in the cache is directly returned to the client. Among them, the previous 3-minute market data in the cache refers to the market data corresponding to the opening line moment closest to the current running moment.
[0098] In summary, for the solution provided in this application, in response to the running operation of the target quantization strategy, the current running time, the running target in the target quantization strategy, and the target time unit of the market data subscribed in the target quantization strategy are obtained; the resource category of the running target is obtained, and according to the target time unit, the resource category, and the resource category trading schedule, it is determined whether the current running time is the starting time point corresponding to the target time unit; if so, the first market data corresponding to the running target and the target time unit is obtained from the cached data; if the first market data is not the real-time market data of the running target at the current running time, the second market data corresponding to the running target and the candidate time unit at the current running time is obtained from the cached data, and the real-time market data of the running target at the target time unit at the current running time is constructed according to the second market data; based on the real-time market data of the running target at the target time unit at the current running time, the target quantization strategy is executed. The target real-time market data is constructed based on the existing market data. Unnecessary market data is avoided from being constructed (that is, market data not requested by the target quantization strategy is avoided from being constructed), waste of computing resources is avoided, and it is not necessary to wait for all market data related to the running target, and it can also ensure that the market data related to the running target is synchronized at each moment. The target quantization strategy is only executed based on the target real-time market data, avoiding executing the target quantization strategy based on all market data related to the running target, which results in more redundant information and higher costs, and saves a lot of server bandwidth costs. On the basis of not causing a delay in the closing time of the market data, saving bandwidth resources and saving computing resources, the synchronization of the market data is achieved.
[0099] Figure 6 FIG. 4 is a schematic structural diagram of a market data processing device provided by an exemplary embodiment of the present application; wherein, the device includes:
[0100] An obtaining unit 21, configured to obtain the current running time, the running target in the target quantization strategy, and the target time unit of the market data subscribed in the target quantization strategy in response to the running operation of the target quantization strategy;
[0101] A determining unit 22, configured to obtain the resource category of the running target, and determine whether the current running time is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule;
[0102] The obtaining unit 21 is further configured to, if so, obtain the first market data corresponding to the running target and the target time unit from the cached data;
[0103] The obtaining unit 21 is further configured to, if the first market data is not the real-time market data of the underlying asset at the current running moment, obtain second market data corresponding to the underlying asset and the candidate time unit at the current running moment from the cached data, and construct real-time market data of the underlying asset at the target time unit at the current running moment according to the second market data;
[0104] The execution unit 23 is configured to execute the target quantitative strategy based on the real-time market data of the underlying asset at the target time unit at the current running moment.
[0105] Optionally, the apparatus is further configured to, if the current running moment is not the starting time point corresponding to the target time unit, obtain first market data corresponding to the underlying asset and the target time unit from the cached data; determine the first market data as the real-time market data of the underlying asset at the target time unit at the current running moment; and execute the target quantitative strategy based on the real-time market data of the underlying asset at the target time unit at the current running moment.
[0106] Optionally, the apparatus is further configured to, if the second market data corresponding to the underlying asset and the candidate time unit at the current running moment cannot be obtained from the cached data, enter a waiting state until the real-time market data corresponding to the underlying asset and the target time unit at the current running moment is obtained, execute the target quantitative strategy based on the real-time market data of the underlying asset at the target time unit at the current running moment, or until the third market data corresponding to the underlying asset and the candidate time unit at the current running moment is obtained, construct the real-time market data of the underlying asset at the target time unit at the current running moment according to the third market data, and execute the target quantitative strategy based on the real-time market data of the underlying asset at the target time unit at the current running moment.
[0107] Optionally, when the apparatus is used to enter the waiting state, it is specifically configured to: start timing and repeatedly detect whether there is real-time market data corresponding to a time period with the starting moment being the current running moment and the duration being the target time unit. If so, it is regarded as obtaining the real-time market data corresponding to the underlying asset and the target time unit at the current running moment, or repeatedly detect whether there is fourth market data corresponding to a time period with the starting moment being the current running moment and the duration being the candidate time unit. If so, it is regarded as obtaining the third market data corresponding to the underlying asset and the candidate time unit at the current running moment, where the fourth market data is the third market data.
[0108] Optionally, the device is further configured to, when it is detected that the duration of entering the waiting state has exceeded a preset duration, end the waiting state, use the first market data as the real-time market data of the underlying asset at the current running moment in the target time unit, and execute the target quantitative strategy based on the real-time market data of the underlying asset at the current running moment in the target time unit.
[0109] Optionally, the device is configured to determine whether the current running moment is the starting time point corresponding to the target time unit according to the target time unit, the resource category, and the resource category trading schedule. Specifically, it is configured to: query the opening time corresponding to the resource category of the underlying asset from the resource category trading schedule; obtain the first duration between the current running moment and the opening time; if the target time unit multiplied by N is equal to the first duration, determine that the current running moment is the starting time point corresponding to the target time unit, where N is a positive integer greater than or equal to 1.
[0110] It should be understood that the device embodiments and the method embodiments can correspond to each other, and similar descriptions can refer to the method embodiments. To avoid repetition, they are not elaborated here. Specifically, the device can execute the above method embodiments, and the foregoing and other operations and / or functions of each module in the device respectively correspond to the corresponding processes in each method in the above method embodiments. For the sake of brevity, they are not elaborated here.
[0111] The device of the embodiment of the present application has been described above from the perspective of functional modules. It should be understood that the functional module can be implemented in the form of hardware, can also be implemented by instructions in software form, or can be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiments in the present application can be completed by the integrated logic circuit in the hardware in the processor and / or instructions in software form. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps in the above method embodiments.
[0112] Figure 7 is a schematic block diagram of an electronic device provided by an embodiment of the present application. The electronic device may include:
[0113] A memory 301 and a processor 302. The memory 301 is used to store a computer program and transmit the program code to the processor 302. In other words, the processor 302 can call and run the computer program from the memory 301 to implement the method in the embodiments of the present application.
[0114] For example, the processor 302 can be used to execute the above method embodiments according to the instructions in the computer program.
[0115] In some embodiments of the present application, the processor 302 may include but is not limited to:
[0116] 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 devices, discrete gate or transistor logic devices, discrete hardware components, and the like.
[0117] In some embodiments of the present application, the memory 301 includes but is not limited to:
[0118] A volatile memory and / or a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synch link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0119] In some embodiments of the present application, the computer program may be divided into one or more modules, and the one or more modules are stored in the memory 301 and executed by the processor 302 to implement the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0120] As Figure 7 shown, the electronic device may further include:
[0121] a transceiver 303, and the transceiver 303 may be connected to the processor 302 or the memory 301.
[0122] Among them, the processor 302 may control the transceiver 303 to communicate with other devices. Specifically, it may send information or data to other devices, or receive information or data sent by other devices. The transceiver 303 may include a transmitter and a receiver. The transceiver 303 may further include an antenna, and the number of antennas may be one or more.
[0123] It should be understood that the various components in the electronic device are connected through a bus system. Among them, the bus system includes not only a data bus, but also a power bus, a control bus, and a status signal bus.
[0124] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the computer, the computer can execute the method of the above method embodiments. Or rather, the embodiments of the present application also provide a computer program product including instructions. When the instructions are executed by the computer, the computer executes the method of the above method embodiments.
[0125] When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid state disk (SSD)), etc.
[0126] Those of ordinary skill in the art will realize that the modules and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0127] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other may be through some interfaces, and the indirect couplings or communication connections of the devices or modules may be in electrical, mechanical, or other forms.
[0128] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, in each embodiment of this application, the various functional modules can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
[0129] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A method for processing market data, characterized in that: include: In response to the running operation of the target quantitative strategy, the current running time, the running target in the target quantitative strategy, and the target time unit of the market data subscribed in the target quantitative strategy are obtained; Acquire the resource category of the operation target, and determine whether the current operation time is a starting time point corresponding to the target time unit according to the target time unit, the resource category and the resource category transaction schedule; If so, obtaining first market data corresponding to the running target and the target time unit from the cache data; If the first market data is not the real-time market data of the running target at the current running time, obtain second market data corresponding to the running target and the candidate time unit at the current running time from the cache data, and construct the real-time market data of the running target at the target time unit at the current running time according to the second market data; The target quantitative strategy is executed based on the real-time market data of the operating target in the target time unit at the current operating moment.
2. The method according to claim 1, characterized in that The method further comprises: If the current running time is not the starting time point corresponding to the target time unit, obtaining first market data corresponding to the running target and the target time unit from cache data; Determine the first market data as the real-time market data of the running target in the target time unit at the current running time; The target quantitative strategy is executed based on the real-time market data of the running target in the target time unit at the current running time.
3. The method according to claim 2, characterized in that The method further comprises: If the second market data corresponding to the running target and the candidate time unit at the current running time is not obtained from the cache data, the waiting state is entered until the real-time market data corresponding to the running target and the target time unit at the current running time is obtained, and the real-time market data of the running target in the target time unit at the current running time is executed to execute the target quantitative strategy, or Until the third market data corresponding to the operating target and the candidate time unit at the current operating moment is obtained, the real-time market data of the operating target at the current operating moment in the target time unit is constructed according to the third market data, and the target quantification strategy is executed based on the real-time market data of the operating target at the current operating moment in the target time unit.
4. The method according to claim 3, characterized in that The step of entering the waiting state comprises: Start timing and repeatedly detect whether there is real-time market data corresponding to a time period starting at the current running time and lasting for the target time unit. If so, it is deemed that the real-time market data corresponding to the running target and the target time unit at the current running time is obtained; or Start timing and repeatedly execute to detect whether there is fourth market data corresponding to a time period with a starting time being the current running time and a duration being the candidate time unit. If so, it is deemed that the third market data corresponding to the running target and the candidate time unit at the current running time is obtained, wherein the fourth market data is the third market data.
5. The method according to claim 3, characterized in that: The method also includes: when it is detected that the time duration of entering the waiting state has exceeded the preset time duration, the waiting state is ended, the first market data is used as the real-time market data of the operating target in the target time unit at the current operating moment, and the target quantification strategy is executed based on the real-time market data of the operating target in the target time unit at the current operating moment.
6. The method according to claim 1, characterized in that The determining, based on the target time unit, the resource category, and the resource category transaction schedule, whether the current running time is a starting time point corresponding to the target time unit includes: From the resource category trading timetable, query the opening time corresponding to the resource category of the operation target; Obtaining a first duration between the current running time and the market opening time; If the target time unit multiplied by N is equal to the first duration, the current running time is determined to be the starting time point corresponding to the target time unit, where N is a positive integer greater than or equal to 1.
7. A market data processing device, characterized in that: include: An acquisition unit, configured to acquire, in response to an operation of the target quantitative strategy, a current operation time, an operation target in the target quantitative strategy, and a target time unit of market data subscribed in the target quantitative strategy; a determination unit, configured to obtain the resource category of the operation target, and determine whether the current operation time is a starting time point corresponding to the target time unit according to the target time unit, the resource category and the resource category transaction schedule; The acquisition unit is further configured to, if yes, acquire first market data corresponding to the running target and the target time unit from the cache data; The acquisition unit is further configured to acquire, from cache data, second market data corresponding to the running target and the candidate time unit at the current running time if the first market data is not the real-time market data of the running target at the current running time, and construct the real-time market data of the running target at the target time unit at the current running time according to the second market data; An execution unit is used to execute the target quantitative strategy based on the real-time market data of the operating target in the target time unit at the current operating time.
8. The device according to claim 7, characterized in that The device is also used for: If the current running time is not the starting time point corresponding to the target time unit, obtaining first market data corresponding to the running target and the target time unit from cache data; Determine the first market data as the real-time market data of the running target in the target time unit at the current running time; The target quantitative strategy is executed based on the real-time market data of the running target in the target time unit at the current running time.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 6 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Market data processing method and apparatus, device, and storage medium
WO2026138323A1