Algorithm transaction strategy execution method, apparatus and device, and readable storage medium
By loading the algorithm trading strategy function template and execution plan in the algorithm trading platform, and allocating thread resources according to complexity and number of tasks, the existing platform's server resource overhead and low operating performance are solved, and efficient operation of more strategies is achieved.
Patent Information
- Application Number
- CN202510341511.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-03-21
AI Technical Summary
The server resource overhead of existing algorithm trading platforms is high, the operating performance is low, and it is difficult to support a large number of algorithmic trading strategies to operate efficiently at the same time.
By loading multiple algorithmic trading strategy function templates and execution plans, thread resources are created and allocated according to the complexity of each strategy function template and the number of executed tasks, real-time trading market data is received and distributed to the corresponding execution plan, and the thread is called for calculations and a transaction entrustment order is generated.
It saves the overall thread resource overhead of the server, avoids the performance overhead caused by frequent creation and destruction of threads, improves the server operation performance of the algorithm trading platform, and supports a larger number of algorithm trading strategies to run efficiently.
Smart Images

Figure CN120047246A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of financial trading system platforms, and in particular, to an algorithmic trading strategy execution method, device, equipment, and readable storage medium. Background Art
[0002] Today, with the rapid development of the global financial market, algorithmic trading, as a trading method centered on quantitative algorithms, has significantly changed the face of financial trading. Algorithmic trading uses computer programs to receive a large amount of real-time market quotation data, perform algorithmic strategy modeling and analysis, quickly capture trading opportunities, and thus achieve high-efficiency, low-risk, and continuous and stable trading performance.
[0003] Currently, brokerage firms or third-party service providers provide algorithmic trading platforms. By uploading the algorithmic trading strategies written by users to the cloud server for operation, financial algorithmic trading services are provided for users.
[0004] However, the current algorithmic trading platforms have problems such as large server resource overhead and low operating performance, and it is difficult to support the simultaneous high-efficiency operation of a large number of algorithmic trading strategies. Summary of the Invention
[0005] This application provides an algorithmic trading strategy execution method, device, equipment, and readable storage medium, aiming to solve the technical problems that the current algorithmic trading platforms have large server resource overhead and low operating performance, and it is difficult to support the simultaneous high-efficiency operation of a large number of algorithmic trading strategies.
[0006] In a first aspect, an embodiment of this application provides an algorithmic trading strategy execution method, and the algorithmic trading strategy execution method includes: The execution program loads 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 by parameter configuration for one or more algorithmic trading strategy function templates; The execution program creates and assigns 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; The execution program receives real-time trading quotation data and distributes the real-time trading quotation data to the corresponding execution plan; For the corresponding execution plan, call the corresponding thread to calculate the execution task to obtain a calculation result; If the calculation result includes a trading signal, generate a trading order according to the trading signal and report the trading order to the trading counter.
[0007] Optionally, before the execution program loads multiple algorithmic trading strategy function templates and multiple execution plans, it includes: For various algorithmic trading strategies, models are built based on the quantitative features in the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates; Based on the algorithmic trading strategy function templates, perform visual screening of trading targets, parameter configuration, and determination of the execution task sequence to obtain an execution plan.
[0008] Optionally, the execution program receives real-time trading market data, and distributing the real-time trading market data to the corresponding execution plan includes: 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 the data type and timestamp; Regarding each time-series message queue as each producer and each execution plan as each consumer, distribute the real-time trading market data to the corresponding execution plan according to the producer-consumer model.
[0009] Optionally, use a circular array buffer in memory to store multiple time-series message queues.
[0010] Optionally, the algorithmic trading strategy function templates, execution plans, and parameter configurations corresponding to the execution plans are all loaded into memory.
[0011] Optionally, 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.
[0012] In a second aspect, an embodiment of the present application provides an algorithmic trading strategy execution device, and the algorithmic trading strategy execution device includes: A loading module, configured to load multiple algorithmic trading strategy function templates and multiple execution plans for the execution program, where each execution plan includes one or more execution tasks, and each execution task is obtained by performing parameter configuration on one or more algorithmic trading strategy function templates; An allocation module, configured 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 for the execution program; A distribution module, configured to receive real-time trading market data for the execution program and distribute the real-time trading market data to the corresponding execution plan; A calculation module, configured to call the corresponding thread to calculate the execution task for the corresponding execution plan to obtain a calculation result; A reporting module, configured 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.
[0013] Optionally, the algorithmic trading strategy execution device further includes a modeling and configuration module, configured to: For various algorithmic trading strategies, models are built based on the quantitative features in the algorithmic trading strategies to obtain multiple algorithmic trading strategy function templates; Based on the algorithmic trading strategy function templates, visual screening of trading targets, parameter configuration, and determination of the execution task sequence are performed to obtain an execution plan 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. When the algorithmic trading strategy execution program is executed by the processor, the steps of the algorithmic trading strategy execution method as described above are implemented.
[0014] 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. 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.
[0015] The beneficial effects brought by the technical solutions provided by the embodiments of the present application include: In the embodiments of the present application, an execution program loads 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 by parameterizing 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 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 reported to the trading counter. In the embodiments of the present application, currently, traditional algorithmic trading platforms do not functionally split and model various algorithmic trading strategies. The algorithmic trading platform needs to separately create and allocate thread resources for various algorithmic trading strategies reported by each user, and the created and allocated thread resources cannot be reused among the algorithmic trading strategies of each user, resulting in excessive server resource overhead. In the present application, after loading the algorithmic trading strategy function templates and execution plans, 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 to be executed. The thread resources created and allocated for each algorithmic trading strategy function template can be repeatedly called by the execution tasks in the execution plans of each user, that is, if the execution tasks in the execution plans 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, eliminating the need to separately create 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 simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a schematic flowchart of an embodiment of the method for executing an algorithmic trading strategy of the present application; Figure 2 It is a schematic diagram of the system architecture of the algorithmic trading platform in an embodiment of the method for executing an algorithmic trading strategy of the present application; Figure 3 It is a schematic diagram of the construction and use of the algorithmic trading strategy function template in an embodiment of the method for executing an algorithmic trading strategy of the present application; Figure 4 For the present application Figure 1 It is a detailed flowchart of step S30 in the present application; Figure 5 It is a schematic diagram of the execution architecture of the execution program in an embodiment of the method for executing an algorithmic trading strategy of the present application; Figure 6Schematic diagram of the functional modules of an embodiment of the algorithm trading strategy execution device of the present application; Figure 7 Schematic diagram of the hardware structure of the algorithm trading strategy execution device involved in the solution of the embodiment of the present application. Detailed implementation manners
[0017] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0018] To make the purpose, technical solution and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0019] In a first aspect, an embodiment of the present application provides an algorithm trading strategy execution method.
[0020] In one embodiment, referring to Figure 1 , Figure 1 which is a schematic flowchart of an embodiment of the algorithm trading strategy execution method of the present application. As shown in Figure 1 , the algorithm trading strategy execution method includes: Step S10, the execution program loads multiple algorithm trading strategy function templates and multiple execution plans, where each execution plan includes one or more execution tasks, and each execution task is obtained by parameter configuration of one or more algorithm trading strategy function templates.
[0021] In this embodiment, referring to Figure 2 , Figure 2 which is a schematic diagram of the algorithm trading platform system architecture of an embodiment of the algorithm trading strategy execution method of the present application. As shown in Figure 2As shown, the execution program runs on the server of the algorithmic trading platform and is the system execution program of the algorithmic trading platform. The algorithmic trading platform is used to provide hosting execution services for algorithmic trading strategies for a large number of users. The execution program of the algorithmic trading platform can run after the opening of each trading day. After running, it loads multiple algorithmic trading strategy function templates and multiple execution plans. Each algorithmic trading strategy function template can be modeled based on the quantitative features in various algorithmic trading strategies. Each user can use a visual algorithmic trading terminal to obtain an execution task after configuring parameters for one or more algorithmic trading strategy function templates, and implement a certain algorithmic trading strategy function for the user through the execution task. For example, implement the average price calculation function in the volume-weighted average price strategy. One or more execution tasks form an execution plan. Specifically, each algorithmic trading strategy function template and each execution plan can be stored in the strategy repository of the algorithmic trading platform server. After the algorithmic trading platform user uses the visual algorithmic trading terminal to obtain an execution task and then an execution plan after configuring parameters for one or more algorithmic trading strategy function templates, the execution plan is uploaded to the strategy repository of the algorithmic trading platform server. When initializing, the execution program reads each algorithmic trading strategy function template and each execution plan from the strategy repository and loads each algorithmic trading strategy function template and each execution plan into the memory of the algorithmic trading platform server.
[0022] Step S20: The execution program creates and assigns 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.
[0023] In this embodiment, the execution tasks and execution plans are obtained by configuring parameters based on each algorithmic trading strategy function template. Appropriate thread resources are created and assigned 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. For example, the algorithmic trading strategy function templates include current price calculation, average price calculation, index calculation, etc. Some algorithmic trading strategy function templates have a higher calculation complexity and are called more times by the execution tasks. Correspondingly, more thread resources need to be assigned to them.
[0024] Step S30: The execution program receives real-time trading market data and distributes the real-time trading market data to the corresponding execution plans.
[0025] In this embodiment, the execution program receives a large amount of high-frequency real-time financial trading market data for triggering algorithmic trading strategies from upstream market data sources and trading gateways, and uses this as an event signal for triggering the execution plan. The large amount of high-frequency real-time financial trading market data may include market source timestamps, securities markets, security codes, index codes, current market prices, trading quotes, total trading volume at the quote, real-time trading volume, real-time turnover, trading accounts, and trading times, etc. Specifically, the real-time trading market data can be distributed according to the data sources subscribed by the execution plan. For example, if an execution plan subscribes to the real-time trading volume data of a certain stock, then the real-time trading volume data of this stock is distributed to this execution plan to drive the execution of this execution plan.
[0026] Step S40: For the corresponding execution plan, call the corresponding thread to calculate the execution task and obtain the calculation result.
[0027] In this embodiment, since the execution plan includes one or more execution tasks, and each execution task is obtained by parameter configuration based on 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 to be executed. Therefore, when specifically executing a certain execution plan, for each execution task in this execution plan, call the thread resources corresponding to the algorithmic trading strategy function template in the execution task to execute the calculation, obtain the calculation result for each execution task, and for the link job formed by multiple execution tasks in sequence in the execution plan, use the settlement result of the upstream execution task as the input of the downstream execution task for calculation, and finally obtain the calculation result of the entire execution plan.
[0028] Step S50: If the calculation result includes a trading signal, generate a trading order according to the trading signal and report the trading order to the trading counter.
[0029] In this embodiment, if the calculation result includes a trading signal, that is, the execution plan gives a signal that trading can be carried out after the calculation of the algorithmic trading strategy, then generate a trading order according to the trading signal and report the trading order to the trading counter, thus realizing the managed execution service based on the algorithmic trading strategy for the user.
[0030] In this embodiment, the execution program runs on the server of the algorithm trading platform and is the system execution program of the algorithm trading platform. The execution program can run after the opening of each trading day. After running, it loads multiple algorithm trading strategy function templates and multiple execution plans, creates and allocates appropriate thread resources for each algorithm trading strategy function template according to the complexity of each algorithm trading strategy function template and the number of execution tasks to be executed. The execution program receives a large amount of high-frequency real-time financial trading market data used as the basis for triggering algorithm trading strategies from the upstream market data source and the trading gateway, and uses this as the event signal for triggering the execution plan. When specifically executing a certain execution plan, for each execution task in the execution plan, it calls the corresponding thread resources of the algorithm trading strategy function template in the execution task to perform calculations, obtains calculation results for each execution task. If the calculation results include trading signals, that is, the execution plan gives a signal that trading can be carried out after the calculation of the algorithm trading strategy, then it generates a trading order according to the trading signal and reports the trading order to the trading counter, thereby realizing the managed execution service based on the algorithm trading strategy for users. The thread resources created and allocated for each algorithm trading strategy function template can be repeatedly called by the execution tasks in the execution plans of each user. That is, if the execution tasks in the execution plans of each user use the same algorithm trading strategy function template, they will call the corresponding same thread resources. Compared with the traditional algorithm trading platform that needs to create and allocate thread resources separately for various algorithm trading strategies reported by each user, which leads to excessive server resource overhead, through the embodiment of the present application, the overall thread resource overhead of the server is saved, 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 running performance of the algorithm trading platform, and being able to support a larger number of algorithm trading strategies to run efficiently at the same time.
[0031] Further, in one embodiment, before step S10, it includes: For various algorithm trading strategies, model based on the quantitative characteristics in the algorithm trading strategies to obtain multiple algorithm trading strategy function templates; Based on the algorithm trading strategy function templates, perform visual screening of trading targets, parameter configuration, and determination of the order of execution tasks to obtain an execution plan.
[0032] In this embodiment, with reference to Figure 3 , Figure 3 is a schematic diagram of the construction and use of the algorithm trading strategy function template in an embodiment of the algorithm trading strategy execution method of the present application. As Figure 3As shown, various mainstream algorithmic trading strategies, including arbitrage strategies, momentum strategies, trend following, volume-driven trading, order splitting strategies, timing strategies, and hedging strategies, etc. For various mainstream algorithmic trading strategies, based on modeling tools such as mathematical models, underlying data structures, and common template functions provided by the strategy template repository, the algorithmic trading strategies can be encapsulated into various standardized and structured algorithmic trading strategy template configuration implementation classes according to each quantitative feature. 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 common interface for standard parameter input and calculation result output, which is called by the algorithmic trading platform user for parameter configuration reporting of the execution plan and the specific execution of the execution plan. Among them, quantitative features can be divided into current price, average price, index, trading volume, main force distribution, increase / decrease rate, turnover rate, and volatility, etc. according to dimensions such as price, volume, and time. After obtaining multiple algorithmic trading strategy function templates through modeling, the algorithmic trading platform can provide a visual algorithmic trading terminal operation interface for users 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 user uploads the scope of securities trading targets involved in the algorithmic trading strategy, such as A-shares, exchange-traded funds, convertible bonds, and options, etc. Among them, the user can clearly input a restricted target list, or select based on the trading market, or select based on the special attributes of the target itself (such as new shares, ST stocks, daily limit stocks, and small market capitalization stocks, etc.); a strategy template library module: Based on each algorithmic trading strategy function template, it is provided to the user for free selection through a visual configuration menu; a parameter module: Based on the strategy template library, a strategy parameter setting menu is provided for the strategy template configuration implementation class. The user inputs the personalized parameter configuration of the selected strategy template and the global parameter configuration applicable to the overall strategy through this module, such as position setting, trading cycle, risk control setting, stop profit and stop loss setting, etc.; an 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. The user arranges the selected strategy function template combination in a drag-and-drop form, configures the parallel or serial execution link order between each strategy function template, and the logical function of data conversion between each strategy function template, and finally obtains the final execution plan based on the algorithmic trading strategy.
[0033] Further, in one embodiment, referring to Figure 4 , Figure 4 is the detailed process schematic diagram of step S30 in this application Figure 1 As shown in Figure 4 , step S30 includes: Step S301, 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 the data type and timestamp; Step S302: Take each time-series message queue as each producer, take each execution plan as each consumer, and distribute the real-time trading market data to the corresponding execution plan according to the producer-consumer model.
[0034] In this embodiment, refer to Figure 5 , Figure 5 which is a schematic diagram of the execution program execution architecture of an embodiment of the algorithmic trading strategy execution method of this application. As Figure 5 shown, the upstream market data source and trading gateway can be accessed through the message source decoding program. The received massive high-frequency real-time financial trading market data is grouped, fragmented, and multicast transmitted to each downstream execution plan call through the time-series message queue. Specifically, the 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, serving as the event-driven signals for each downstream execution plan. Here, A1 - D3 represent the computing nodes of each algorithmic trading strategy function template. The execution program of the algorithmic trading platform is constructed using a streaming computing framework based on the producer-consumer model. Specifically, take each time-series message queue as each producer, take each execution plan as each consumer, and distribute the real-time trading market data to the corresponding execution plan according to the producer-consumer model.
[0035] In this embodiment, the streaming computing framework adopts a decentralized cluster deployment method, and each computing node has a multi-active relationship with each other, ensuring that the service remains effective when a single node fails. The calculation results obtained by the same multi-active connection nodes are deduplicated according to the execution plan to ensure the uniqueness of the trading signal trigger. In this embodiment, during the operation of the streaming computing framework, based on indicators such as the throughput of the data types issued 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, dynamic grouping and fragmentation operations are performed on the in-memory queue written by the data source to achieve dynamic scheduling of service thread resources and make its computing power reach load balancing.
[0036] In this embodiment, the streaming computing framework dynamically adjusts the number of in-memory queues and fragmentation rules included in each consumer group process through the consistent hashing algorithm by real-time monitoring of indicators such as the throughput of the data types, the complexity of the link operations included in the user strategy execution plan, the number of user strategies set, and the real-time hardware occupancy of the thread resources allocated to each algorithmic trading strategy function template, so that the hardware occupancy and node throughput of each consumer group node are evenly distributed.
[0037] In this embodiment, the streaming computing framework can achieve ordered parallel processing of unified data types through thread isolation technology, optimize the false sharing problem of CPU cores by means of cache line filling, and adopt system-level optimization methods such as the CAS (Compare and Swap) lock-free computing model and CPU thread affinity binding to further improve computing performance.
[0038] In this embodiment, the intermediate cache data generated during the execution of the execution plan is saved to the running memory of the computing node and synchronized with each other through an internal message queue. Different from the traditional data middleware storage method, the intermediate data generated by the execution plan is saved in the same process of the node application and shares the running memory with the node application. This method avoids the network latency caused by the node application service accessing the intermediate data and can greatly improve the running efficiency in high-frequency traffic scenarios. Through the all-memory streaming computing framework and its highly available solution design, the algorithm trading strategy can be elastically scaled and achieve real-time failover, ensuring the stability of the algorithm trading strategy service on the basis of high concurrency and low latency.
[0039] Further, in one embodiment, a circular array buffer is used in the memory to store multiple time-series message queues.
[0040] In this embodiment, the memory queues written by multiple time-series message queues are composed of multiple circular array buffers. Using circular array buffers makes the memory utilization more efficient and avoids performance losses caused by system garbage collection.
[0041] Further, in one embodiment, the algorithm trading strategy function template, the execution plan, and the parameter configuration corresponding to the execution plan are all loaded into the memory.
[0042] In this embodiment, the execution program loads the algorithm trading strategy function template, the execution plan, and the parameter configuration corresponding to the execution plan into the memory. On the one hand, it can ensure data persistence and prevent data loss. On the other hand, data in-memory can greatly reduce latency and avoid performance losses caused by disk reading and network I / O (Input / Output) during the running of the execution program.
[0043] Further, in one 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.
[0044] In this embodiment, the server for running the execution program, the server for sending real-time trading market data, and the trading counter server are deployed in the same network segment of the same computer room, supporting 7*24-hour power supply and operation and maintenance services. Compared with the traditional method that requires users to run services locally, this deployment method significantly shortens the physical link of the overall transaction, maximally reduces the link latency of algorithmic trading, and further ensures the stability of the user strategy operation.
[0045] In a second aspect, an embodiment of the present application further provides an algorithmic trading strategy execution device.
[0046] In one embodiment, referring to Figure 6 , Figure 6 which is a schematic diagram of the functional modules of an embodiment of the algorithmic trading strategy execution device of the present application. As Figure 6 shown, the algorithmic trading strategy execution device includes: A loading module 10, configured 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 by parameterizing one or more algorithmic trading strategy function templates; An allocation module 20, 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; A distribution module 30, configured to execute a program to receive real-time trading market data and distribute the real-time trading market data to the corresponding execution plan; A calculation module 40, configured to call the corresponding thread to calculate the execution task for the corresponding execution plan to obtain a calculation result; A reporting module 50, configured 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.
[0047] Further, in one embodiment, the algorithmic trading strategy execution device further includes a modeling and configuration module, configured to: For various algorithmic trading strategies, model based on the quantitative features in the algorithmic trading strategy to obtain multiple algorithmic trading strategy function templates; Based on the algorithmic trading strategy function template, perform visual trading target screening, parameter configuration, and determination of the execution task sequence to obtain an execution plan.
[0048] Further, in one embodiment, the distribution module 30 is configured to: 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 the data type and timestamp; Take each time-series message queue as each producer and each execution plan as each consumer, and distribute the real-time trading market data to the corresponding execution plan according to the producer-consumer model.
[0049] Further, in one embodiment, a circular array buffer is adopted in the memory to store multiple time-series message queues.
[0050] Further, in one embodiment, the algorithmic trading strategy function template, the execution plan, and the parameter configuration corresponding to the execution plan are all loaded into the memory.
[0051] Further, in one embodiment, 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.
[0052] Among them, the function implementation of each module in the above algorithmic trading strategy execution device corresponds to each step in the above algorithmic trading strategy execution method embodiment, and its function and implementation process will not be elaborated here one by one.
[0053] In a third aspect, an embodiment of the present application provides an algorithmic trading strategy execution device.
[0054] Refer to Figure 7 , Figure 7 which is a schematic diagram of the hardware structure of the algorithmic trading strategy execution device involved in the solution of 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.
[0055] Among them, the communication bus can be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0056] The communication interface includes input / output (I / O) interfaces, physical interfaces, and logical interfaces, etc., which are used to implement the interconnection of components inside the algorithmic trading strategy execution device, and interfaces for implementing the interconnection of the algorithmic trading strategy execution device with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display screen (Display), a keyboard (Keyboard), etc.
[0057] 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 memory, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0058] The processor can be a general-purpose processor, which can call the algorithm trading strategy execution program stored in the memory and execute the algorithm trading strategy execution method provided by the embodiments of the present application. For example, the general-purpose processor can be a central processing unit (CPU). Among them, the method executed when the algorithm trading strategy execution program is called can refer to the various embodiments of the algorithm trading strategy execution method of the present application, which will not be elaborated here.
[0059] Those skilled in the art can understand that Figure 7 the hardware structure shown in does not constitute a limitation to the present application, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0060] In a fourth aspect, the embodiments of the present application further provide a readable storage medium.
[0061] An algorithm trading strategy execution program is stored on the readable storage medium of the present application. When the algorithm trading strategy execution program is executed by a processor, the steps of the algorithm trading strategy execution method as described above are implemented.
[0062] Among them, the method implemented when the algorithm trading strategy execution program is executed can refer to the various embodiments of the algorithm trading strategy execution method of the present application, which will not be elaborated here.
[0063] It should be noted that the serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0064] In the description of the specification and claims of this application and the above-mentioned drawings, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. 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 may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products, or devices. Descriptions such as "first", "second", and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit that "first", "second", and "third" are different types.
[0065] In the description of the embodiments of this application, words such as "exemplary", "for example", or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary", "for example", or "for instance" in the embodiments of this application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary", "for example", or "for instance" is intended to present relevant concepts in a specific manner.
[0066] In the description of the embodiments of this application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; "and / or" in the text is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, in the description of the embodiments of this application, "a plurality of" means two or more than two.
[0067] In some processes described in the embodiments of this application, a plurality of operations or steps appear in a specific order. However, it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of this application or may be executed in parallel. The serial numbers of the operations are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0068] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus a 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 such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions to enable a terminal device to execute the methods described in the various embodiments of this application.
[0069] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present application.
Claims
1. A method for executing an algorithmic trading strategy, characterized in that: The algorithmic trading strategy execution method comprises: 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 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 performed; 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 according to the trading signal and the trading order is submitted to the trading counter.
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, including: 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 order determination of execution tasks are performed to obtain an execution plan.
3. The algorithmic trading strategy execution method according to claim 1, characterized in that: The execution program receives the real-time transaction market data and distributes the real-time transaction market data to the corresponding execution plan, including: The execution program receives the real-time transaction market data, and encapsulates the real-time transaction market data into multiple time-series message queues according to data types and timestamps; Each time series message queue is regarded as each producer, and each execution plan is regarded as each consumer. The real-time transaction market data is distributed to the corresponding execution plan according to the producer-consumer model.
4. The algorithmic trading strategy execution method according to claim 3, characterized in that: A circular array buffer is used in memory to store multiple sequential message queues.
5. 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.
6. 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.
7. An algorithmic trading strategy execution device, characterized in that: The algorithmic trading strategy execution device comprises: A loading module, used for executing 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; 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; A distribution module is used to execute programs to receive real-time trading market data and distribute the real-time trading market data to corresponding execution plans; 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; 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.
8. The algorithmic trading strategy execution device according to claim 7, 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 order determination of execution tasks are performed to obtain an execution plan.
9. 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 in 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 6 are implemented.
10. 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 6 are implemented.
Citation Information
Patent Citations
Stock programmed trading system and method
CN107133873A
Commodity order generation method, system, device and storage medium
CN109389499A
Full-market multi-variety intelligent financial management system based on automatic quantitative transaction platform
CN110634071A
Code generation method and device for quantifying transaction strategies
CN110688107A
Intelligent streaming transaction execution method and device
CN113159941A