Algorithmic trading strategy execution method, device, equipment and readable storage medium

By loading policy templates and execution plans in the algorithm trading platform, allocating thread resources, and optimizing data distribution using producer-consumer model and memory buffer queue, the problems of waste of server resources and low performance are solved, and efficient algorithm trading strategy execution is achieved.

CN120047246BActive Publication Date: 2025-08-29CHANGJIANG SECURITIES
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510341511.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-08-29
Estimated Expiration
2045-03-21

AI Technical Summary

Technical Problem

The existing algorithm trading platform has high resource overhead and low operating performance, making it difficult to support the efficient operation of a large number of algorithm trading strategies.

Method used

By loading the algorithmic trading strategy function templates and execution plans, thread resources are allocated according to the policy complexity and number of tasks, the producer-consumer model is used to distribute the index data, and the queue storage is buffered in memory, optimize the use of thread resources, and reduce the performance losses caused by frequent creation and destruction.

Benefits of technology

It improves the server's operating performance, supports the efficient operation of more algorithmic trading strategies, saves thread resource overhead, and reduces latency and delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047246B_ABST
    Figure CN120047246B_ABST
Patent Text Reader

Abstract

A method, apparatus, device, and readable storage medium for executing an algorithmic trading strategy. The algorithmic trading strategy execution method includes: an execution program loading multiple algorithmic trading strategy function templates and multiple execution plans; the execution program creating and allocating threads for each algorithmic trading strategy function template based on the complexity of each algorithmic trading strategy function template and the number of execution tasks to be executed; the execution program receiving real-time trading market data and distributing the real-time trading market data to the corresponding execution plan; for the corresponding execution plan, calling the corresponding thread to calculate the execution task and obtain a calculation result; if the calculation result includes a trading signal, generating a trading order based on the trading signal and submitting the trading order to the trading counter. Through this application, the server's thread resource overhead can be saved, and a larger number of algorithmic trading strategies can be supported to run simultaneously and efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of financial trading system platforms, and in particular to an algorithmic trading strategy execution method, apparatus, device, and readable storage medium. Background Art

[0002] In today's rapidly evolving global financial markets, algorithmic trading, a trading method centered around quantitative algorithms, has significantly changed the landscape of financial transactions. Algorithmic trading utilizes computer programs to receive massive amounts of market data in real time, modeling and analyzing algorithmic strategies to quickly identify trading opportunities, thereby achieving high efficiency, low risk, and consistently stable trading performance.

[0003] Currently, securities firms or third-party service providers provide algorithmic trading platforms, which provide users with financial algorithmic trading services by uploading user-written algorithmic trading strategies to cloud servers for execution.

[0004] However, current algorithmic trading platforms have problems such as high server resource overhead and low operating performance, making it difficult to support a large number of algorithmic trading strategies running efficiently at the same time. Summary of the Invention

[0005] The present application provides an algorithmic trading strategy execution method, apparatus, device and readable storage medium, aiming to solve the technical problems of current algorithmic trading platforms, such as large server resource overhead and low operating performance, which make it difficult to support a large number of algorithmic trading strategies to run efficiently at the same time.

[0006] In a first aspect, an embodiment of the present application provides a method for executing an algorithmic trading strategy, the method comprising:

[0007] The execution program loads a plurality of algorithmic trading strategy function templates and a plurality of execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of the one or more algorithmic trading strategy function templates;

[0008] The execution program creates and allocates threads for each algorithmic trading strategy function template based on the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be performed;

[0009] The execution program receives real-time transaction market data and distributes the real-time transaction market data to the corresponding execution plan;

[0010] For the corresponding execution plan, call the corresponding thread to calculate the execution task and obtain the calculation result;

[0011] If the calculation result includes a trading signal, a trading order is generated based on the trading signal and the trading order is submitted to the trading counter.

[0012] Optionally, before the execution program loads multiple algorithmic trading strategy function templates and multiple execution plans, the process includes:

[0013] For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates;

[0014] Based on the algorithmic trading strategy function template, visual trading target screening, parameter configuration and task execution sequence are determined to obtain the execution plan.

[0015] Optionally, the execution program receives real-time transaction market data, and distributes the real-time transaction market data to the corresponding execution plan, including:

[0016] The execution program receives real-time trading market data and encapsulates the real-time trading market data into multiple time series message queues according to data type and timestamp;

[0017] Each time series message queue is regarded as a producer, and each execution plan is regarded as a consumer. Real-time trading market data is distributed to the corresponding execution plan according to the producer-consumer model.

[0018] Optionally, a circular array buffer is used in memory to store multiple time series message queues.

[0019] Optionally, the algorithmic trading strategy function template, execution plan and parameter configuration corresponding to the execution plan are all loaded into memory.

[0020] Optionally, the server running the execution program, the server sending the real-time trading market data, and the trading counter server are deployed in the same network segment of the same computer room.

[0021] In a second aspect, an embodiment of the present application provides an algorithmic trading strategy execution device, the algorithmic trading strategy execution device comprising:

[0022] A loading module is used to execute a program to load multiple algorithmic trading strategy function templates and multiple execution plans, where each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of one or more algorithmic trading strategy function templates;

[0023] an allocation module for executing a program to create and allocate threads for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks to be performed;

[0024] The distribution module is used to execute the program to receive real-time trading market data and distribute the real-time trading market data to the corresponding execution plan;

[0025] The calculation module is used to call the corresponding thread to calculate the execution task according to the corresponding execution plan and obtain the calculation result;

[0026] The reporting module is used to generate a trading order according to the trading signal if the calculation result includes a trading signal, and report the trading order to the trading counter.

[0027] Optionally, the algorithmic trading strategy execution device further includes a modeling and configuration module, which is used to:

[0028] For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates;

[0029] Based on the algorithmic trading strategy function template, visually screen the trading targets, configure the parameters and determine the order of execution tasks to obtain the execution plan

[0030] In a third aspect, an embodiment of the present application provides an algorithmic trading strategy execution device, which includes a processor, a memory, and an algorithmic trading strategy execution program stored on the memory and executable by the processor, wherein when the algorithmic trading strategy execution program is executed by the processor, the steps of the algorithmic trading strategy execution method described above are implemented.

[0031] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which an algorithmic trading strategy execution program is stored, wherein when the algorithmic trading strategy execution program is executed by a processor, the steps of the algorithmic trading strategy execution method as described above are implemented.

[0032] The beneficial effects of the technical solutions provided in the embodiments of the present application include:

[0033] In an embodiment of the present application, the execution program loads multiple algorithmic trading strategy function templates and multiple execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of one or more algorithmic trading strategy function templates; the execution program creates and allocates threads for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed; the execution program receives real-time trading market data and distributes the real-time trading market data to the corresponding execution plan; for the corresponding execution plan, the corresponding thread is called to calculate the execution task to obtain a calculation result; if the calculation result includes a trading signal, a trading order is generated according to the trading signal, and the trading order is submitted to the trading counter. The embodiment of the present application is through, the current traditional algorithmic trading platform does not perform functional splitting and modeling of various algorithmic trading strategies, and the algorithmic trading platform needs to create and allocate thread resources for each type of algorithmic trading strategy reported by each user. The created and allocated thread resources cannot be reused between the algorithmic trading strategies of each user, resulting in excessive overhead of server resources. This application creates and allocates appropriate thread resources for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed after loading the algorithmic trading strategy function template and execution plan. The thread resources created and allocated for each algorithmic trading strategy function template can be repeatedly called by the execution tasks in the execution plan of each user. That is, if the execution tasks in the execution plan of each user use the same algorithmic trading strategy function template, the corresponding same thread resources will be called, thereby saving the overall thread resource overhead of the server. There is no need to create additional threads for the execution plan, avoiding the server performance overhead caused by frequent creation and destruction of threads, improving the server operation performance of the algorithmic trading platform, and being able to support a larger number of algorithmic trading strategies to run efficiently at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of an embodiment of the algorithmic trading strategy execution method of the present application;

[0035] Figure 2 This is a schematic diagram of the algorithmic trading platform system architecture according to an embodiment of the algorithmic trading strategy execution method of the present application;

[0036] Figure 3 This is a schematic diagram of the construction and use of an algorithmic trading strategy function template in accordance with an embodiment of the algorithmic trading strategy execution method of the present application;

[0037] Figure 4 For this application Figure 1 Detailed flow chart of step S30;

[0038] Figure 5This is a schematic diagram of the execution architecture of the execution program of an embodiment of the algorithmic trading strategy execution method of the present application;

[0039] Figure 6 This is a functional module diagram of an embodiment of the algorithmic trading strategy execution device of the present application;

[0040] Figure 7 This is a schematic diagram of the hardware structure of the algorithmic trading strategy execution device involved in the embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0042] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0043] In a first aspect, an embodiment of the present application provides a method for executing an algorithmic trading strategy.

[0044] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the algorithmic trading strategy execution method of this application, as shown in FIG. Figure 1 As shown, the algorithmic trading strategy execution methods include:

[0045] Step S10, the execution program loads multiple algorithmic trading strategy function templates and multiple execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of one or more algorithmic trading strategy function templates.

[0046] In this embodiment, refer to Figure 2 , Figure 2 This is a schematic diagram of the algorithmic trading platform system architecture of an embodiment of the algorithmic trading strategy execution method of this application, such as Figure 2As shown, the execution program runs in the server of the algorithmic trading platform, which is the system execution program of the algorithmic trading platform. The algorithmic trading platform is used to provide a large number of users with managed execution services for algorithmic trading strategies. The execution program of the algorithmic trading platform can be run after the opening of each trading day. After running, multiple algorithmic trading strategy function templates and multiple execution plans are loaded. Each algorithmic trading strategy function template can be modeled based on the quantitative characteristics of various algorithmic trading strategies. Each user can use a visual algorithmic trading terminal to configure parameters for one or more algorithmic trading strategy function templates to obtain an execution task. By executing the task, a certain algorithmic trading strategy function is realized for the user, such as realizing trading volume. The average price calculation function in the weighted average price strategy consists of one or more execution tasks forming an execution plan. Specifically, each algorithmic trading strategy function template and each execution plan can be stored in the strategy warehouse of the algorithmic trading platform server. The algorithmic trading platform user uses a visual algorithmic trading terminal to configure parameters for one or more algorithmic trading strategy function templates to obtain an execution task and then an execution plan. The execution plan is then uploaded to the strategy warehouse of the algorithmic trading platform server. When the execution program is initialized, each algorithmic trading strategy function template and each execution plan are read from the strategy warehouse, and each algorithmic trading strategy function template and each execution plan are loaded into the server memory of the algorithmic trading platform.

[0047] Step S20 , the execution program creates and allocates a thread for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed.

[0048] In this embodiment, the execution tasks and execution plans are obtained by configuring the parameters of each algorithmic trading strategy function template. Appropriate thread resources are created and allocated for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed. For example, the algorithmic trading strategy function template includes current price calculation, average price calculation, index calculation, etc. Some algorithmic trading strategy function templates have high computational complexity and are called for execution more times by the execution tasks, so more thread resources need to be allocated to them accordingly.

[0049] Step S30: The execution program receives the real-time transaction market data and distributes the real-time transaction market data to the corresponding execution plan.

[0050] In this embodiment, the execution program receives massive amounts of high-frequency, real-time financial trading market data from upstream market data sources and trading gateways, which are used as triggers for algorithmic trading strategies, and uses this data as the event signal for triggering the execution plan. This massive amount of high-frequency, real-time financial trading market data may include market source timestamps, securities markets, securities codes, index codes, current market prices, trading order prices, total trading order volume, real-time trading volume, real-time trading amount, transaction accounts, and transaction times. Specifically, real-time trading market data may be distributed according to the data sources subscribed to by the execution plan. For example, if an execution plan subscribes to real-time trading volume data for a particular stock, this data will be distributed to the execution plan to drive its execution.

[0051] Step S40: for the corresponding execution plan, call the corresponding thread to calculate the execution task and obtain the calculation result.

[0052] In this embodiment, since the execution plan includes one or more execution tasks, and each execution task is obtained based on the parameter configuration of one or more algorithmic trading strategy function templates, that is, each execution task realizes the corresponding function through one or more algorithmic trading strategy function templates, in step S20, corresponding thread resources are created and allocated for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed. Therefore, when a certain execution plan is specifically executed, for each execution task in the execution plan, the thread resources corresponding to the algorithmic trading strategy function template in the execution task are called to perform calculations, and calculation results are obtained for each execution task. For the link job formed by multiple execution tasks in sequence according to the execution plan, the settlement result of the upstream execution task is used as the input of the downstream execution task for calculation, and finally the calculation result of the entire execution plan is obtained.

[0053] Step S50: If the calculation result includes a trading signal, a trading order is generated according to the trading signal, and the trading order is submitted to the trading counter.

[0054] In this embodiment, if the calculation result includes a trading signal, that is, the execution plan gives a signal that a transaction can be carried out after calculation by the algorithmic trading strategy, a trading order is generated based on the trading signal and submitted to the trading counter, thereby realizing a custodial execution service based on the algorithmic trading strategy for the user.

[0055] In this embodiment, the execution program runs in the server of the algorithmic trading platform and is the system execution program of the algorithmic trading platform. The execution program can be run after the opening of each trading day. After running, multiple algorithmic trading strategy function templates and multiple execution plans are loaded. According to the complexity of each algorithmic trading strategy function template and the number of execution tasks that need to be executed, appropriate thread resources are created and allocated for each algorithmic trading strategy function template. The execution program receives massive high-frequency real-time financial trading market data for triggering the algorithmic trading strategy from the upstream market data source and the trading gateway, and uses this as the event signal for triggering the execution plan. When a specific execution plan is executed, for each execution task in the execution plan, the thread resource corresponding to the algorithmic trading strategy function template in the execution task is called to perform the calculation, and the calculation result is obtained for each execution task. If the calculation result includes a trading signal, that is, the execution plan can be carried out after the calculation of the algorithmic trading strategy. If a transaction signal is received, a transaction order is generated according to the transaction signal, and the transaction order is submitted to the trading counter, thereby realizing a managed execution service based on the algorithmic trading strategy for the user. The thread resources created and allocated for each algorithmic trading strategy function template can be repeatedly called by the execution tasks in the execution plan of each user, that is, if the execution tasks in the execution plan of each user use the same algorithmic trading strategy function template, the corresponding same thread resources will be called. Compared with the traditional algorithmic trading platform, which needs to create and allocate thread resources for each type of algorithmic trading strategy reported by each user, resulting in excessive server resource overhead, the embodiment of the present application saves the overall thread resource overhead of the server, does not need to create additional threads for the execution plan, avoids the server performance overhead caused by frequent creation and destruction of threads, improves the server operation performance of the algorithmic trading platform, and can support a larger number of algorithmic trading strategies to run efficiently at the same time.

[0056] Furthermore, in one embodiment, before step S10, the following steps are included:

[0057] For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates;

[0058] Based on the algorithmic trading strategy function template, visual trading target screening, parameter configuration and task execution sequence are determined to obtain the execution plan.

[0059] In this embodiment, refer to Figure 3 , Figure 3 This is a schematic diagram of the construction and use of the algorithmic trading strategy function template of an embodiment of the algorithmic trading strategy execution method of this application, as shown in FIG. Figure 3As shown in the figure, various mainstream algorithmic trading strategies include arbitrage strategies, momentum strategies, trend tracking, transaction-driven, order splitting strategies, timing strategies and hedging strategies. For various mainstream algorithmic trading strategies, based on the mathematical models, underlying data structures and public template functions provided by the strategy template warehouse, the algorithmic trading strategies can be encapsulated into standardized and structured algorithmic trading strategy template configuration implementation classes according to various quantitative characteristics. The algorithmic trading strategy template configuration implementation class is the algorithmic trading strategy function template. The algorithmic trading strategy template configuration implementation class provides a public interface for standard parameter input and calculation result output, which is called for the parameter configuration reporting of the execution plan of the algorithmic trading platform user and the specific execution of the execution plan. Among them, the quantitative characteristics can be divided into current price, average price, index, trading volume, main force distribution, rise and fall, turnover rate and volatility according to the dimensions of price, quantity and time. After modeling and obtaining multiple algorithmic trading strategy function templates, the algorithmic trading platform can provide users with a visual algorithmic trading terminal operation interface to greatly reduce the entry threshold for individual users. The visual algorithmic trading terminal can specifically include a target screening module: the algorithmic trading platform users upload the range of securities trading targets involved in the algorithmic trading strategy, such as A shares, on-exchange funds, convertible bonds and options, etc., where users can explicitly enter a restricted target list, or select based on the trading market, or based on the target's own special attributes (such as new stocks, ST stocks, daily limit and small market capitalization, etc.); strategy template library module: based on each algorithmic trading strategy function template, it provides users with free selection through a visual configuration menu; parameter module : Based on the strategy template library, a strategy parameter setting menu is provided for the strategy template configuration implementation class. Users enter the personalized parameter configuration of the selected strategy template through this module, as well as the global parameter configuration applicable to the overall strategy, such as position setting, trading cycle, risk control setting, take-profit and stop-loss setting, etc.; Execution plan module: This module provides a canvas tool for configuring the execution plan of the selected strategy function template combination in the algorithmic trading program. Users arrange the selected strategy function template combination by dragging and dropping, and configure the link sequence of parallel or serial execution between each strategy function template, as well as the logical function of data conversion between each strategy function template, and finally obtain the final execution plan based on the algorithmic trading strategy.

[0060] Furthermore, in one embodiment, referring to Figure 4 , Figure 4 For this application Figure 1 The detailed flow chart of step S30 is as follows: Figure 4 As shown, step S30 includes:

[0061] Step S301: Execute a program to receive real-time trading market data and encapsulate the real-time trading market data into multiple time-series message queues according to data type and timestamp;

[0062] In step S302 , each time series message queue is regarded as each producer, and each execution plan is regarded as each consumer, and the real-time transaction market data is distributed to the corresponding execution plan according to the producer-consumer model.

[0063] In this embodiment, refer to Figure 5 , Figure 5 This is a schematic diagram of the execution program execution architecture of an embodiment of the algorithmic trading strategy execution method of this application, such as Figure 5 As shown, a message source decoding program can be used to access upstream market data sources and trading gateways. The received massive, high-frequency, real-time financial trading market data is then grouped, fragmented, and prioritized before being multicasted via time-series message queues to various downstream execution plan calls. Specifically, real-time financial trading market data can be encapsulated into multiple time-series message queues, such as Data Source A, Data Source B, and Data Source C, in the order of data type and data source timestamp. These serve as event-driven signals for each downstream execution plan, where A1-D3 represent the compute nodes of each algorithmic trading strategy function template. The algorithmic trading platform's execution program is built using a streaming computing framework that adopts a producer-consumer model. Specifically, each time-series message queue is treated as a producer, and each execution plan as a consumer. Real-time trading market data is distributed to the corresponding execution plan according to the producer-consumer model.

[0064] In this embodiment, the streaming computing framework adopts a decentralized cluster deployment method. The computing nodes are in a multi-active relationship with each other to ensure that the service is still valid when a single node fails. The calculation results obtained by the same multi-active nodes are deduplicated according to the execution plan to ensure the uniqueness of the transaction signal triggering.

[0065] In this embodiment, during operation, the streaming computing framework dynamically groups and shards the memory queue written by the data source based on indicators such as the throughput of the data type sent by the exchange, the complexity of the execution tasks included in the execution plan, the number of execution tasks, and the real-time hardware occupancy of the thread resources allocated to each algorithmic trading strategy function template, so as to achieve dynamic scheduling of service thread resources and achieve load balancing of its computing power.

[0066] In this embodiment, the streaming computing framework monitors indicators such as the throughput size of the data type, the complexity of the link jobs included in the user policy execution plan, the number of user policy settings, and the real-time hardware occupancy of the thread resources allocated to each algorithmic trading strategy function template in real time. Through the consistent hashing algorithm, it dynamically adjusts the number of memory queues and sharding rules contained in each consumer group process to ensure that the hardware occupancy and node throughput of each consumer group node are evenly distributed.

[0067] In this embodiment, the streaming computing framework can achieve orderly parallel processing of unified data types through thread isolation technology, optimize the CPU core false sharing problem by using cache line filling, and adopt system-level optimization methods such as CAS (Compare and Swap) lock-free computing model and CPU thread affinity binding to further improve computing performance.

[0068] In this embodiment, the intermediate cache data generated during the execution of the execution plan is stored in the running memory of the computing node and synchronized with each other through internal message queues. Unlike traditional data middleware storage methods, the intermediate data generated by the execution plan is stored in the same process as the node application and shares the running memory with the node application. This method avoids the network delay caused by the node application service accessing the intermediate data and can significantly improve operational efficiency in high-frequency traffic scenarios. Through the full-memory streaming computing framework and its high-availability solution design, the operation of the algorithmic trading strategy can achieve elastic expansion and real-time failover, and the stability of the algorithmic trading strategy service can be guaranteed on the basis of high concurrency and low latency.

[0069] Furthermore, in one embodiment, a ring array buffer is used in the memory to store multiple time series message queues.

[0070] In this embodiment, the memory queue to which the multiple time series message queues are written is composed of multiple ring array buffers. The use of the ring array buffer makes memory utilization more efficient and avoids performance loss caused by system garbage collection.

[0071] Furthermore, in one embodiment, the algorithmic trading strategy function template, execution plan, and parameter configuration corresponding to the execution plan are all loaded into the memory.

[0072] In this embodiment, the execution program loads the algorithmic trading strategy function template, execution plan, and parameter configuration corresponding to the execution plan into memory. On the one hand, this can ensure data persistence and prevent data loss. On the other hand, data memorization can greatly reduce latency and avoid performance losses caused by disk reading and network I / O (Input / Output) during the execution of the program.

[0073] Furthermore, in one embodiment, the server running the execution program, the server sending the real-time transaction market data, and the transaction counter server are deployed in the same network segment of the same computer room.

[0074] In this embodiment, the server running the execution program, the server sending real-time trading market data, and the trading counter server are deployed in the same network segment of the same computer room, supporting 24 / 7 power supply and operation and maintenance services. Compared with the traditional method that requires users to run services locally, this deployment model significantly shortens the physical link of the overall transaction, minimizes the link delay of algorithmic trading, and further ensures the stability of user strategy operation.

[0075] In a second aspect, an embodiment of the present application also provides an algorithmic trading strategy execution device.

[0076] In one embodiment, referring to Figure 6 , Figure 6 This is a functional module diagram of an embodiment of the algorithmic trading strategy execution device of the present application, as shown in FIG. Figure 6 As shown, the algorithmic trading strategy execution device includes:

[0077] A loading module 10 is configured to execute a program to load multiple algorithmic trading strategy function templates and multiple execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of one or more algorithmic trading strategy function templates;

[0078] An allocation module 20 is configured to execute a program to create and allocate threads for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks to be performed;

[0079] The distribution module 30 is used to execute the program to receive the real-time transaction market data and distribute the real-time transaction market data to the corresponding execution plan;

[0080] The calculation module 40 is used to call the corresponding thread to calculate the execution task according to the corresponding execution plan and obtain the calculation result;

[0081] The reporting module 50 is configured to generate a transaction order based on the transaction signal if the calculation result includes the transaction signal, and report the transaction order to the trading counter.

[0082] Furthermore, in one embodiment, the algorithmic trading strategy execution device further includes a modeling and configuration module for:

[0083] For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates;

[0084] Based on the algorithmic trading strategy function template, visual trading target screening, parameter configuration and task execution sequence are determined to obtain the execution plan.

[0085] Furthermore, in one embodiment, the distribution module 30 is configured to:

[0086] The execution program receives real-time trading market data and encapsulates the real-time trading market data into multiple time series message queues according to data type and timestamp;

[0087] Each time series message queue is regarded as a producer, and each execution plan is regarded as a consumer. Real-time trading market data is distributed to the corresponding execution plan according to the producer-consumer model.

[0088] Furthermore, in one embodiment, a ring array buffer is used in the memory to store multiple time series message queues.

[0089] Furthermore, in one embodiment, the algorithmic trading strategy function template, execution plan, and parameter configuration corresponding to the execution plan are all loaded into the memory.

[0090] Furthermore, in one embodiment, the server running the execution program, the server sending the real-time transaction market data, and the transaction counter server are deployed in the same network segment of the same computer room.

[0091] Among them, the functional implementation of each module in the above-mentioned algorithmic trading strategy execution device corresponds to the various steps in the above-mentioned algorithmic trading strategy execution method embodiment, and its functions and implementation processes will not be repeated here one by one.

[0092] In a third aspect, an embodiment of the present application provides an algorithmic trading strategy execution device.

[0093] Reference Figure 7 , Figure 7 Schematic diagram of the hardware structure of the algorithmic trading strategy execution device involved in the embodiment of the present application. In the embodiment of the present application, the algorithmic trading strategy execution device may include a processor, a memory, a communication interface and a communication bus.

[0094] The communication bus may be of any type and is used to interconnect the processor, memory, and communication interface.

[0095] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces, which interconnect components within the algorithmic trading strategy execution device and connect the algorithmic trading strategy execution device to other devices (such as other computing devices or user devices). Physical interfaces can be Ethernet, fiber optic, or ATM interfaces; user devices can be displays or keyboards.

[0096] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0097] The processor may be a general-purpose processor that can invoke an algorithmic trading strategy execution program stored in a memory and execute the algorithmic trading strategy execution method provided in the embodiments of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the algorithmic trading strategy execution program is invoked can be referenced in the various embodiments of the algorithmic trading strategy execution method of the present application and will not be further described here.

[0098] Those skilled in the art will understand that Figure 7 The hardware structure shown in the figure does not constitute a limitation to the present application and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0099] In a fourth aspect, an embodiment of the present application also provides a readable storage medium.

[0100] The readable storage medium of the present application stores an algorithmic trading strategy execution program, wherein when the algorithmic trading strategy execution program is executed by a processor, the steps of the algorithmic trading strategy execution method as described above are implemented.

[0101] Among them, the method implemented when the algorithmic trading strategy execution program is executed can refer to the various embodiments of the algorithmic trading strategy execution method of this application, and will not be repeated here.

[0102] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0103] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit the "first", "second" and "third" to different types.

[0104] In the description of the embodiments of this application, the words "exemplary," "for example," or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.

[0105] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0106] In some processes described in the embodiments of the present application, multiple operations or steps are included that appear in a specific order. However, it should be understood that these operations or steps may not be performed in the order in which they appear in the embodiments of the present application or may be performed in parallel. The sequence numbers of the operations are only used to distinguish between different operations, and the sequence numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations or steps may be performed in sequence or in parallel, and these operations or steps may be combined.

[0107] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above and includes a number of instructions for enabling a terminal device to execute the methods described in each embodiment of this application.

[0108] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for executing an algorithmic trading strategy, characterized in that: Applied to an algorithmic trading platform, the algorithmic trading strategy execution method includes: An execution program of the algorithmic trading platform loads a plurality of algorithmic trading strategy function templates and a plurality of execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of the one or more algorithmic trading strategy function templates; The execution program creates and allocates a thread for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks to be executed, wherein the thread created and allocated for each algorithmic trading strategy function template is shared by multiple execution tasks; The execution program receives real-time transaction market data and distributes the real-time transaction market data to the corresponding execution plan; For the corresponding execution plan, call the corresponding thread to calculate the execution task and obtain the calculation result; If the calculation result includes a trading signal, a trading order is generated based on the trading signal and submitted to the trading desk; The execution program receives real-time transaction market data and distributes the real-time transaction market data to the corresponding execution plan, including: The execution program receives real-time trading market data and encapsulates the real-time trading market data into multiple time series message queues according to data type and timestamp; Use a circular array buffer in memory to store multiple time-series message queues; Treat each time series message queue as a producer and each execution plan as a consumer, and distribute real-time trading market data to the corresponding execution plan according to the producer-consumer model; Dynamically group and shard each producer and consumer written into the memory queue, and dynamically schedule service thread resources; The consistent hashing algorithm is used to dynamically adjust the number of memory queues and sharding rules within each consumer group process.

2. The algorithmic trading strategy execution method according to claim 1, characterized in that: Before the execution program loads multiple algorithmic trading strategy function templates and multiple execution plans, it includes: For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates; Based on the algorithmic trading strategy function template, visual trading target screening, parameter configuration and task execution sequence are determined to obtain the execution plan.

3. The algorithmic trading strategy execution method according to claim 1, characterized in that: The algorithmic trading strategy function template, execution plan and parameter configuration corresponding to the execution plan are all loaded into the memory.

4. The algorithmic trading strategy execution method according to claim 1, characterized in that: The server running the execution program, the server sending real-time trading market data, and the trading counter server are deployed in the same network segment of the same computer room.

5. An algorithmic trading strategy execution device, characterized in that: Applied to an algorithmic trading platform, the algorithmic trading strategy execution device includes: a loading module, configured for the execution program of the algorithmic trading platform to load a plurality of algorithmic trading strategy function templates and a plurality of execution plans, wherein each execution plan includes one or more execution tasks, and each execution task is obtained based on parameter configuration of the one or more algorithmic trading strategy function templates; an allocation module, configured to execute a program to create and allocate threads for each algorithmic trading strategy function template according to the complexity of each algorithmic trading strategy function template and the number of execution tasks to be executed, wherein the threads created and allocated for each algorithmic trading strategy function template are shared by multiple execution tasks; The distribution module is used to execute the program to receive real-time trading market data and distribute the real-time trading market data to the corresponding execution plan; The calculation module is used to call the corresponding thread to calculate the execution task according to the corresponding execution plan and obtain the calculation result; a reporting module, configured to generate a trading order based on the trading signal if the calculation result includes a trading signal, and report the trading order to the trading counter; The distribution module is also used to: The execution program receives real-time trading market data and encapsulates the real-time trading market data into multiple time series message queues according to data type and timestamp; Use a circular array buffer in memory to store multiple time-series message queues; Treat each time series message queue as a producer and each execution plan as a consumer, and distribute real-time trading market data to the corresponding execution plan according to the producer-consumer model; Dynamically group and shard each producer and consumer written into the memory queue, and dynamically schedule service thread resources; The consistent hashing algorithm is used to dynamically adjust the number of memory queues and sharding rules within each consumer group process.

6. The algorithmic trading strategy execution device according to claim 5, characterized in that: The algorithmic trading strategy execution device also includes a modeling and configuration module for: For various algorithmic trading strategies, modeling is performed based on the quantitative characteristics of the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates; Based on the algorithmic trading strategy function template, visual trading target screening, parameter configuration and task execution sequence are determined to obtain the execution plan.

7. An algorithmic trading strategy execution device, characterized in that: The algorithmic trading strategy execution device includes a processor, a memory, and an algorithmic trading strategy execution program stored on the memory and executable by the processor, wherein when the algorithmic trading strategy execution program is executed by the processor, the steps of the algorithmic trading strategy execution method as described in any one of claims 1 to 4 are implemented.

8. A readable storage medium, characterized in that: An algorithmic trading strategy execution program is stored on the readable storage medium, wherein when the algorithmic trading strategy execution program is executed by the processor, the steps of the algorithmic trading strategy execution method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Commodity order generation method, system, device and storage medium

    CN109389499A

  • Code generation method and device for quantifying transaction strategies

    CN110688107A

  • Transaction processing method and device, storage medium and electronic equipment

    CN114463131A