Method and device for creating quantitative trading strategies
The quantitative trading strategy is constructed through a graphical interface and compiled into a script to run, which solves the problem that users need to have programming capabilities in the existing technology, and realizes simple and flexible strategy creation and personalized needs satisfaction.
Patent Information
- Application Number
- CN202180010866.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-09-24
AI Technical Summary
When creating quantitative trading strategies in the existing technology, users need to have programming capabilities, the threshold is high, and it is difficult to meet the personalized needs of users.
Provides a method to create a quantitative trading strategy through a graphical interface. Users can build a graphical quantitative trading strategy through editable controls and connection lines, which the system compiles into a quantitative trading strategy script and runs to obtain transaction results.
It realizes the simple and flexible creation of quantitative trading strategies, lowers the programming threshold for users, can meet various personalized needs of users, and improves the efficiency of creating quantitative trading strategies.
Smart Images

Figure CN115053245B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software technology, and more specifically, to a method and device for creating a quantitative trading strategy. Background Art
[0002] Quantitative trading strategies are increasingly used in financial markets. Quantitative trading strategies can directly affect the interests of investment users or teams. Therefore, it is particularly important to create quantitative trading strategies.
[0003] When users create quantitative trading strategies, they often write codes in programming languages to achieve quantitative analysis of data. In this way, users need to have the ability to write program code, such as understanding complex concepts such as variables, functions, classes, TCP connections in programming, and reading heavy API documents, which has a high professional threshold. In addition, users can also be guided to create quantitative trading strategies in a strategy-oriented way, such as providing users with a fixed rule interface so that users can create quantitative trading strategies by, for example, checking boxes, but this method is difficult to meet the personalized needs of users.
[0004] Therefore, there is an urgent need for a simple and flexible way to create quantitative trading strategies to meet user needs. Summary of the invention
[0005] The embodiments of the present application provide a method and device for creating a quantitative trading strategy, which can realize simple and flexible creation of quantitative trading strategies to meet various needs of users.
[0006] In a first aspect, a method for creating a quantitative trading strategy is provided, the method comprising:
[0007] Displaying a graphical interface, wherein the graphical interface includes at least one editable control;
[0008] Acquire a graphical quantitative trading strategy input by a user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters;
[0009] According to the graphical quantitative trading strategy, obtain the quantitative trading strategy script;
[0010] Run the quantitative trading strategy script to obtain the quantitative trading results.
[0011] In a second aspect, a device for creating a quantitative trading strategy is provided, the device comprising:
[0012] A display unit, configured to display a graphical interface, wherein the graphical interface includes at least one editable control;
[0013] An acquisition unit, used for acquiring a graphical quantitative trading strategy input by a user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters;
[0014] A processing unit, configured to obtain a quantitative trading strategy script according to the graphical quantitative trading strategy;
[0015] The processing unit is also used to run the quantitative trading strategy script to obtain quantitative trading results.
[0016] In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect.
[0017] In a fourth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method in the above-mentioned first aspect and any implementation manner of the first aspect.
[0018] In a fifth aspect, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions enable a computer to execute the method in the above-mentioned first aspect and any implementation manner of the first aspect.
[0019] In a sixth aspect, a computer program is provided, which, when executed on a computer, enables the computer to execute the method in the above-mentioned first aspect and any implementation manner of the first aspect.
[0020] The embodiment of the present application obtains the graphical quantitative trading strategy input by the user through the graphical interface, and compiles the graphical quantitative trading strategy to obtain the quantitative trading strategy script, and can obtain the quantitative trading results by running the strategy script. In the present application, the user can edit the desired graphical quantitative trading strategy according to various needs through the graphical interface, without the need to have the ability to write program code, so that the present application can realize the simple and flexible creation of quantitative trading strategies to meet the various needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of an application scenario of an embodiment of the present application;
[0022] Figure 2 It is a schematic flow chart of a method for creating a quantitative trading strategy provided by an embodiment of the present application;
[0023] Figure 3It is a specific example of the graphical interface provided in the embodiment of the present application;
[0024] Figure 4 It is a specific example of the attribute column corresponding to the condition box provided in the embodiment of the present application;
[0025] Figure 5 This is an example of an interface for editing a combination condition in a pop-up window provided in an embodiment of the present application;
[0026] Figure 6 This is an example of logically associating various conditions provided in the embodiment of the present application;
[0027] Figure 7 This is an example of a preview of a combined conditional control provided in an embodiment of the present application;
[0028] Figure 8 is another example of the preview of the combined conditional control provided in the embodiment of the present application;
[0029] Fig. 9 It is a specific example of the attribute column corresponding to the event box provided in the embodiment of the present application;
[0030] Fig.10 is a specific example of at least one path determined according to a graphical quantitative trading strategy provided in an embodiment of the present application;
[0031] Fig.11 is another specific example of at least one path determined according to a graphical quantitative trading strategy provided in an embodiment of the present application;
[0032] Fig.12 is a schematic flow chart of the policy script operation provided by the embodiment of the present application;
[0033] Fig.13 is a schematic block diagram of a communication architecture of an interface response provided in an embodiment of the present application;
[0034] Fig.14 is a schematic block diagram of an apparatus 400 for creating a quantitative trading strategy according to an embodiment of the present application;
[0035] Fig.15 It is a schematic block diagram of an electronic device 800 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. For the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] It should be understood that in the embodiment of the present application, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based only on A, and B can also be determined based on A and / or other information.
[0038] In the description of the present application, unless otherwise specified, "at least one" means one or more, and "plurality" means two or more than two. In addition, "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0039] It should also be understood that the first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects, without any distinction of order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.
[0040] It should also be understood that the specific features, structures or characteristics related to the embodiments in the specification are included in at least one embodiment of the present application. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.
[0041] In addition, the terms "including" and "having" and any variations thereof 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 necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device.
[0042] Figure 11 is a schematic diagram of an application scenario provided by an embodiment of the present application. The application scenario involves an electronic device 101, which can be various terminal devices, such as smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, laptops, mobile Internet devices (mobile Internet devices), wearable devices, vehicle-mounted devices, etc., without limitation. The terminal device can also be called user equipment (UE), terminal or user device, etc., without limitation.
[0043] Optionally, the electronic device 101 can transmit data to a server (eg, a market information server) via wireless communication technology. Figure 1 The electronic device 101 shown can be a client / server (C / S) mode, and the client can pull data from the service end (such as a server). As a specific example, the client can adopt the MVP (Model-View-Presenter) architecture, so that the interface, data operation, data warehouse, etc. are separated from each other.
[0044] In the embodiment of the present application, the electronic device may display a graphical interface including at least one editable control, and the user may input a graphical quantitative trading strategy by operating the electronic device 101. The graphical quantitative trading strategy includes at least two edited controls and connecting lines. In response to the user's operation, the electronic device 101 obtains the graphical quantitative trading strategy and the quantitative trading strategy script, and then runs the script to obtain the quantitative trading result.
[0045] For example, the subject of quantitative trading in the embodiments of the present application may be futures, stocks, funds and other products, without limitation.
[0046] It should be noted that Figure 1 The application scenarios shown in are only used to illustrate the embodiments of the present application and are not intended to be limiting. In specific implementation, the technical solutions provided in the embodiments of the present application can be flexibly applied according to actual needs.
[0047] Figure 2 2 shows a schematic flow chart of a method 200 for creating a quantitative trading strategy provided by an embodiment of the present application. The method 200 may be Figure 1 The electronic device 101 in the embodiment, or a circuit or chip arranged in the electronic device 101 is executed. Figure 2 As shown, method 200 includes steps 210 to 240 .
[0048] 210 , displaying a graphical interface, where the graphical interface includes at least one editable control.
[0049] For example, a graphical interface can be displayed on the interface of an application (APP) installed on a terminal device for a user to create a quantitative trading strategy. The APP can be a desktop APP or a mobile APP, without limitation.
[0050] Here, the control may be a graphical control. Specifically, in the embodiment of the present application, the quantitative trading strategy may be abstracted as a graphical control. Exemplarily, the control includes at least one of a start control, a condition control, and an event control. Among them, each control in the graphical interface is editable, and the user can edit the property parameters of the input control.
[0051] 220, obtaining a graphical quantitative trading strategy input by the user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters.
[0052] For example, the user can split the quantitative trading strategy process into different conditions or events, and then select a control (such as at least one of a start control, a condition control, and an event control) through a graphical interface, and enter the property parameters of the selected control by editing the control, and then connect at least two controls through a connecting line, such as in series or in parallel, to implement various quantitative trading strategies. Here, the connecting line can represent the association relationship between the at least two connected controls.
[0053] In some optional embodiments, the graphical interface includes a control bar, a strategy canvas, and a property bar. At this time, as an implementation method of obtaining a graphical quantitative trading strategy input by a user through the graphical interface, at least one control selected by the user in the control bar can be obtained. Then, in response to the user's first operation, the at least one control is added to the strategy canvas, wherein a start control is pre-set in the strategy canvas. Then, the control selected by the user in the strategy canvas can be obtained, and the property parameters of the selected control can be edited in the property bar. Thereafter, in response to the user's second operation, the at least one control and the start control are connected through the connecting line to generate the graphical quantitative trading strategy.
[0054] The process of creating a graphical quantitative trading strategy is described in detail below in conjunction with the display interface of the APP. It should be understood that the interface diagrams in the following embodiments are only for the purpose of facilitating the understanding of the technical solutions provided by the embodiments of the present application, and do not constitute a limitation on the technical solutions of the present application.
[0055] Figure 3A specific example of a graphical interface is shown, which includes a navigation bar 310 , a control bar 320 , a policy canvas 330 , and a property bar 340 .
[0056] like Figure 3 As shown, the navigation bar 310 can display the current quantitative trading strategy (such as Figure 3 1, Strategy 2, Strategy 3, New Strategy, New Strategy 1, New Strategy 2, etc.), or a running quantitative trading strategy. Optionally, the navigation bar 310 can also display the status of the quantitative trading strategy, such as backtesting. Optionally, the navigation bar can also display an icon for a newly created quantitative trading strategy, such as "+".
[0057] Continue to see Figure 3 The control bar 320 is used to display multiple editable controls, such as condition controls and event controls. The condition control library is used to store judgment conditions, and the event control library is used to store events for executing operations. One or more conditions can correspond to one condition control, and one or more events can correspond to one event control, without limitation.
[0058] For example, the conditional control can be a set of logical judgments, such as if / else logical judgments. Users can select different judgment conditions, such as whether the moving average is in a long position arrangement? Is the maximum purchase quantity greater than 1? The conditional control can also determine whether the selected account has a position, whether there are unfinished order conditions, etc.
[0059] For example, an event control can be an execution function, such as buying 1 lot of a certain stock at the counterparty price, or canceling all orders for the entire account. Although the logic seems simple, it is necessary to handle exceptions internally and perform global interval management to prevent excessive concurrent requests from being placed on the server.
[0060] In some optional embodiments, the conditional control includes at least one of a signal control, an account control, and a combination control.
[0061] Specifically, signals are objective data related to the market. Optionally, the signal condition controls can be divided into several categories such as technical, fundamental, capital and news based on the user's commonly used trading basis. In some embodiments, signals can be predefined so that users can drag and use them. For example, the predefined results of MACD are "golden cross", "death cross", "top divergence", "bottom divergence" and so on. Figure 3The control bar 320 in the diagram shows a specific example of a signal control. For example, the technical aspect may include conditional controls such as Moving Average Convergence and Divergence (MACD), KDJ, RSI, and momentum indicators; the fundamental aspect may include conditional controls such as Price to Earning Ratio (PE), Return on Assets (ROA), Rate of Return on Common Stockholder's Equity (ROE), and EPS; the capital aspect may include conditional controls such as capital flow, capital distribution, and chip distribution; and the news aspect may include conditional controls for public opinion tracking.
[0062] Optionally, the control bar may also include a variable comparison signal for comparing the size relationship between global variables, constants, and numerical conditional variables.
[0063] Specifically, account conditions are related to personal trading business accounts and are personalized. Optionally, account condition controls can be divided into account assets, maximum buy / sell, positions, orders, and transactions according to the user's commonly used account status. For example, asset accounts can include condition controls such as maximum buying power, short selling buying power, cash buying power, net asset value, risk status, cash, long market value, short market value, initial margin, margin call margin, and maintenance margin. Maximum buy / sell can include condition controls such as cash buy, maximum buy, and position sell. Positions can include position direction, holding quantity, sellable quantity, cost price / opening price, position market value, profit and loss ratio, profit and loss amount, today's total purchase amount (only stocks), today's total purchase amount (only stocks), today's total sale amount (only stocks), today's total sale amount (only stocks), unrealized profit and loss (only futures), realized profit and loss (only futures), and other condition controls. Orders can include condition controls such as order status, price of the last long order, price of the last short order, and other condition controls. Transactions can include condition controls such as transaction status, transaction price, and transaction quantity.
[0064] Specifically, multiple conditions can be packaged into a combined condition through logical relationships of and, or, (), and the combined condition can correspond to a combined condition control. Among them, the multiple conditions can be called sub-conditions. Exemplarily, the number of sub-conditions can be no more than 10. Optionally, the embodiment of the present application supports user-defined combined condition controls.
[0065] In some optional embodiments, the event controls include time controls such as order placement, order cancellation, liquidation, message reminder, exit strategy program, assignment operation, etc. Optionally, order placement, order cancellation and liquidation may belong to transaction event controls.
[0066] As an implementation method, since there are many contents in the control, some commonly used ones can be listed and placed in the control bar, and the rest can be displayed through the drop-down menu or click to see more, without limitation.
[0067] In some embodiments, the user can search for a desired conditional control or event control, and the corresponding interface will automatically jump to the conditional control or event control.
[0068] In some optional embodiments, the user can select a control in the control bar 320 and add it to the strategy canvas 330 to form a corresponding box through a first operation to form a graphical quantitative trading strategy. As an example of the first operation, the control can be added to the strategy canvas 330 by long pressing the left button and / or dragging the combined control button. As a specific example, when the mouse hovers over a control in the control bar, the control will float up, prompting the user to drag it. Optionally, the canvas color can change accordingly at this time to prompt the user to place the area. When the dragged control completely enters the canvas area, the control will switch from the style in the original control bar to the style in the canvas, indicating that it has entered a state where it can be placed.
[0069] The elements in the strategy canvas 330 include boxes and lines. Among them, the box can correspond to a control added by the user, or a pre-set start control. The property bar 340 is used to edit the properties of the control. When the user selects an element (such as a box or a line) in the strategy canvas 330, the editable parameters corresponding to the element can be displayed in the property bar 340. Exemplarily, a control may have a large number of complex properties. For example, the properties of an order time control may include order type, subject, direction, price, quantity, etc. The embodiment of the present application can help users understand control properties and reduce the complexity of development by concentrating property editing in the property bar.
[0070] For example, each graphical quantitative trading strategy may have a start control. The start control may be generated by default when creating a strategy, that is, the user does not need to drag and create it.
[0071] Continue to see Figure 3 , the strategy canvas 330 may be set by default to display a box corresponding to the start control (which may be referred to as the start box). When the start box is selected, the parameter editing settings of the start control may be displayed in the property bar 340. The start control may include global property settings for the entire graphical quantitative trading strategy, such as at least one of applicable account settings, loop settings, and global variable settings.
[0072] For example, since there are some differences between different types of accounts (such as futures accounts, securities accounts, etc.), by setting applicable account parameters, different types of financial products or derivatives can be compatible in the same quantitative trading product. Account type can also be called strategy type. When this parameter is set, the control bar can automatically link to display applicable controls to avoid interference items.
[0073] like Figure 3 As shown in the middle property column 340, the strategy type can be selected through the drop-down menu, for example, it can be securities, futures, stocks, funds, etc., without limitation. In some embodiments, after the strategy type is determined, if the user pulls a condition that is not applicable to the selected strategy type, a warning or reminder can be issued.
[0074] The loop setting can be set in the start setting, which can include the loop setting of the entire strategy. Specifically, the loop of the strategy script depends on the quote drive of the secondary market. Accordingly, the user can choose to run it once for each stock quote change, or once for each K-bar opening. Figure 3 As shown in the attribute 340, the target indicates the target of the loop reference, and the frequency indicates the frequency of the strategy loop. As an example, on_bar_open() can indicate that the signal target runs once at the opening of each K-line in the specified K-line period, on_tick() indicates that the signal target runs once for each tick, and only execute once indicates that the strategy is only run once.
[0075] Global variables are used to maintain the connection between previous and next nodes (such as controls). Data between nodes can be transferred through global variables. Global variable settings support the creation of global variables for parameter selection in condition boxes and / or event boxes within the canvas, for example, they can be used in assignment calculations and loop iterations. For example, Figure 3 As shown, you can use the corresponding buttons to add, edit, delete, and other operations on global variables.
[0076] For example, when the New button is clicked in the property bar 340 corresponding to the start control 331, an editable global variable box 341 appears below the global variable, and the global variable box can be edited at this time, such as filling in the variable name and assigning a value. When the completion is clicked, the global variable is successfully established. It should be noted that when the variable name or assignment of the global variable is modified in the properties of the start box, the global variable will be changed when the corresponding control is used later.
[0077] As an example, the assignment can be selected to be manually entered, or a conditional variable can be selected. If the user selects a conditional variable, a parameter box corresponding to the conditional variable (such as a signal condition control or an account condition control) can be displayed for parameter setting.
[0078] In some embodiments, after the parameters of the start box are written in the property column, the parameter information can be displayed in the strategy canvas for the convenience of the user to read. The transparent information includes at least one of the following: name, target, frequency, or others, without limitation. Figure 3 In the example, the transparent information of the start box 331 is "K runs once a day", where "K a day" is the frequency information.
[0079] In some embodiments, when a control in the control bar 320 is selected and added to the policy canvas 330, a box corresponding to the control is displayed in the policy canvas 320, such as a box corresponding to a conditional control (which may be referred to as a conditional box) and a box corresponding to an event control (which may be referred to as an event box).
[0080] In the embodiment of the present application, when the condition box is selected, the parameter editing settings of the condition control can be displayed in the property bar 340. For example, the condition box can have four areas where parameters can be adjusted, namely, the variable 1 area, the judgment area, and the variable 2 area. Figure 4 Explain the parameter settings of the conditional frame.
[0081] Figure 4 The following figure shows a specific example of the property column corresponding to the condition box. In (a), the condition variable in the variable 1 area is MACD, and in (b), the condition variable in the variable 1 area is the maximum buyable. Specifically, the variable 1 area can present parameter settings related to variable 1, and the number of parameter settings changes as the user drags variable 1. For example, Figure 4 As shown in (a), when variable 1 selects MACD, the parameters related to MACD are presented below for users to set.
[0082] Exemplarily, the judgment area can be set to an enumeration type, for example, the user can select through a drop-down menu. Specifically, the judgment can form corresponding drop-down enumeration options according to the conditions selected by the user. For example, for field-type adjustments such as MACD, EMA, KDJ, and volume ratio, the judgment drop-down options can be "yes" and "no"; for numerical conditions such as current ratio, quick freezing ratio, and net profit margin, the judgment drop-down options can be ">", "<", "≥", "≤", "=", and "≠", etc., without limitation.
[0083] For example, the variable 2 area can change according to the change of variable 1. There are two cases:
[0084] Case 1: When variable 1 is an enumeration condition variable, variable 2 can be a drop-down enumeration option;
[0085] Case 2: When variable 1 is a numeric conditional variable, variable 2 can be input in three ways: 1. manual input; 2. conditional variable (for example, numeric conditional variable); 3. global variable.
[0086] It should be noted that after variable 1 or variable 2 is selected, if there is a conflict with the strategy type set in the start box, the user can be reminded of the conditional use, for example, the user can be reminded of which account this condition applies to. For example, cash can be bought only for securities accounts, but not for futures accounts.
[0087] For example, the naming of the conditional box supports user modification and is also applicable to display in the canvas. For example, the box can be named by default, such as being ordered according to the order of the boxes dragged into the canvas. As a specific example, the second conditional control dragged in can be named Condition 2.
[0088] In some embodiments, the user may be supported to make comments on the conditions. Optionally, the comments may be recorded in the code generated by the canvas to form comments.
[0089] In some embodiments, after the parameters of the conditional box are written in the property column, the parameter information can be displayed in the policy canvas for the convenience of users to read. The transparent information includes, for example, at least one of the following: name, variable 1, variable 1 related parameters, judgment, variable 2, variable 2 related parameters, etc., or other information, without limitation. Figure 3 , the transparent information of condition box 332 is "Condition 1 MACD is a low-level golden cross", where "Condition 1" is the name, "MACD" is the variable 1, "yes" is the judgment, and "low-level golden cross" is the variable 2; the transparent information of condition box 333 is "Condition 2b>6?", where "Condition 2" is the name, "b" is the variable 1, ">" is the judgment, and "6" is the variable 2.
[0090] In some embodiments, the user may also add a combined condition control in the policy canvas 330. Optionally, the method 300 further includes, in response to a third operation of the user, displaying a pop-up window; acquiring at least two conditions (i.e., sub-conditions) input by the user in the pop-up window and an association relationship between the at least two conditions; and generating the combined condition control according to the at least two conditions and the association relationship.
[0091] Exemplarily, parameter editing of the combined conditional control is done in a pop-up window, rather than in the property bar. Figure 5 An example of an interface for editing a combination condition in a pop-up window is shown. For example, the pop-up window interface may include two parts, namely, a condition setting part (e.g. Figure 5 The left part of the diagram) and the association parts of different conditions (such as Figure 5 on the right side of the image).
[0092] like Figure 5As shown, as an example of the third operation, by long pressing the left key and / or dragging the combination condition control button, an editing window of the pop-up window 350 can be popped up, in which the user can enter the name of the combination condition. In the condition setting, click the "+ Add Condition" button, and a sub-condition editing box can appear, for example, it can include a variable 1 area, a judgment area, a variable 2 area, etc.
[0093] For example, for the variable 1 area, there can be 2 input methods: 1 conditional variable, 2 global variable (can provide entry for creating global variables). For example, when a conditional variable is selected, the content in the drop-down box can be all the conditions in the condition library, and the corresponding parameter box can also be presented (need to be filled in by the user), and the parameter box is the parameter setting corresponding to the conditional variable. When a global variable is selected, the content in the drop-down box can be the global variable that has been set in the start box, and no parameter box can be displayed at this time.
[0094] When the user selects a conditional variable and completes writing the relevant parameters of variable 1, a preview of the conditional variable and its parameters can be displayed in variable 1. When the user selects a global variable, the preview is the global variable name.
[0095] Exemplarily, the judgment area and the variable 2 area are similar to the property bars corresponding to the condition box in the above text. For details, please refer to the description in the above text and no further details will be given.
[0096] In some optional embodiments, the sub-condition may be deleted, for example, by clicking a "Delete" button. Optionally, deleting a sub-condition does not affect the numbering of other sub-conditions.
[0097] For the conditions that have been set in the combined condition control, you can use "or", "and", "(", ")" to associate them. Figure 6 An example of logically associating conditions is shown. For example, "condition", "or", "and", etc. can be entered by clicking a button, and "(", ")" can be entered by keyboard or by button. After "condition", "or", "and" are entered into the edit box, they can be changed through the drop-down box.
[0098] In some optional embodiments, for example, after the user edits the association relationship between the conditions, a binary tree can be generated by means of in-order variables, where the leaf nodes can be conditions and the branch nodes are logical operation symbols, and then the binary tree can be displayed through a tree structure. Figure 7 An example of a preview of a combined conditional control is shown, wherein logically associated contents can be displayed in a tree format.
[0099] It should be noted that if there are some normal and some abnormal situations in the logical association, you can display the normal situation and logic as much as possible.
[0100] As an example, under normal circumstances, multiple conditions and multiple logical sub-conditions are normal situations, and they can be calculated step by step in order. For example, "condition A and condition B or condition C" is equivalent to "condition A and condition B or condition C". In the case of multiple conditions with the same logical word, { can increase the number of branches according to the number of conditions instead of increasing the number of "{" trees. For details, please refer to Figure 8 Two conditions in, greater than two conditions, the same logical word, greater than two conditions, and the "{" tree structure corresponding to different logical words.
[0101] For some abnormal situations, such as the smallest particle is an empty bracket, unmatched brackets, condition + condition, logical word + logical word, condition + logical word, logical word + condition, etc., when there are only empty brackets or unmatched brackets in the logical relationship, no logical display is performed, which means that it is displayed as empty. If the logical association detection itself is abnormal, it is displayed according to the smallest particle that can be displayed in the logical relationship, such as when there are conditions + logical words, logical words + conditions, for example, "A and" or "and B" can be displayed. When there are only conditions + conditions, logical words + logical words in the logical association, the logical display is displayed according to the normal situation that can be displayed at most, for example, "AB", "and and", etc. can be displayed.
[0102] For example, when the editing of the combination condition is completed, the parameter settings in the pop-up window can be saved and the pop-up window can be closed. Correspondingly, the corresponding combination condition can be displayed in the strategy canvas.
[0103] In some optional embodiments, during the process of the user editing the combined conditional control, the logic can be checked. If there is a problem with the check, the front-end interactive reminder is given. Exemplarily, the rules of the check logic are as follows:
[0104] For parameter filling, the parameters in the condition setting (such as condition, judgment, value) must have values;
[0105] For logical association, conditions need to be associated with each other using "or", "and", etc.; brackets need to be paired, and there cannot be single brackets left alone; the logical words "and" and "or" cannot be placed consecutively; there needs to be content between "(" and ")", and empty brackets cannot appear; single brackets cannot appear on the left and right of the logical words "or" or "and", such as: "or)", "(and", etc.
[0106] In some embodiments, when a combined condition control in the strategy canvas is selected, the main content of the property bar may include the condition name and preview. Optionally, the sub-condition content in the combined condition may be exposed, while the specific parameters of the sub-condition may not be displayed. For example, the exposed sub-condition content may be "MACD is a low-level golden cross", "net profit > 20%", "maximum purchase > 0", etc.
[0107] Optionally, there may be an editing entry for the combination condition control in the property bar. Clicking it will enter a pop-up window, where the combination condition can be edited.
[0108] In the embodiment of the present application, when the event box is selected, the parameter editing settings of the event control can be displayed in the property bar 340. Fig. 9 The specific example of the attribute column corresponding to the event box is shown. In (a), the event is an order as an example, where the quantity and price support three input methods: 1 manual input, 2 conditional variables (such as numerical conditional variables), and 3 global variables.
[0109] In (b), the event is used as an example for the assignment operation. The assigned variable supports enumeration type. The user can pull down to select the global operation to be assigned. The global variables displayed in the drop-down item are set in the start box. If no global variables are set, the drop-down item can be empty; the operation can be an enumeration type. The user can pull down to select the operator to determine the number of variables below. Exemplarily, the operator may include: sum, difference, rounding, absolute value, integer division, remainder of divisor, etc. The number of values is related to the selected operation. Variables can be input in 3 ways, as above, and will not be repeated.
[0110] For example, the naming of the event box supports user modification and is also suitable for display in the canvas. For example, the box can be named by default, such as being ordered according to the order of the boxes dragged into the canvas. As a specific example, the second event control dragged in can be named Event 2.
[0111] In some embodiments, after the parameters of the event box are written in the property column, the parameter information can be displayed in the strategy canvas for the user to read. For example, the transparent information of the order event includes the name and part or all of all parameters, such as Figure 3 In the event box 334: "Event 2 Order Signal Subject Buy 100 Stock Price Order". For another example, the output information of the assignment event includes, for example, the name and the preview in the property column, such as Figure 3 Event box 335 in: "Event 1b=1+2".
[0112] In some optional embodiments, controls (such as start controls, condition controls, or event controls) can be abstracted into data structures. Furthermore, a serialization interface can be implemented for controls, and complete policy storage can be implemented according to control functions, such as implementing save and read interfaces for different types of controls to implement storage of control information, so that the same policy can be used across time and devices to achieve policy cloud synchronization.
[0113] In an embodiment of the present application, the boxes corresponding to the controls in the strategy canvas 330 can be connected by lines, for example, in series or in parallel. Among them, the start control includes the starting point of the graphical quantitative trading strategy. Exemplarily, the start control can be the starting point of the entire graphical quantitative trading strategy, that is, the main entrance of the program corresponding to the graphical quantitative trading strategy. The conditional control or event control includes an entrance and an exit, the entrance is used to place the end point of the connecting line, and the exit is used to place the starting point of the connecting line. Exemplarily, the user can place the two ends of the connecting line at the exit and entrance of the control respectively according to the required quantitative trading strategy through a second operation.
[0114] Exemplarily, the line may have arrows to indicate the order in which the controls are run, so that separate controls may be connected into a complete strategy flow chart.
[0115] In some optional embodiments, the start box can have multiple exits, the condition box supports single entry and single exit or single entry and double exit, and the event box supports single entry and single exit or single entry and no exit. Optionally, the box can support adding to the canvas, dragging in the canvas, hover & selecting, multiple selections, copying, cutting, pasting, deleting, etc., without limitation. In some embodiments, the start box does not support operations such as deleting, copying, cutting, pasting, or pasting.
[0116] In some optional embodiments, there are two types of connecting lines, namely, lines with parameters and lines without parameters. Lines without parameters may include directions but not parameters, such as the lines behind a start control or an event control. Lines with parameters may include directions and parameters. For example, a connecting line placed at the exit of a conditional control includes a first parameter, which is used to indicate whether the condition represented by the conditional control is established. In other words, the parameters of the line framed by the condition may be "yes" or "no", and correspondingly, the corresponding situation may be identified on the line, such as the font "yes" or "no" may be superimposed and displayed on the line. Optionally, the parameters of the line may be modified.
[0117] As a specific example, the default parameter of the line in the conditional box is "Yes". After selecting the line, you can modify the line parameters in the property bar, for example, from "Yes" to "No".
[0118] For example, a line can go out of the right side of a box and enter from the left side; a line can pass through a box in the canvas and be placed in front of the box; a line can be placed in the canvas as a separate object. For example, operations on lines support connection, dragging, hover & selection, multiple selection, deletion, cutting, copying or pasting, etc.
[0119] It should be noted that the detection of quantitative trading strategies on the strategy canvas can accompany the entire process of creating strategies. For example, it can include the detection of the strategy as a whole, the detection within the controls, and the detection between controls. For example, checking whether the data of each node complies with the rules, whether the path is reasonable, etc., to ensure that the final strategy can generate code normally and is available.
[0120] Furthermore, this embodiment may include the following steps:
[0121] Based on the function of the control, determine the function coefficient corresponding to the control;
[0122] Determine the association relationship between controls based on the functional coefficients between the controls;
[0123] Determine whether two controls can be connected based on the association relationship, so that an error is reported when the two controls cannot be connected but the user connects them.
[0124] Specifically, the functional coefficient corresponding to the control is determined based on the function of the control. For example, the functional coefficient of the node control (start control and end control) is set to 0.1, the functional coefficient of the conditional control is set to 0.3, and the functional coefficient of the event control is set to 0.6. If the absolute value of the difference between the functional coefficients of the two controls is greater than or equal to 0.3, the two are determined to be strongly associated; if the absolute value of the difference between the functional coefficients of the two controls is greater than or equal to 0.2 and less than 0.3, the two are determined to be medium associated; if the absolute value of the difference between the functional coefficients of the two controls is less than 0.2, the two are determined to be weakly associated. When the two controls are weakly associated with each other, it is determined that the two controls cannot be connected, and an error is reported when the user connects the two. The above method can quickly and efficiently provide error reminders and improve the efficiency of strategy generation.
[0125] 230. Obtain a quantitative trading strategy script according to the graphical quantitative trading strategy.
[0126] Specifically, when the user completes the graphical quantitative trading strategy on the strategy canvas, that is, after drawing the complete strategy process, the graphical quantitative trading strategy can be compiled to generate a quantitative trading strategy script.
[0127] In some optional embodiments, at least one path may be determined according to the graphical quantitative trading strategy, the path including at least one first control and a connection line between the first control and an adjacent control. As a possible implementation, the first control may be encapsulated as a first function. Afterwards, according to the first function and the connection line between the first control and the adjacent control, the path may be encapsulated as a second function, and the second function may internally call the first function of the first control in the path. Afterwards, according to the second function, the quantitative trading strategy script may be obtained, wherein the quantitative trading strategy script includes a callback function, and the callback function may call the second function.
[0128] Fig.10 A specific example of at least one path determined according to a graphical quantitative trading strategy is shown. A circle can represent a control, which can be called a node. Fig.10 As shown, the leftmost node represents the start control, and the remaining nodes are conditional controls or event controls. Each path may include at least one node (for example, a node corresponding to the first control, where the first control is, for example, a conditional control or an event control) and a connecting line between the node and the adjacent node.
[0129] Exemplarily, when determining at least one path, the number of paths can be the same as the number of exits of the start control. That is, starting from the node of the start control, the nodes on each line and the lines between the nodes can form a path. At the same time, the order relationship of the nodes in each path can be determined based on the lines between the nodes on each path. For details, see Fig.10 Path 1 to path n.
[0130] like Fig.10 As shown, when the path includes at least two first controls (i.e., nodes), the at least two first controls form a tree network topology. Specifically, the present application does not limit the number of forks of each node on the path. For example, each fork node may be a 1-way tree or a 2-way tree.
[0131] It should be noted that there may be parts of the graphical quantitative trading strategy that are not included in the path, such as Fig.10 . The part not included in the path can be outside the running system of the current policy script, for example, it can be outside the process in the form of a control island. In addition, the control island can exist on the policy canvas to facilitate users to call it at any time during policy debugging, but it will not participate in code compilation.
[0132] Since the loop property of the entire quantitative trading strategy is set in the start control, each time the main callback function is triggered, multiple paths can be triggered serially in order. Exemplarily, each path can be encapsulated into a separate path function (such as the second function), and each control can also be encapsulated into a separate control function (such as the first function). When the quantitative trading strategy script is running, the main callback function can call the path function corresponding to each path, and the path function corresponding to each path can call the control function corresponding to each control.
[0133] In the embodiment of the present application, at least one path constructed based on the graphical quantitative trading strategy makes the function call relationship clear and the hierarchical relationship obvious, so that the automated strategy code generation process is more controllable and various exception handling has clear boundaries.
[0134] In some optional embodiments, in the process of generating a script according to a conditional control, it is possible to determine whether the condition is met to select the next node-generated function to be executed.
[0135] Fig.11 is another specific example of at least one path determined according to a graphical quantitative trading strategy. Fig.11 The converted code of path 1 is as follows:
[0136]
[0137]
[0138] In some other possible implementations, when generating a policy script, each node can be generated into a method, and then the entire path can call each method step by step. Alternatively, the entire policy can be viewed as a tree structure, and the corresponding code and indentation can be generated according to the tree structure. The code in a path can be placed in one method to avoid generating too many methods and facilitate logical reading.
[0139] 240, run the quantitative trading strategy script to obtain the quantitative trading results.
[0140] Fig.12 FIG. 1 shows a schematic flow chart of the policy script operation. Fig.12As shown in the figure, when the strategy script is running, the strategy program can establish a connection with the application programming interface (API) module of the client (such as Windows / MAC). The API module completes the sending and receiving of each request and caches the data to reduce the request pressure on the background. The cached data can be returned directly, and other data can be requested from the background again. After the API module processes the data, it can return the data to the strategy program. For example, all market requests and transaction requests can be Fig.12 The architecture shown is implemented.
[0141] For example, Python can be used as a presentation language for running policy scripts. Since Python is easy for users to operate and does not require a separate installation environment, users can easily edit and access the scripts.
[0142] Fig.13 A schematic block diagram of the communication architecture of the interface response provided by the embodiment of the present application is shown. Fig.13 As shown, during the strategy operation, you can manage the operation of the strategy in real time, view the status of the strategy operation and / or view the strategy operation results. For example, the operation results may include information such as account assets, positions, orders, etc., or include the dot information on the K-line and preset message notifications.
[0143] like Fig.13 As shown, the policy management module and the policy program can be run in separate processes. In this way, the policy management module, as the parent process, can easily control the running of the child process and avoid the problem of the policy management module being stuck when the policy program is abnormal.
[0144] Exemplarily, socket communication can be used between processes to facilitate portability or expansion. In addition, socket communication can also make the script program compatible with existing OpenD programs, that is, the script can run on existing OpenAPI programs. In addition, the embodiments of the present application can also use other methods to achieve cross-process communication, such as pipes, shared memory, remote procedure calls, etc., which are not limited in this application.
[0145] Furthermore, in this embodiment, after the quantitative trading strategy script is run based on the graphical quantitative trading strategy and runs successfully, the strategy name of the graphical quantitative trading strategy can be obtained, and then the graphical quantitative trading strategy can be stored for later review or reuse. In addition, this embodiment also includes the following steps:
[0146] Generate strategy control information based on the control identifier in the graphical quantitative trading strategy;
[0147] Based on the strategy function and strategy control information of the graphical quantitative trading strategy, the graphical quantitative trading strategy is stored;
[0148] When the new name of the new graphic strategy is obtained, a target strategy is selected from the stored graphic quantitative trading strategies for recommendation.
[0149] In this embodiment, the method of generating strategy control information based on the control identifier in the graphical quantitative trading strategy can be to connect all the control identifiers in the graphical strategy to obtain the control information, so that the controls stored therein can be directly obtained from the control information; then, when the new name of the newly created graphical strategy is obtained, it is matched from the stored graphical quantitative trading strategies to determine the corresponding target strategy and make a recommendation.
[0150] Therefore, the embodiment of the present application obtains the graphical quantitative trading strategy input by the user through the graphical interface, compiles the graphical quantitative trading strategy to obtain the quantitative trading strategy script, and can obtain the quantitative trading results by running the strategy script. In the present application, the user can edit the desired graphical quantitative trading strategy according to various needs through the graphical interface without having the ability to write program code, so that the present application can realize the simple and flexible creation of quantitative trading strategies to meet the various needs of users.
[0151] The specific implementation modes of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above implementation modes. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present application. For example, the various specific technical features described in the above specific implementation modes can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different implementation modes of the present application can also be arbitrarily combined, and as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.
[0152] It should also be understood that in the various method embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. It should be understood that these sequence numbers can be interchanged where appropriate, so that the embodiments of the present application described can be implemented in an order other than those shown or described.
[0153] Combination of the above Figures 1 to 13 , describes in detail the method embodiment of the present application, and the following is combined with Figure 14 to Figure 15 , describe in detail the device embodiments of the present application.
[0154] Fig.14 4 is a schematic block diagram of an apparatus 400 for creating a quantitative trading strategy according to an embodiment of the present application. Fig.14 As shown, the device 400 may include a display unit 410 , an acquisition unit 420 , and a processing unit 430 .
[0155] The display unit 410 is used to display a graphical interface, where the graphical interface includes at least one editable control.
[0156] The acquisition unit 420 is used to acquire the graphical quantitative trading strategy input by the user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters.
[0157] The processing unit 430 is used to obtain a quantitative trading strategy script according to the graphical quantitative trading strategy.
[0158] The processing unit 430 is further configured to run the quantitative trading strategy script to obtain quantitative trading results.
[0159] In some optional embodiments, the graphical interface includes a control bar, a strategy canvas and a property bar. The acquisition unit 420 is specifically used to:
[0160] Obtain at least one control selected by the user in the control bar;
[0161] In response to a first operation of the user, adding the at least one control to the strategy canvas, wherein a start control is pre-set in the strategy canvas;
[0162] Acquire a control selected by a user in the strategy canvas, and edit the property parameters of the selected control in the property bar;
[0163] In response to a second operation by the user, the at least one control and the start control are connected through the connection line to generate the graphical quantitative trading strategy.
[0164] In some optional embodiments, the control bar includes condition controls and / or event controls.
[0165] In some optional embodiments, the conditional control includes a combined conditional control, and the display unit 410 is further configured to display a pop-up window in response to a third operation of the user. The acquisition unit 420 further includes: acquiring at least two conditions input by the user in the pop-up window and an association relationship between the at least two conditions. The processing unit 430 is further configured to generate the combined conditional control according to the at least two conditions and the association relationship.
[0166] In some optional embodiments, the processing unit 430 is further configured to:
[0167] A binary tree is generated by means of in-order variables, wherein the leaf nodes of the binary tree represent the at least two conditions, and the branch nodes of the binary tree represent the association relationship between the at least two conditions.
[0168] The display unit 410 is further configured to display a preview image of the combined conditional control, wherein the preview image includes the binary tree.
[0169] The property setting of the start control includes at least one of applicable account setting, loop setting and global variable setting.
[0170] In some optional embodiments, the processing unit 430 is specifically configured to:
[0171] Determine at least one path according to the graphical quantitative trading strategy, wherein the path includes at least one first control and a connection line between the first control and an adjacent control;
[0172] Encapsulating the first control into a first function;
[0173] According to the first function and the connection line between the first control and the adjacent control, the path is encapsulated into a second function, and the second function internally calls the first function of the first control in the path;
[0174] According to the second function, the quantitative trading strategy script is obtained, wherein the quantitative trading strategy script includes a callback function, and the callback function calls the second function.
[0175] In some optional embodiments, the path includes at least two of the first controls, and the at least two first controls form a tree network topology structure.
[0176] In some optional embodiments, the graphical quantitative trading strategy includes a start control, wherein the number of the at least one path is determined according to the number of exits of the start control.
[0177] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, in this embodiment, the device 400 may correspond to the corresponding subject of the method 200 of the embodiment of the present application, and the aforementioned and other operations and / or functions of each module in the device 400 are respectively for implementing Figure 2 For the sake of brevity, the corresponding processes in each method are not repeated here.
[0178] The above describes the device and system of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0179] like Fig.15 It is a schematic block diagram of an electronic device 800 provided in an embodiment of the present application.
[0180] like Fig.15 As shown, the electronic device 800 may include:
[0181] The memory 810 and the processor 820, the memory 810 is used to store the computer program and transmit the program code to the processor 820. In other words, the processor 820 can call and run the computer program from the memory 810 to implement the method in the embodiment of the present application.
[0182] For example, the processor 820 may be configured to execute steps in the method 200 according to instructions in the computer program.
[0183] In some embodiments of the present application, the processor 820 may include but is not limited to:
[0184] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0185] In some embodiments of the present application, the memory 810 includes but is not limited to:
[0186] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0187] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 810 and executed by the processor 820 to complete the coding method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 800.
[0188] Optional, such as Figure 8 As shown, the electronic device 800 may further include:
[0189] The transceiver 830 may be connected to the processor 820 or the memory 810 .
[0190] The processor 820 may control the transceiver 830 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 830 may include a transmitter and a receiver. The transceiver 830 may further include an antenna, and the number of antennas may be one or more.
[0191] It should be understood that the various components in the electronic device 800 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0192] According to one aspect of the present application, a communication device is provided, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory, so that the encoder executes the method of the above method embodiment.
[0193] According to one aspect of the present application, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0194] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of the above method embodiment.
[0195] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0196] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0197] In the several embodiments provided in the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0198] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0199] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for creating a quantitative trading strategy, characterized in that: include: Displaying a graphical interface, wherein the graphical interface includes at least one editable control; Acquire a graphical quantitative trading strategy input by a user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters; the at least two edited controls include a start control and at least one control from a control bar; According to the graphical quantitative trading strategy, obtain the quantitative trading strategy script; Run the quantitative trading strategy script to obtain the quantitative trading results; Wherein, obtaining a quantitative trading strategy script according to the graphical quantitative trading strategy includes: Determine at least one path according to the graphical quantitative trading strategy, wherein the path includes at least one first control and a connecting line between the first control and an adjacent control; the number of the at least one path is determined according to the number of exits of the start control; Encapsulating the first control into a first function; According to the first function and the connection line between the first control and the adjacent control, the path is encapsulated into a second function, and the second function internally calls the first function of the first control in the path; According to the second function, the quantitative trading strategy script is obtained, wherein the quantitative trading strategy script includes a callback function, and the callback function calls the second function.
2. The method according to claim 1, characterized in that The graphical interface includes a control bar, a strategy canvas and a property bar; The obtaining of the graphical quantitative trading strategy input by the user through the graphical interface includes: Obtain at least one control selected by the user in the control bar; In response to a first operation of the user, adding the at least one control to the strategy canvas, wherein a start control is pre-set in the strategy canvas; Acquire a control selected by a user in the strategy canvas, and edit the property parameters of the selected control in the property bar; In response to a second operation by the user, the at least one control and the start control are connected through the connection line to generate the graphical quantitative trading strategy.
3. The method according to claim 2, characterized in that The control bar includes condition controls and / or event controls.
4. The method according to claim 3, characterized in that The conditional control includes a combined conditional control, and the method further includes: In response to a third operation of the user, displaying a pop-up window; Acquire at least two conditions entered by the user in the pop-up window and an association relationship between the at least two conditions; The combined conditional control is generated according to the at least two conditions and the association relationship.
5. The method according to claim 4, characterized in that Also includes: Generate a binary tree by means of in-order variables, wherein the leaf nodes of the binary tree represent the at least two conditions, and the branch nodes of the binary tree represent the association relationship between the at least two conditions; A preview image of the combined conditional control is displayed, wherein the preview image includes the binary tree.
6. The method according to claim 2, characterized in that The property setting of the start control includes at least one of applicable account setting, loop setting and global variable setting.
7. The method according to claim 1, characterized in that The path includes at least two of the first controls, and the at least two first controls form a tree-shaped network topology structure.
8. A device for creating a quantitative trading strategy, characterized in that: include: A display unit, configured to display a graphical interface, wherein the graphical interface includes at least one editable control; an acquisition unit, configured to acquire a graphical quantitative trading strategy input by a user through the graphical interface, wherein the graphical quantitative trading strategy includes at least two edited controls and a connecting line, wherein the connecting line is used to connect the edited controls, and the edited controls include attribute parameters; the at least two edited controls include a start control and at least one control from a control bar; A processing unit, configured to obtain a quantitative trading strategy script according to the graphical quantitative trading strategy; The processing unit is also used to run the quantitative trading strategy script to obtain quantitative trading results; Wherein, the processing unit is specifically used for: Determine at least one path according to the graphical quantitative trading strategy, wherein the path includes at least one first control and a connecting line between the first control and an adjacent control; the number of the at least one path is determined according to the number of exits of the start control; Encapsulating the first control into a first function; According to the first function and the connection line between the first control and the adjacent control, the path is encapsulated into a second function, and the second function internally calls the first function of the first control in the path; According to the second function, the quantitative trading strategy script is obtained, wherein the quantitative trading strategy script includes a callback function, and the callback function calls the second function.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the processor executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for realizing quantitative trading in mobile computing device
CN106504088A
A method and a product for building programmed transaction logic based on graphics
CN108984167A