Market data processing method and apparatus, device, and storage medium
By utilizing cached data to obtain real-time market data during market data processing, the problem of judgment logic errors caused by asynchronous push of market data is solved, realizing the synchronization and efficient execution of market data, and saving computing and bandwidth resources.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SHENZHEN FUTU NETWORK TECH CO LTD
- Filing Date
- 2025-11-25
- Publication Date
- 2026-07-02
AI Technical Summary
In existing technologies, the asynchronous calculation and push of K-line data for different periods of market data results in tens of milliseconds of data asynchrony when the client receives K-line data. This causes quantitative strategies to make judgment logic errors near the time when a new K-line data is generated, making it impossible to push data in a timely manner and synchronize K-line data of different periods.
By obtaining the current running time and the target of the quantitative strategy, real-time market data is obtained using cached data, real-time market data is constructed on the target time unit, and the latest data is obtained from the cache when the start time point is met, avoiding asynchronous push and directly executing the quantitative strategy.
It achieves synchronized market data, avoids waste of computing resources and server bandwidth costs, ensures that quantitative strategies can synchronize data at any time, reduces judgment logic errors, and meets the requirements of high frequency and low latency.
Smart Images

Figure CN2025137542_02072026_PF_FP_ABST
Abstract
Description
Methods, devices, equipment and storage media for processing market data
[0001] Cross-reference of related applications
[0002] This application claims priority to Chinese Patent Application No. 2024119285196, filed on December 25, 2024, entitled "Method, Apparatus, Device and Storage Medium for Processing Market Data", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application belongs to the field of financial information processing technology, and in particular relates to a method, apparatus, device and storage medium for processing market data. Background Technology
[0004] Candlestick chart data (i.e., market data) is derived from raw, tick-by-tick transaction data from exchanges, generated by various data providers. Due to the large volume of candlestick data and the need for frequent pushes, to save server costs, candlestick data for different timeframes is typically separated, with each timeframe subscribed to and pushed separately. However, market data changes in real time, and the asynchronous calculation and push of candlestick data across different timeframes result in a data asynchrony of tens of milliseconds when clients receive the data. This causes quantitative strategies to encounter logical errors near the generation of a new candlestick. Furthermore, it leads to delays in data pushes at closing times and a lack of synchronization between candlestick data from different timeframes. Therefore, a solution to these problems is urgently needed. Summary of the Invention
[0005] This application provides an implementation scheme different from the prior art to solve the technical problem of asynchronous K-line data of different periods at the closing time and untimely push of K-line data at the closing time.
[0006] In a first aspect, this application provides a method for processing market data, comprising: in response to the operation of a target quantification strategy, obtaining the current running time, the target asset in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy; obtaining the resource category of the target asset, and determining whether the current running time is a start time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category trading schedule; if so, obtaining first market data corresponding to the target asset and the target time unit from cached data; if the first market data is not the real-time market data of the target asset in the target time unit at the current running time, obtaining second market data corresponding to the target asset and the candidate time unit at the current running time from cached data, constructing real-time market data of the target asset in the target time unit at the current running time based on the second market data; and executing the target quantification strategy based on the real-time market data of the target asset in the target time unit at the current running time.
[0007] Secondly, this application provides a market data processing apparatus, comprising: an acquisition unit, configured to acquire, in response to the operation of a target quantification strategy, the current running time, the target asset in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy; a determination unit, configured to acquire the resource category of the target asset, and determine, based on the target time unit, the resource category, and the resource category trading schedule, whether the current running time is the start time point corresponding to the target time unit; the acquisition unit is further configured to, if yes, acquire first market data corresponding to the target asset and the target time unit from cached data; the acquisition unit is further configured to, if the first market data is not the real-time market data of the target asset in the target time unit at the current running time, acquire second market data corresponding to the target asset and the candidate time unit at the current running time from cached data, and construct real-time market data of the target asset in the target time unit at the current running time based on the second market data; and an execution unit, configured to execute the target quantification strategy based on the real-time market data of the target asset in the target time unit at the current running time.
[0008] Thirdly, this application provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any of the methods of the first aspect or any possible implementation of the first aspect by executing the executable instructions.
[0009] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods in the first aspect or any of the possible implementations of the first aspect.
[0010] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect or any of the possible implementations of the first aspect.
[0011] The solution provided in this application, in response to the operation of a target quantification strategy, obtains the current running time, the target asset in the target quantification strategy, and the target time unit of the market data subscribed to in the target quantification strategy; obtains the resource category of the target asset; and determines whether the current running time is the start time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category trading schedule; if so, it obtains first market data corresponding to the target asset and the target time unit from cached data; if the first market data is not the real-time market data of the target asset at the current running time, it obtains second market data corresponding to the target asset and the candidate time unit at the current running time from cached data, and constructs real-time market data of the target asset at the target time unit at the current running time based on the second market data; and executes the target quantification strategy based on the real-time market data of the target asset at the target time unit at the current running time. Target real-time market data is constructed based on existing market data. This approach avoids constructing unnecessary market data, preventing waste of computing resources, and ensures that market data related to the target is synchronized at every moment without waiting for all relevant market data. It executes the target quantization strategy only based on the target's real-time market data, avoiding the redundancy and high costs associated with executing the strategy based on all relevant market data. For example, it avoids sending all relevant market data to the client; the client only receives the necessary target real-time market data, saving significant server bandwidth costs. This achieves market data synchronization without causing delays in market data closing times, saving bandwidth and computing resources. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0013] Figure 1 is a flowchart illustrating a method for processing market data according to an embodiment of this application;
[0014] Figure 2 is a schematic diagram of the structure of various modules for processing market data provided in an embodiment of this application;
[0015] Figure 3 is a timing diagram of a market data synchronization processing method provided in an embodiment of this application;
[0016] Figure 4 is a timing diagram of acquiring market data according to an embodiment of this application;
[0017] Figure 5 is a schematic diagram of a process for obtaining market data for a target time unit according to an embodiment of this application;
[0018] Figure 6 is a schematic diagram of a market data processing device provided in an embodiment of this application;
[0019] Figure 7 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] The embodiments of this application are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0021] The terms "first" and "second," etc., used in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0022] First, some terms used in the embodiments of this application will be explained below to facilitate understanding by those skilled in the art.
[0023] Quantitative trading refers to the process of using computer technology to complete trades based on pre-defined quantitative strategies. Quantitative trading greatly reduces the impact of investor sentiment fluctuations and avoids making irrational investment decisions in situations of extreme market euphoria or pessimism.
[0024] A quantitative strategy specifically includes a trading target, pre-defined trading conditions, and trading operations triggered when the trading conditions are met (such as placing an order or canceling an order). Among these, the trading conditions include, but are not limited to, the technical indicators related to the market data of the trading target needing to meet specific conditions. For example, taking the moving average golden cross opening strategy as an example, when the K-line data of the trading target specified in the quantitative strategy crosses the moving average of its K-line data in a certain short period over a certain long period (i.e., the quantitative conditions are met), a buy order is placed for the trading target.
[0025] Candlestick chart data (market data) is derived from the original tick-by-tick transaction data of the exchange. Candlestick data typically includes multiple fields such as highest price, lowest price, opening price, closing price, trading volume, turnover, and turnover rate. Each tick-by-tick transaction affects the closing price, trading volume, and turnover fields of the latest candlestick data. Due to the large volume of candlestick data and the need for frequent pushes, candlestick data pushes consume more network bandwidth compared to other data service scenarios. To save server costs, candlestick data for different periods is usually separated, with different periods subscribed to and pushed separately. However, considering the real-time changes in market data and network latency, the asynchronous calculation and push of candlestick data for different periods cause a certain degree of data asynchrony when the client receives candlestick data from different periods. This can lead to errors in the judgment logic when quantitative strategies execute their corresponding trading conditions, resulting in the failure to trigger trading operations or the accidental triggering of trading operations. For example, especially near the time when a new candlestick is generated, network latency can cause missing candlestick data, leading to judgment logic errors.
[0026] For example, a quantitative strategy might trigger an order for a specified trading target when both the 5-minute and 10-minute candlestick charts meet preset conditions. If the current running time is 10:00, which is the opening time of the 5-minute and 10-minute candlestick charts, and network latency causes the candlestick data of the new candlestick generated at 10:00 to be missing, the quantitative strategy may encounter a logic error when executing its corresponding trading conditions, resulting in the inability to trigger a trading operation or the accidental triggering of a trading operation.
[0027] In existing technologies, to achieve synchronization of candlestick data across different periods, three common methods are used: Method 1 involves combining and pushing candlestick data from different periods; Method 2 involves waiting for candlestick data from different periods to accumulate at the start of the data release; and Method 3 involves constructing candlestick data for other periods based on the data from one period. However, Method 1 results in significant redundancy in the pushed candlestick data, leading to high server bandwidth costs. Method 2 increases the latency at the end of the candlestick data release, failing to meet the requirements of high-frequency, low-latency trading. Method 3 constructs candlestick data for periods not requested by the strategy, wasting computational resources. Furthermore, asynchronous processing of candlestick data across different periods can be ignored, requiring the quantitative strategy to handle this itself, increasing the management complexity of upper-layer applications. Especially in high-frequency trading, even a difference of tens of milliseconds in latency can lead to strategy errors. Therefore, a solution to these problems is urgently needed.
[0028] Figure 1 is a flowchart illustrating a market data processing method provided in an exemplary embodiment of this application. The method can be executed by a terminal device, and the method includes at least the following steps S101-S106:
[0029] S101. In response to the operation of the target quantification strategy, obtain the current running time, the running target in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy.
[0030] Optionally, the terminal device is equipped with an application client capable of running quantitative strategies. When the client on the terminal device receives a user's trigger to run the quantitative strategy, the client can request market data from the cached data. If the first or second market data is not in the cache, it waits for the background server (i.e., the server) to push the market data.
[0031] Optionally, the operation to run the target quantization strategy is an operation used to trigger the execution of the target quantization strategy; for example, it could be a user clicking a button provided by the client on the terminal device to run the quantization strategy.
[0032] Optionally, the target quantitative strategy includes a trading object (i.e., the target asset), pre-defined trading conditions, and trading operations triggered when the trading conditions are met. The trading object, i.e., the target asset, can refer to financial products, including but not limited to stocks, options, and futures. Trading conditions include, but are not limited to, specific conditions being met for the market data of the trading object or related technical indicators. Upon receiving the execution operation of the target quantitative strategy, in response to this operation, the client can obtain the market data of the trading object (i.e., the target asset) from cached data or the backend server, and perform logical judgments based on the market data corresponding to the trading conditions. If the trading conditions are met, the corresponding trading operation is executed.
[0033] Optionally, the current running time refers to the time of operation in response to the target quantitative strategy, and the market data refers to data information reflecting the real-time or historical trading status of the target (such as stocks, futures, foreign exchange, etc.). Specifically, the market data can be K-line data, which is used to represent price changes within a specific time period. The relevant content of K-line data will not be elaborated on here.
[0034] Optionally, the target time unit is used to represent the data period of market data. Taking candlestick data as an example, the target time unit refers to the time unit in which the candlestick is formed. For example, candlestick data can include, but is not limited to, 1-minute candlestick data, 5-minute candlestick data, 1-hour candlestick data, daily candlestick data, weekly candlestick data, etc. Among them, 3-minute candlestick data refers to candlestick data with a target time unit of 3 minutes, where each candlestick represents price change information within 3 minutes, that is, the duration between the opening and closing time is 3 minutes. 5-minute candlestick data refers to candlestick data with a target time unit of 5 minutes, where each candlestick represents price change information within 5 minutes. That is, 5-minute market data refers to the duration between the opening and closing time being 5 minutes, and so on.
[0035] Optionally, as shown in Figure 2, the information in the target quantitative strategy of the client can be parsed based on the interface protocol between the strategy acquisition module in the server and the API of the client (the target of the target quantitative strategy and the target time unit of the market data subscribed in the target quantitative strategy). The explanation of the interface protocol will not be elaborated here.
[0036] Specifically, when the client receives the execution operation of the target quantitative strategy, it can obtain the current execution time and analyze the target quantitative strategy to determine the target of its operation and the target time unit of the market data used in its trading conditions.
[0037] For example, the terminal device receives the target quantitative strategy execution operation from the client, determines the current execution time as 10:06, analyzes the target quantitative strategy, and obtains the target A of the target quantitative strategy, such as the underlying stock A, and the target time unit of market data, such as 3 minutes, 5 minutes and 15 minutes. In other words, the target quantitative strategy requires the 3-minute K-line data, 5-minute K-line data and 15-minute K-line data of the underlying stock A during the execution process.
[0038] S102. Obtain the resource category of the target object, and determine whether the current running time is the starting time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category transaction schedule.
[0039] Optionally, the resource categories include the market type corresponding to the target asset and the resource types of the target asset. The market types include the Chinese market, the US market, the European market, etc., and the resource types include, but are not limited to, underlying stocks, funds, futures, etc.
[0040] Optionally, the resource category transaction schedule records transaction time periods corresponding to different resource types in different markets, such as opening time and closing time.
[0041] Optionally, as shown in Figure 2, the resource category transaction schedule is cached and managed by the transaction schedule management module. The resource category transaction schedule can be maintained through an Excel spreadsheet. During the program initialization phase, the transaction time period information corresponding to the resource category of the running target is loaded and parsed from the Excel spreadsheet. Subsequent additions of new categories can also be made by directly modifying the Excel spreadsheet.
[0042] Specifically, the market type and resource type of the target asset in the target quantitative strategy are obtained. Then, based on the market type and resource type, the corresponding trading time period information is found in the trading time table of the resource category. Based on the trading time period information, it is determined 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. The starting time point corresponding to the target time unit can refer to the opening time point of the market data of the target time unit subscribed in the target quantitative strategy.
[0043] Understandably, 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 candlestick data as an example, if the current running time is the starting time point corresponding to the target time unit of the candlestick data subscribed in the target quantitative strategy, it means that a new candlestick can be generated at the current running time. That is, the candlestick with the current running time as the starting time point and the duration of the target time unit time period has been opened, and the shape of the candlestick at the current running time is a horizontal bar.
[0044] Optionally, in the aforementioned S102, determining whether the current running time is the starting time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category transaction schedule includes the following steps S1021-S1023:
[0045] S1021. From the resource category trading schedule, query the opening time corresponding to the resource category of the operating target;
[0046] Specifically, after obtaining the market type and resource type of the target asset in the quantitative strategy, the opening time of the corresponding resource type under the corresponding market type can be found from the resource category trading schedule.
[0047] Using the previous example, assuming that the resource category of the target A is of the Chinese market type and the resource type is of the underlying stock type, the opening time of the underlying stock in the Chinese market can be found from the resource category trading schedule, such as 9:30 and 15:00.
[0048] S1022. Obtain the first duration between the current running time and the market opening time;
[0049] Specifically, if the opening time is multiple times, the first duration obtained is the time between the opening time that is before the current operating time and the opening time that is closest to the current operating time.
[0050] Using the previous example, if the current running time is 10:06, then the first duration between 9:30 and 10:06 is obtained, which is 36 minutes.
[0051] S1023. If the target time unit multiplied by N equals the first duration, then 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.
[0052] Specifically, if there are multiple target time units, then for each target time unit, a comparison is performed to determine whether multiplying each target time unit by N equals the first duration. For each target time unit, it is then determined whether the current running time is the starting time point. If the target time unit multiplied by N equals the target time unit corresponding to the first duration, then the current running time is determined to be the starting time point corresponding to that target time unit. If the target time unit multiplied by N does not equal the target time unit corresponding to the first duration, then the current running time is determined not to be the starting time point corresponding to that target time unit.
[0053] Continuing with the previous example, the target time units are 3 minutes, 5 minutes, and 15 minutes. The first duration is 36 minutes. For 1 minute, 3 minutes multiplied by 12 equals 36 minutes. Since 12 is a positive integer greater than 1, the current running time is the starting time corresponding to 3 minutes. For 5 minutes, 5 minutes multiplied by 7.2 equals 36 minutes. Since 7.2 is not a positive integer, the current running time is not the starting time corresponding to 5 minutes. Similarly, 15 minutes multiplied by 2.4 equals 36 minutes. Since 2.4 is not a positive integer, the current running time is not the starting time corresponding to 15 minutes.
[0054] S103. If so, retrieve the first market data corresponding to the running target and the target time unit from the cached data;
[0055] The first market data refers to the latest market data cached in the cache data.
[0056] 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 cached data, and the real-time market data of the running target at the target time unit at the current running time can be obtained based on the first market data.
[0057] Optionally, as shown in Figure 2, the cached data is cached and managed by the cache management module.
[0058] Specifically, during the live trading of the target quantitative strategy, the client on the terminal device will subscribe to the corresponding K-line data of the target and the target time unit from the back-end server (located on the server). After subscription, the back-end server will continuously push the K-line data corresponding to the target time unit to the cache for caching. When the first market data is needed, it will first search for it in the cached data in the cache.
[0059] Continuing with the previous example, as shown in Figure 3, when a user triggers the live execution of a target quantitative strategy through the client, they can synchronously retrieve and subscribe to the 3-minute, 5-minute, and 15-minute market data for the target A from the backend server. Subsequently, the backend server continuously pushes the 3-minute, 5-minute, and 15-minute market data to the client, allowing the client to cache this data in a cache. This ensures that when the client executes the target quantitative strategy again, it can preferentially retrieve the subscribed real-time market data for the target A from the cache. In addition, other market data that needs to be sent to the client can be sent to the user after data synchronization processing. The data synchronization processing is performed by the data synchronization processing module.
[0060] In summary, by pushing market data to the cache of the terminal device, the backend server can directly retrieve market data from the cache when it is necessary to frequently retrieve market data. This eliminates the need to call the backend server multiple times to obtain market data, thus significantly improving the efficiency of market data retrieval and meeting the requirements of high frequency and low latency.
[0061] Furthermore, the method further includes: 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 the cached data; determining the first market data as the real-time market data of the running target at the target time unit at the current running time; and executing the target quantification strategy based on the real-time market data of the running target at the target time unit at the current running time.
[0062] 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 the first market data can be directly determined as the real-time market data of the running target in the target time unit at the current running time. Then, based on the real-time market data of the running target in the target time unit at the current running time, the target quantification strategy is executed.
[0063] Continuing with the previous example, if the current running time is 10:06 and the opening time of the target A is 9:30, the current running time is not the opening time corresponding to the 5-minute candlestick data of the target. In this case, the first market data, that is, the latest data of the 5-minute candlestick data in the cache, is the candlestick data of the 5-minute candlestick from 10:05 to 10:10. At this time, the first market data can be directly pushed as the real-time market data of the target at the target time unit to execute the target quantitative strategy. As another example, if the current running time is not the opening time corresponding to the 15-minute candlestick data of the target, the first market data, that is, the latest data of the 15-minute candlestick data in the cache, is the candlestick data of the 15-minute candlestick from 10:00 to 10:15. At this time, the first market data can be directly pushed as the real-time market data of the target at the target time unit to execute the target quantitative strategy.
[0064] S104. If the first market data is not the real-time market data of the target at the target time unit at the current running time, obtain the second market data corresponding to the target and the candidate time unit at the current running time from the cache data, and construct the real-time market data of the target at the target time unit at the current running time based on the second market data.
[0065] 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 target under the current running time.
[0066] Understandably, as mentioned 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 new market data for that target time unit has been generated at the current running time. When executing the target quantitative strategy, it is necessary to make logical judgments based on the new market data. If the first market data is not the real-time market data of the target at the current running time, it means that new market data for that target time unit is missing at the current running time. Directly using the first market data will cause the quantitative strategy to make a judgment logic error when executing its corresponding trading conditions, thus failing to trigger trading operations or mistakenly triggering trading operations.
[0067] Optionally, the candidate time unit refers to a time unit shorter than that 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 candlestick data as an example, 1-minute candlestick data can be used to construct 3-minute candlestick data, and 3-minute candlestick data can be used to construct 15-minute candlestick data.
[0068] Optionally, the second market data is the real-time market data of the target at the current running time in the candidate time unit.
[0069] In one embodiment, for the target time unit of the market data subscribed in the target quantification strategy, a 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 target and the target time unit from the cached data, the method further includes: obtaining the candidate time unit matching the target time unit; determining the cache parameters according to the candidate time unit; obtaining the target market data corresponding to the target and the target time unit from the backend server and storing the target market data in the first cache area; obtaining the candidate market data corresponding to the target and the candidate time unit from the backend server and storing the candidate market data in the second cache area, wherein the second cache area is used to store the candidate market data according to the cache parameters, and the cache parameters may include a cache refresh frequency for indicating the second cache area.
[0070] It is understandable that both the target market data and candidate market data mentioned above are stored as cached data in the cache area (including the first cache area and the second cache area). The first market data corresponding to the target and target time unit is retrieved from the cached data; specifically, this can be retrieved from the cached data in the first cache area. The second market data corresponding to the target and candidate time unit at the current running time is retrieved from the cached data; specifically, this can be retrieved from the cached data in the second cache area. Furthermore, the cache refresh frequency of the second cache area differs from that of the first cache area. Since the candidate market data is not the actual market data used by the quantitative strategy, the cache refresh frequency of the second cache area is higher than that of the first cache area. This higher refresh frequency ensures that the candidate market data corresponding to the candidate time unit continuously stored in the second cache area is the latest data while deleting historical data to save storage space. Furthermore, 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 vice versa.
[0071] Furthermore, when storing target market data, various storage media and their corresponding storage methods can be set, such as memory, hard disk media, cloud storage media, etc. Then, based on the time point corresponding to the target market data, the target market data can be cached in different storage media using different storage methods. Specifically, information such as the runtime 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. Then, based on the above information, the storage parameters of the target market data are calculated as follows:
[0072] Where w represents the importance of the i-th target market data, and (Tcurr-Tmom(i)) represents the time interval between the i-th target market data point and the current running time. During the current run of the target quantification strategy, the importance of the i-th target market data decreases inversely with the time interval between it and the current running time, and further decreases with the increase of the running time (Tie). After obtaining the storage parameter w corresponding to the i-th target market data in the above way, the storage medium and storage method are determined based on the parameter threshold range of storage parameter w. For example, the larger the storage parameter w, the higher the importance of the i-th target market data, and the higher the probability that the target quantification strategy will use the data. The i-th target market data can be stored in a fast storage medium such as memory for caching to improve the access speed of the market data. The smaller the storage parameter w, the lower the importance of the i-th target market data, and the lower the probability that the target quantification strategy will use the data. The i-th target market data can be stored in a slow storage medium such as hard disk or cloud storage.
[0073] 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, the efficiency of market data storage and data acquisition is improved, thereby improving the running efficiency of the target quantitative strategy.
[0074] Specifically, as shown in Figure 2, the data synchronization processing module relies on the transaction timetable management module to determine whether the current running time is the opening time of the target time unit, and to determine whether the market data in the current cache is the latest market data of the target time unit.
[0075] Following the previous example, as shown in Figures 2 and 3, the data synchronization processing module obtains market data for a target time unit of 3 minutes, i.e., 3-minute candlestick data. The first market data corresponds to the time period of 10:03-10:06, and the current running time is also 10:06. This means that the first market data obtained from the cache is not the candlestick data of the new candlestick generated at 10:06 corresponding to the 3-minute candlestick of the running target A (i.e., the real-time market data corresponding to the target time unit). Therefore, the candlestick data of the new candlestick generated at 10:06 corresponding to the 1-minute candlestick of the running target A can be obtained from the cache data (i.e., the second market data). This candlestick data is used to construct the candlestick data of the new candlestick generated at 10:06 corresponding to the 3-minute candlestick.
[0076] Specifically, as shown in Figure 2, the data synchronization processing module is equipped with a method for constructing market data for a target time unit. Based on the latest second market data, the real-time market data of the target at the current running time in the target time unit is constructed. The relevant content on constructing K-line data of other periods based on K-line data of different periods will not be elaborated here. The data synchronization processing process shown in Figure 2 is executed in the data synchronization processing module.
[0077] For example, if the current time is 10:00, and the candlestick data of the newest candlestick for the 5-minute chart of the target has been obtained, but the candlestick data of the newest candlestick for the 10-minute chart is missing, then the latest candlestick data of the 10-minute chart of the target A can be constructed based on the latest candlestick data of the 5-minute chart of the target A, thus obtaining the corresponding real-time market data.
[0078] In summary, by acquiring K-line data from other periods (candidate time units) with the current running time as the opening time, real-time market data for the target time unit with the current running time as the opening time is constructed. This ensures that the acquired real-time market data for the target time unit is the latest data, guarantees that data from different periods are synchronized, and only constructs the real-time market data for the target time unit required by the client, without needing to construct real-time market data for all time units corresponding to the running target, thus saving a significant amount of computing resources.
[0079] Optionally, in the aforementioned S104, the step of constructing the real-time market data of the target at the current operating time in the target time unit based on the second market data includes the following steps S1051-S1052:
[0080] S1051. Obtain the opening price, highest price, lowest price, closing price, and trading volume of the second market data;
[0081] S1052. Construct real-time market data of the target stock at the target time unit based on the opening price, the highest price, the lowest price, the closing price, and the trading volume.
[0082] Specifically, how to construct real-time market data of the target stock at the current operating moment on the target time unit based on the opening price, the highest price, the lowest price, the closing price, and the trading volume will not be elaborated further here.
[0083] Optionally, the method further includes the following steps: if the second market data corresponding to the target and the candidate time unit at the current running time is not obtained from the cached data, then a waiting state is entered until the real-time market data of the target at the target time unit at the current running time is obtained, and the target quantification strategy is executed based on the real-time market data of the target at the target time unit at the current running time.
[0084] Specifically, as shown in Figure 2, the K-line data synchronization processing module also includes a method for synchronizing and waiting for the backend server to push market data for the target time unit. Specifically, it obtains the real-time market data corresponding to the target time unit based on a set waiting state. By setting a negligible waiting period, it obtains the latest real-time market data for the target time unit, avoiding the problem of asynchronous real-time market data for the same running instrument at different time units sent to the client. This achieves synchronization of real-time market data for different time units with a negligible waiting period, meeting the needs of scenarios with high timeliness requirements.
[0085] Optionally, the method further includes: if second market data corresponding to the target and candidate time unit at the current running time is not obtained from the cached data, then entering a waiting state until third market data corresponding to the target and candidate time unit at the current running time is obtained, then constructing real-time market data of the target at the target time unit at the current running time based on the third market data, and executing the target quantization strategy based on the real-time market data of the target at the target time unit at the current running time.
[0086] Optionally, entering the waiting state includes: starting a timer and repeatedly executing the check to see if there is real-time market data for the target at the target time unit at the current running time. If there is, it is considered that real-time market data corresponding to the target and the target time unit at the current running time has been obtained. Alternatively, it includes repeatedly executing the check to see if there is fourth market data corresponding to a time period with a start time of the current running time and a duration equal to the candidate time unit. If there is, it is considered that third market data corresponding to the target and the candidate time unit at the current running time has been obtained. The fourth market data is the third market data.
[0087] S105. Based on the real-time market data of the target asset at the target time unit at the current operating time, execute the target quantification strategy.
[0088] The process involves obtaining real-time market data for the target asset within a target time unit, triggering the execution of a target quantitative strategy. Specifically, executing the target quantitative strategy can involve obtaining technical indicator data indicated by the trading conditions within the target quantitative strategy based on the real-time market data within the target time unit, and then comparing whether this technical indicator data meets the specific conditions specified by the trading conditions. If the technical indicator corresponding to the target asset meets the specific conditions specified by the trading conditions in the target quantitative strategy, then the trading operation triggered by the fulfillment of the trading conditions in the target quantitative strategy is executed. For example, taking a moving average golden cross opening strategy as an example, after obtaining real-time market data for the target asset, such as daily candlestick data, the 5-day and 20-day moving average data of the target asset can be obtained based on the daily candlestick data. Then, it can be determined whether the moving average chart corresponding to the 5-day moving average data crosses above the moving average chart corresponding to the 20-day moving average data. If so, the trading operation triggered by the trading conditions, such as a buy order, is executed.
[0089] Optionally, the method further includes: when it is detected that the duration of entering the waiting state has exceeded a preset duration, the waiting state is ended, the first market data is used as the real-time market data of the target at the target time unit at the current running time, and the target quantification strategy is executed based on the real-time market data of the target at the target time unit at the current running time.
[0090] Specifically, the preset duration can be set according to the actual situation, for example, it can be set to a preset duration of 2 seconds.
[0091] Optionally, if the waiting period exceeds the preset duration, the market will enter a closed state by default. Then, the waiting state will end, and the latest market data for the target time unit corresponding to the running target will be returned from the cached data.
[0092] Specifically, in order to improve the efficiency of acquiring market data for the target time unit, a multi-threaded processing mode can be used to acquire the data. For example, a data retrieval thread and a background data processing thread can be set up. The data retrieval thread is used to push the market data for the target time unit required by the client to the client and wait for a delay. The background data processing thread is used to notify the data retrieval thread to cancel the delay and push the market data to the cache.
[0093] Specifically, as shown in Figure 2, the background data processing thread is managed by the background data processing module, which is used to handle protocol interfaces with the background, pull data, process pushed data, and parse it into quantized internal data and store it in the cache.
[0094] For example, as shown in Figure 4, which is a timing diagram of acquiring market data according to an exemplary embodiment of this application, the data retrieval thread retrieves the latest market data of the target object required by the client in time unit A from the cache. If it is not retrieved, the data retrieval thread enters a delay waiting state. The background data processing thread is used to retrieve the latest market data of time unit A from the background server. If the real-time market data of the target time unit is retrieved within a preset time period, or if the third market data corresponding to the target object and the candidate time unit is retrieved at the current running time, the data retrieval thread is notified to stop waiting, and the real-time market data of the target time unit or the third market data is retrieved. Real-time market data for the target time unit is pushed to the cache. The data retrieval thread pushes the real-time market data for the target time unit to the client. If the real-time market data for the target time unit is not retrieved within a preset time period, and no third market data corresponding to the target and the candidate time unit is retrieved at the current running time, the data retrieval thread is notified to stop waiting. The data retrieval thread then pushes the latest market data for the target time unit from the cache to the client. The latest market data for the target time unit in the cache refers to the market data corresponding to the time period whose closing time is the current running time or a time period before the current running time, and this time period is the latest time period recorded in the cache. Simultaneously, the background data processing thread processes background data in real time and pushes the subscribed market data to the cache in real time.
[0095] Optionally, please refer to Figure 5, which is a schematic diagram of a process for obtaining market data for a target time unit provided by an exemplary embodiment of this application, specifically:
[0096] The backend server continuously pushes market data subscribed to by the client. For example, at 10:06, the backend server pushes the 5-minute market data subscribed to by the client. When receiving market data requests from the client's API, the server first determines whether the market data needs to be constructed. If it needs to be constructed, it is processed; otherwise, it enters a waiting state. For example, if at 10:06 the client receives an API request for 3-minute market data for target A, the server first determines whether the 3-minute market data for target A needs to be constructed. If the latest 3-minute market data for target A is not in the cache, but the latest market data for target A in other time units exists, then it is determined that it needs to be constructed. The 3-minute market data is constructed based on the latest market data in other time units and returned to the client.
[0097] After entering the waiting state, determine whether the waiting time exceeds the preset time. If it does not exceed the preset time, check if the latest 3-minute market data exists in the cache. If it does, return directly to the client. Alternatively, check if market data for other time units of the running target A exists in the cache. If it does, construct the 3-minute market data based on the latest market data for other time units and return it to the client.
[0098] If the waiting time exceeds the preset time, the previous 3-minute market data in the cache will be returned to the client directly. The previous 3-minute market data in the cache refers to the market data corresponding to the opening time closest to the current running time.
[0099] In summary, the solution provided in this application, in response to the operation of a target quantification strategy, obtains the current running time, the target asset in the target quantification strategy, and the target time unit of the market data subscribed to in the target quantification strategy; obtains the resource category of the target asset; and determines whether the current running time is the start time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category trading schedule; if so, it obtains first market data corresponding to the target asset and the target time unit from cached data; if the first market data is not the real-time market data of the target asset at the current running time, it obtains second market data corresponding to the target asset and the candidate time unit at the current running time from cached data, and constructs real-time market data of the target asset at the target time unit at the current running time based on the second market data; and executes the target quantification strategy based on the real-time market data of the target asset at the target time unit at the current running time. Target real-time market data is constructed based on existing market data. This approach avoids constructing unnecessary market data (i.e., avoiding the construction of market data not requested by the target quantification strategy), thus preventing the waste of computing resources. It also ensures that the market data related to the target is synchronized at every moment without waiting for all market data related to the target. The target quantification strategy is executed only based on the target's real-time market data, avoiding execution based on all market data related to the target, which would result in more redundant information and higher costs, thus saving significant server bandwidth costs. This achieves market data synchronization without causing delays at the market data closing time, saving bandwidth and computing resources.
[0100] Figure 6 is a schematic diagram of a market data processing device provided in an exemplary embodiment of this application; wherein the device includes:
[0101] The acquisition unit 21 is used to acquire the current running time, the running target in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy in response to the operation of the target quantification strategy.
[0102] The determining unit 22 is used 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 based on the target time unit, the resource category and the resource category transaction timetable;
[0103] The acquisition unit 21 is further configured to, if so, acquire first market data corresponding to the running target and the target time unit from the cached data;
[0104] The acquisition unit 21 is further configured to, if the first market data is not the real-time market data of the target at the target time at the current running time, acquire the second market data corresponding to the target and the candidate time unit at the current running time from the cache data, and construct the real-time market data of the target at the target time at the current running time based on the second market data;
[0105] The execution unit 23 is used to execute the target quantification strategy based on the real-time market data of the target at the target time unit at the current running time.
[0106] Optionally, the device is further configured to: if the current running time is not the starting time point corresponding to the target time unit, obtain first market data corresponding to the running target and the target time unit from the cached data; determine the first market data as the real-time market data of the running target at the target time unit at the current running time; and execute 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.
[0107] Optionally, the device is further configured to: if second market data corresponding to the target and the candidate time unit at the current running time is not obtained from the cached data, enter a waiting state until real-time market data corresponding to the target and the target time unit at the current running time is obtained, execute the target quantization strategy based on the real-time market data of the target at the target time unit at the current running time, or until third market data corresponding to the target and the candidate time unit at the current running time is obtained, execute the target quantization strategy based on the third market data to construct real-time market data of the target at the target time unit at the current running time, and execute the target quantization strategy based on the real-time market data of the target at the target time unit at the current running time.
[0108] Optionally, the device, in the context of entering the waiting state, is specifically configured to: start timing and repeatedly execute the detection of whether there is real-time market data corresponding to a time period whose start time is the current running time and whose duration is the target time unit; if such data exists, it is considered that real-time market data corresponding to the running target and the target time unit at the current running time has been obtained; or repeatedly execute the detection of whether there is fourth market data corresponding to a time period whose start time is the current running time and whose duration is the candidate time unit; if such data exists, it is considered that third market data corresponding to the running target and the candidate time unit at the current running time has been obtained, wherein the fourth market data is the third market data.
[0109] 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, take the first market data as the real-time market data of the target at the target time unit at the current running time, and execute the target quantification strategy based on the real-time market data of the target at the target time unit at the current running time.
[0110] Optionally, the device is used to determine whether the current running time is the starting time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category trading schedule. Specifically, it is used to: query the opening time corresponding to the resource category of the running target from the resource category trading schedule; obtain the first duration between the current running time and the opening time; if the target time unit multiplied by N equals the first duration, then 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.
[0111] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, they will not be repeated 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 correspond to the corresponding processes in the various methods in the above method embodiments, which will not be repeated here for the sake of brevity.
[0112] The apparatus of this application embodiment has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the method disclosed in this application embodiment can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0113] Figure 7 is a schematic block diagram of an electronic device provided in an embodiment of this application. The electronic device may include:
[0114] The system includes a memory 301 and a processor 302. The memory 301 stores computer programs and transfers the program code to the processor 302. In other words, the processor 302 can retrieve and run the computer programs from the memory 301 to implement the methods described in the embodiments of this application.
[0115] For example, the processor 302 can be used to execute the above-described method embodiments according to instructions in the computer program.
[0116] In some embodiments of this application, the processor 302 may include, but is not limited to:
[0117] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0118] In some embodiments of this application, the memory 301 includes, but is not limited to:
[0119] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be 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 SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0120] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 301 and executed by the processor 302 to perform the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0121] As shown in Figure 7, the electronic device may further include:
[0122] Transceiver 303, which can be connected to processor 302 or memory 301.
[0123] The processor 302 can control the transceiver 303 to communicate with other devices; specifically, it can 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 antennas, and the number of antennas may be one or more.
[0124] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0125] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, embodiments of this application also provide a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0126] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can 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)).
[0127] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0128] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0129] The modules described as separate components may or may not be physically separate. 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 to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0130] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for processing market data, characterized in that, include: In response to the operation of the target quantification strategy, the current running time, the running target in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy are obtained; Obtain the resource category of the target object, and determine whether the current running time is the starting time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category transaction schedule; If so, retrieve 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 target at the target time unit at the current running time, the second market data corresponding to the 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 target at the target time unit at the current running time is constructed based on the second market data. Based on the real-time market data of the target asset at the current operating time within the target time unit, the target quantification strategy is executed.
2. The method according to claim 1, characterized in that, The method further includes: 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 is obtained from the cached data; The first market data is determined as the real-time market data of the target stock in the target time unit at the current running time. Based on the real-time market data of the target asset at the current operating moment in the target time unit, the target quantification strategy is executed.
3. The method according to claim 1, characterized in that, The method further includes: 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 cached data, then a waiting state is entered; Until real-time market data of the target asset at the target time unit is obtained at the current operating time, the target quantification strategy is executed based on the real-time market data of the target asset at the target time unit at the current operating time; or until third market data corresponding to the target asset and the candidate time unit at the current operating time is obtained, real-time market data of the target asset at the target time unit at the current operating time is constructed based on the third market data, and the target quantification strategy is executed based on the real-time market data of the target asset at the target time unit at the current operating time.
4. The method according to claim 3, characterized in that, The entry into the waiting state includes: Start timing and repeatedly check if real-time market data for the target asset exists at the target time unit at the current running time. If it exists, it is considered that real-time market data corresponding to the target asset and the target time unit has been obtained at the current running time; or Start timing and repeatedly execute the check to see if there is third market data corresponding to the target and the candidate time unit at the current running time. If there is, it is considered that the third market data corresponding to the target and the candidate time unit at the current running time has been obtained.
5. The method according to claim 3, characterized in that, The method further includes: when it is detected that the duration of entering the waiting state has exceeded a preset duration, the waiting state is ended, the first market data is used as the real-time market data of the target at the target time unit at the current running time, and the target quantification strategy is executed based on the real-time market data of the target at the target time unit at the current running time.
6. The method according to claim 1, characterized in that, The step of determining whether the current running time is the starting time point corresponding to the target time unit based on the target time unit, the resource category, and the resource category transaction schedule includes: From the resource category trading schedule, query the opening time corresponding to the resource category of the operating target; Obtain the first duration between the current running time and the market opening time; If the target time unit multiplied by N equals the first duration, then 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. The method according to claim 1, characterized in that, Before retrieving the first market data corresponding to the running target and the target time unit from the cached data, the method includes: Obtain the candidate time unit that matches the target time unit; determine the cache parameters based on the candidate time unit; obtain the first market data corresponding to the running target and the target time unit from the backend server, and store the first market data in the first cache area; obtain the candidate market data corresponding to the running target and the candidate time unit from the backend server, and store the candidate market data in the second cache area; The second cache area is used to store the candidate market data according to the cache parameters, the cache parameters including the cache refresh frequency of the second cache area, the cache refresh frequency of the second cache area being greater than the cache refresh frequency of the first cache area.
8. The method according to claim 1, characterized in that, The step of constructing real-time market data for the target asset at the current operating time in the target time unit based on the second market data includes: Obtain the opening price, highest price, lowest price, closing price, and trading volume of the second market data; The real-time market data of the target stock at the current operating moment is constructed based on the opening price, the highest price, the lowest price, the closing price, and the trading volume, within the target time unit.
9. A market data processing device, characterized in that, include: The acquisition unit is used to acquire the current running time, the running target in the target quantification strategy, and the target time unit of the market data subscribed in the target quantification strategy in response to the operation of the target quantification strategy. The determining unit is used 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 based on the target time unit, the resource category and the resource category transaction 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 target at the target time unit at the current running time, acquire the second market data corresponding to the target and the candidate time unit at the current running time from the cache data, and construct the real-time market data of the target at the target time unit at the current running time based on the second market data; The execution unit is used to execute the target quantification strategy based on the real-time market data of the target at the target time unit at the current running time.
10. The apparatus according to claim 9, 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, the first market data corresponding to the running target and the target time unit is obtained from the cached data; The first market data is determined as the real-time market data of the target stock in the target time unit at the current running time. Based on the real-time market data of the target asset at the current operating moment in the target time unit, the target quantification strategy is executed.
11. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1-8 by executing the executable instructions.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-8.