Transaction processing method and apparatus, program product, and electronic device
By constructing and backtesting trading strategies, effective strategies are selected and funds are dynamically adjusted, solving the problem of ineffective management of trading strategies, improving the success rate and return on investment, and reducing trading risks.
Patent Information
- Application Number
- CN202411887929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-12-19
AI Technical Summary
Existing technologies cannot effectively manage trading strategies, which can easily lead to losses in trading operations, and human intervention may affect the rationality of strategy execution.
Construct a preset number of trading strategies and backtest each strategy a preset number of times. Determine the investment value of each trading strategy based on the trading difference and backtesting results, screen out effective trading strategies, and process trading transactions based on their capital allocation and dynamic adjustments.
It improves the success rate and return on investment, effectively manages trading strategies, reduces trading risks, and ensures the scientific nature and stability of trading.
Smart Images

Figure CN119671732B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a method for processing transaction business and its device, program product, and electronic equipment. Background Art
[0002] Quantitative trading replaces subjective judgment with mathematical models, using computer technology to filter through vast amounts of historical data for multiple "high-probability" events that can generate profits. This helps formulate trading strategies, mitigating the impact of system administrators' emotional fluctuations and preventing irrational trading decisions during periods of extreme market enthusiasm or pessimism. Consequently, in the financial trading sector, trading strategies are typically constructed and executed based on these strategies in the hope of generating returns.
[0003] However, during actual execution, trading strategies may encounter various problems. For example, due to program loopholes or the strategy itself being ill-considered, erroneous trades may occur, and homogeneous models may also generate competitive trades, all of which may result in loss of profits.
[0004] In related technologies, when these issues arise, manual intervention is generally used to address them. However, manual intervention can also be untimely, or even when the strategy itself isn't flawed, human sensitivity can affect the execution of the trading strategy, causing it to lose the rational nature of quantitative trading.
[0005] Therefore, there is an urgent need for a trading strategy management method to enable the trading strategy for the trading business to be effectively executed and reduce the profit loss of the trading business.
[0006] To the above problems, no effective solution has been proposed yet. Summary of the Invention
[0007] The embodiments of the present invention provide a method for processing transaction business and its device, program product, and electronic device, so as to at least solve the technical problem in related technologies that the transaction strategy of transaction business cannot be effectively managed, resulting in the transaction business being prone to loss of revenue.
[0008] According to one aspect of an embodiment of the present invention, a method for processing a trading business is provided, comprising: constructing a preset number of trading strategies for the trading business, and backtesting each trading strategy a preset number of times to obtain a backtest result corresponding to each backtest, wherein the backtest result at least includes: a trading difference; determining an input value of the trading strategy based on the trading difference and the preset number of times, and judging whether the trading strategy is a valid trading strategy based on the input value; in the case where the trading strategy is judged to be a valid trading strategy, determining the trading funds allocated to each valid trading strategy based on the input value of each valid trading strategy; and processing the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy.
[0009] Furthermore, before backtesting each trading strategy a preset number of times, it also includes: determining the backtesting time length of each backtest based on the execution time of the trading strategy; determining the preset number of backtests for the trading strategy, and determining the initial allocation of funds for the trading strategy.
[0010] Furthermore, the step of backtesting each trading strategy a preset number of times and obtaining a backtest result corresponding to each backtest includes: collecting historical trading data over a historical time period equal to the backtest time length; backtesting the trading strategy a preset number of times using the historical trading data; obtaining the end-of-period funds of the current trading business after the backtest after each backtest is completed; determining the transaction difference of the current backtest based on the end-of-period funds and the initial allocated funds, and re-performing the current backtest when the transaction difference is equal to a first preset value until the transaction difference of the current backtest is not the first preset value; and recording the transaction difference in the backtest result.
[0011] Furthermore, the step of determining the investment value of the trading strategy based on the transaction difference and the preset number of times includes: determining a first number of transaction differences that are greater than a first preset value; determining the backtest win rate based on the first number and the preset number of times; determining the backtest transaction ratio based on the transaction difference of each backtest; and determining the investment value of the trading strategy based on the backtest transaction ratio and the backtest win rate.
[0012] Furthermore, after determining the investment value of the trading strategy based on the trading difference and the preset number of times, it also includes: when the investment value is greater than a second preset value, determining the trading strategy as a valid trading strategy; when the investment value is less than or equal to the second preset value, determining the trading strategy as an invalid trading strategy, and adjusting the strategy parameters of the invalid trading strategy.
[0013] Furthermore, in the process of processing the transaction business based on each effective transaction strategy and the transaction funds corresponding to the effective transaction strategy, the process further includes: after the effective transaction strategy is executed for D unit time periods, obtaining the end funds of each unit time period, wherein D is a positive integer and D unit time periods are less than the execution time period of the effective transaction strategy; determining the fund difference between the end funds of each unit time period and the end funds of the previous unit time period of the unit time period, wherein, when the unit time period is the first unit time period, the end funds of the previous unit time period of the unit time period are the transaction funds; determining the fund difference, etc. A second quantity is greater than a third preset value, and a third quantity of funds difference greater than the third preset value is determined; based on the second quantity, the third quantity and D, the real winning rate is determined, and based on the funds difference of each unit time, the real trading ratio is determined; based on the real winning rate, the backtest winning rate and the preset backtest weight, the target winning rate is determined, and based on the real trading ratio, the backtest trading ratio and the preset backtest weight, the target trading ratio is determined; based on the target winning rate and the target trading ratio, the target investment value of the effective trading strategy is determined; based on the target investment value, the target trading funds for the next execution of the effective trading strategy are adjusted.
[0014] Furthermore, in the process of processing transaction business based on each valid transaction strategy and the transaction funds corresponding to the valid transaction strategy, it also includes: receiving a transaction request initiated by each valid transaction strategy, wherein the transaction request includes at least: transaction asset type, transaction type, and transaction amount; when there are any two valid transaction strategies that trade transaction assets indicated by the same transaction asset type within a preset time period, and the transaction types are different, determining the target transaction amount based on the transaction amount, and processing the transaction request based on the transaction asset type, transaction type, and target transaction amount; when there are multiple valid transaction strategies that trade transaction assets indicated by the same transaction asset type within a preset time period, and the transaction types are the same, determining the processing order of the transaction requests of the valid transaction strategies from low to high based on the transaction amounts; and processing the transaction request based on the processing order.
[0015] According to another aspect of an embodiment of the present invention, a processing device for trading business is also provided, including: a backtesting unit, used to construct a preset number of trading strategies for the trading business, and backtest each trading strategy a preset number of times to obtain a backtesting result corresponding to each backtest, wherein the backtesting result at least includes: a trading difference; a first determination unit, used to determine the input value of the trading strategy based on the trading difference and the preset number of times, and judge whether the trading strategy is a valid trading strategy based on the input value; a second determination unit, used to determine the trading funds allocated to each valid trading strategy based on the input value of each valid trading strategy when it is judged that the trading strategy is a valid trading strategy; a processing unit, used to process the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy.
[0016] Furthermore, the processing device also includes: a first determination module, which is used to determine the backtesting time length of each backtest based on the execution time of the trading strategy before backtesting each trading strategy a preset number of times; a second determination module, which is used to determine the preset number of backtests for the trading strategy and determine the initial allocation of funds for the trading strategy.
[0017] Furthermore, the backtesting unit includes: a first acquisition module, which is used to collect historical trading data over a historical time period equal to the length of the backtesting time; a first backtesting module, which is used to use the historical trading data to backtest the trading strategy a preset number of times; a first acquisition module, which is used to obtain the end-of-period funds of the current backtesting trading business after each backtesting is completed; a third determination module, which is used to determine the trading difference of the current backtesting based on the end-of-period funds and the initial allocated funds, and when the trading difference is equal to a first preset value, re-perform the current backtesting until the trading difference of the current backtesting is not the first preset value; and a first recording module, which is used to record the trading difference in the backtesting results.
[0018] Furthermore, the first determination unit includes: a fourth determination module, used to determine a first number of transaction differences greater than a first preset value; a fifth determination module, used to determine a backtest win rate based on the first number and a preset number of times; a sixth determination module, used to determine a backtest transaction ratio based on the transaction difference of each backtest; and a seventh determination module, used to determine an investment value of the trading strategy based on the backtest transaction ratio and the backtest win rate.
[0019] Furthermore, the processing device also includes: an eighth determination module, which is used to determine the investment value of the trading strategy based on the trading difference and the preset number of times, and determine that the trading strategy is a valid trading strategy when the investment value is greater than a second preset value; a ninth determination module, which is used to determine that the trading strategy is an invalid trading strategy when the investment value is less than or equal to the second preset value, and adjust the strategy parameters of the invalid trading strategy.
[0020] Furthermore, the processing device also includes: a second acquisition module for acquiring the end funds of each unit time after the effective trading strategy is executed for D unit time in the process of processing the trading business based on each effective trading strategy and the trading funds corresponding to the effective trading strategy, wherein D is a positive integer and D unit time is less than the execution time of the effective trading strategy; a tenth determination module for determining the difference in funds between the end funds of each unit time and the end funds of the previous unit time of the unit time, wherein, when the unit time is the first unit time, the end funds of the previous unit time of the unit time are the trading funds; an eleventh determination module for determining whether the fund difference is equal to the first unit time. a second quantity of three preset values, and determines a third quantity of the funds difference that is greater than the third preset value; a twelfth determination module, for determining the real winning rate based on the second quantity, the third quantity and D, and determining the real trading ratio based on the funds difference of each unit time; a thirteenth determination module, for determining the target winning rate based on the real winning rate, the backtest winning rate and the preset backtest weight, and determining the target trading ratio based on the real trading ratio, the backtest trading ratio and the preset backtest weight; a fourteenth determination module, for determining the target investment value of the effective trading strategy based on the target winning rate and the target trading ratio; a first adjustment module, for adjusting the target trading funds for the next execution of the effective trading strategy based on the target investment value.
[0021] Furthermore, the processing device also includes: a first receiving module, which is used to receive a transaction request initiated by each valid trading strategy in the process of processing the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, wherein the transaction request at least includes: trading asset type, transaction type, and transaction amount; a fifteenth determination module, which is used to determine the target transaction amount based on the transaction amount when there are any two valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period and the transaction types are different, and to process the transaction request based on the trading asset type, transaction type, and target transaction amount; a sixteenth determination module, which is used to determine the processing order of the transaction requests of the valid trading strategies from low to high based on the transaction amount when there are multiple valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period and the transaction types are the same; the first processing module is used to process the transaction request according to the processing order.
[0022] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements any one of the above-mentioned transaction processing methods.
[0023] According to another aspect of an embodiment of the present invention, an electronic device is also provided, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the processing method of any one of the above-mentioned transaction businesses.
[0024] In the present invention, a preset number of trading strategies are constructed for trading business, and each trading strategy is backtested a preset number of times to obtain the backtest results corresponding to each backtest. Based on the trading difference and the preset number of times, the input value of the trading strategy is determined, and based on the input value, it is judged whether the trading strategy is a valid trading strategy. When it is judged that the trading strategy is a valid trading strategy, the trading funds allocated to each valid trading strategy are determined based on the input value of each valid trading strategy. Based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, the trading business is processed, thereby solving the technical problem in the related art that the trading strategy of the trading business cannot be effectively managed, resulting in the trading business being prone to loss of income.
[0025] In the present invention, by constructing a preset number of trading strategies and conducting backtesting, effective trading strategies with higher profit potential can be screened out. At the same time, by dynamically adjusting the trading funds of effective trading strategies, the return on investment can be maximized while ensuring that risks are controllable, effectively improving the transaction success rate and return on capital, thereby achieving the technical effect of effectively managing trading strategies and reducing trading risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0027] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a method for processing transaction services is shown;
[0028] Figure 2 is a flowchart of a method for processing a transaction business according to Example 1 of the present application;
[0029] Figure 3 Schematic diagram of the management process of the trading strategy management system according to Example 1 of the present application;
[0030] Figure 4 is a schematic diagram of the execution process of the policy management module according to Example 1 of the present application;
[0031] Figure 5 This is a schematic diagram of the execution flow of the order processing module according to Example 1 of the present application;
[0032] Figure 6 is a schematic diagram of an optional transaction service processing device according to an embodiment of the present invention;
[0033] Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] It should be noted that the transaction business processing method and device thereof in the present invention can be used in financial technology when processing transaction business, and can also be used in any field other than financial technology when processing transaction business. The application field of the transaction business processing method and device thereof in the present invention is not limited.
[0037] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse. For example, an interface is set up between this system and the relevant users or institutions. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or institution through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or institution.
[0038] In this invention, a management method for quantitative trading strategies is proposed. The Kelly formula (i.e., a mathematical model used to backtest trading strategies) can be used to limit the operating space of trading strategies, reduce losses caused by program loopholes or erroneous transactions due to poor consideration of the strategy itself, and minimize the impact of human intervention on strategy judgment. At the same time, a unified quotation system is used to reduce the waste of resources and funds caused by competitive transactions generated by homogeneous models within the system. In addition, a multi-campus deployment of Paas (Platform as a Service) containers can be adopted to reduce the impact of network interruptions, hardware failures, etc.
[0039] The present invention will be described in detail below with reference to various embodiments.
[0040] Example 1
[0041] According to an embodiment of the present application, an embodiment of a method for processing transaction business is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0042] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a transaction processing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more ( Figure 1102a, 102b, ..., 102n are used to illustrate) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera, wherein the network interface may be connected to a wired and / or wireless network. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0043] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0044] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the transaction processing method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-mentioned transaction processing method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0045] The transmission device 106 is used to receive or send data via a network. A specific example of the network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0046] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0047] Under the above operating environment, this application provides Figure 2 The processing method of the transaction business shown. Figure 2 This is a flowchart of a method for processing a transaction according to Example 1 of the present application. Figure 2 As shown, the method includes the following steps:
[0048] Step S201: Construct a preset number of trading strategies for the trading business, and perform a preset number of backtests on each trading strategy to obtain a backtest result corresponding to each backtest, wherein the backtest result at least includes: a trading difference.
[0049] In an embodiment of the present invention, the transaction business processing method can be applied to a transaction strategy management system, which includes: a strategy management module, an order processing module, a risk control module, and a report generation module.
[0050] Figure 3 This is a schematic diagram of the management process of the trading strategy management system according to Example 1 of the present application, such as Figure 3 As shown, the trading strategy management system can uniformly manage multiple trading strategies (such as trading strategy 1, trading strategy 2, ..., trading strategy n), and then make a unified quotation for the transaction amount of each trading strategy to the trading end through the trading strategy management system to reduce the waste of funds.
[0051] In an embodiment of the present invention, a trading business may be a buying and selling business in the financial trading field, such as a foreign exchange trading business, a fund trading business, a futures trading business, etc. For different trading businesses, a strategy management module in a trading strategy management system may construct a corresponding preset number of trading strategies (which may be dynamically adjusted) based on historical data of the trading business (including multiple transaction records generated for the transaction objects corresponding to the trading business).
[0052] Before a trading strategy is officially put into actual trading, the strategy management module within the trading strategy management system can simulate and test the strategy (i.e., backtest) using historical trading data to evaluate its performance in the real market. A preset number of backtests (e.g., 10) is set to ensure statistical significance, and multiple backtests are typically conducted to reduce randomness and uncertainty in the results. The results of each backtest include at least the "trading spread," which is the amount or percentage of profit or loss generated by the trading strategy during the backtest period.
[0053] In this embodiment, by constructing and backtesting trading strategies, it is possible to fully evaluate and optimize trading strategies before they are officially launched into the market, achieve reasonable allocation of funds, improve the scientific nature of trading decisions, enhance the adaptability and flexibility of trading strategies, and promote the development of quantitative trading towards standardization and automation, ultimately achieving the goal of improving trading efficiency and reducing risks.
[0054] Step S202: determining the investment value of the trading strategy based on the transaction difference and the preset number of times, and judging whether the trading strategy is a valid trading strategy based on the investment value.
[0055] In an embodiment of the present invention, the strategy management module in the trading strategy management system can backtest each trading strategy a preset number of times, collect the trading difference from each backtest, and then calculate the investment value of the trading strategy based on the collected backtest data (this investment value is used to indicate whether and how much profit can be made by using the trading strategy to process trading business). Thereafter, based on the investment value of the trading strategy, it is determined whether the trading strategy is valid. For example, if the investment value of a trading strategy is less than or equal to zero, this means that according to the backtest results, the trading strategy will not bring positive expected returns in the long term and may even cause financial losses. Therefore, the system will determine such a strategy as an invalid trading strategy and will not allow it to be approved or continued to be executed.
[0056] Step S203: When it is determined that the trading strategy is a valid trading strategy, the trading funds allocated to each valid trading strategy are determined based on the input value of each valid trading strategy.
[0057] In the embodiment of the present invention, if the input value of a trading strategy is greater than zero, it indicates that the trading strategy is a valid trading strategy. The strategy management module in the trading strategy management system can calculate the trading funds allocated to each valid trading strategy based on the input values of all valid trading strategies.
[0058] Step S204: Processing the transaction business based on each valid transaction strategy and the transaction funds corresponding to the valid transaction strategy.
[0059] In embodiments of the present invention, the order processing module in the trading strategy management system can execute trading operations based on each valid trading strategy and its corresponding trading funds. For example, it can receive trading signals (such as buy or sell asset recommendations) issued by the trading strategy and execute corresponding trading actions in the financial market.
[0060] In an embodiment of the present invention, the order processing module in the transaction strategy management system can be deployed by deploying Paas containers in multiple parks. For example, each order processing module is deployed on a different server as an order processing node. In this way, the impact of network interruptions or hardware failures can be reduced, ensuring the stable operation of transaction services.
[0061] In this embodiment, by processing transaction business based on each effective transaction strategy and its transaction funds, transaction efficiency can be improved and risk control can be strengthened.
[0062] In summary, for trading business, a preset number of trading strategies are constructed, and each trading strategy is backtested a preset number of times to obtain the backtest results corresponding to each backtest. Based on the trading difference and the preset number of times, the input value of the trading strategy is determined, and based on the input value, it is judged whether the trading strategy is a valid trading strategy. When it is judged that the trading strategy is a valid trading strategy, the trading funds allocated to each valid trading strategy are determined based on the input value of each valid trading strategy. Based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, the trading business is processed, which effectively improves the transaction success rate and the rate of return on funds, thereby achieving the technical effect of effectively managing trading strategies and reducing trading risks, and thus solves the technical problem in related technologies that the trading strategies of trading business cannot be effectively managed, resulting in the trading business being prone to loss of income.
[0063] In order to accurately backtest the trading strategy, in the trading business processing method provided in Example 1 of the present application, before backtesting each trading strategy a preset number of times, the backtesting time length of each backtest is determined based on the execution duration of the trading strategy; the preset number of backtests for the trading strategy is determined, and the initial allocation of funds for the trading strategy is determined.
[0064] In the embodiments of the present invention, backtesting trading strategies using historical data is an important step in assessing their effectiveness and risk in quantitative trading. To accurately backtest trading strategies, backtesting parameters need to be set for each trading strategy, including backtesting time length T(0), backtesting number HT(0), and initial allocated funds M(0).
[0065] In embodiments of the present invention, each trading strategy has a specific execution cycle or timescale, which depends on the type of trading strategy (e.g., high-frequency trading, long-term trend tracking, etc.) and the target market (e.g., futures, etc.). Based on the execution time of the trading strategy, the backtesting period for each backtest can be determined to ensure that the backtested data fully reflects the strategy's performance in the actual market. For example, for a day trading strategy, the backtesting period may be set to one trading day; for a long-term trend strategy, the backtesting period may need to cover months or even years of market data.
[0066] In this embodiment of the present invention, to improve the statistical significance and accuracy of the evaluation, it is necessary to backtest each trading strategy multiple times, i.e., a preset number of backtests. The selection of the preset number of backtests is typically based on factors such as the complexity of the strategy, the type of trading business, and the availability of computing resources.
[0067] In the embodiment of the present invention, equal initial allocation funds may be allocated to each trading strategy, or the initial allocation funds of the trading strategy may be determined based on factors such as the capital demand of the trading strategy and the type of trading business.
[0068] In order to improve the accuracy of determining the backtest results, in the transaction business processing method provided in Example 1 of the present application, historical transaction data of a historical time period equal to the backtest time length is collected; the trading strategy is backtested a preset number of times using the historical transaction data; after each backtest is completed, the end-of-period funds of the transaction business after the current backtest are obtained; based on the end-of-period funds and the initial allocated funds, the transaction difference of the current backtest is determined, and when the transaction difference is equal to the first preset value, the current backtest is repeated until the transaction difference of the current backtest is not the first preset value; and the transaction difference is recorded in the backtest results.
[0069] In an embodiment of the present invention, the strategy management module in the trading strategy management system can extract historical trading data within a time period that matches the execution time of the trading strategy (i.e., the backtest time length) from the historical data warehouse (which stores data generated by historical transactions). For example, if the execution cycle of the strategy is daily, the length of the historical time period collected is one trading day; if the strategy is long-term trend tracking, the length of the historical time period collected may be several months. Then, based on the historical trading data, the trading strategy is backtested a preset number of times, and after each backtest is completed, the end-of-period funds M(i) of the trading business are obtained (where i represents the i-th backtest), that is, the total funds of the strategy at the end of the simulated transaction (which can be determined by all the assets owned and the corresponding values of the assets). By comparing the end-of-period funds with the initial allocated funds, the current backtest transaction difference YL(i) = M(i) - M(0) can be calculated.
[0070] In this embodiment of the present invention, if the trading difference equals zero (i.e., the first preset value), this may mean that the strategy has not produced significant results in the current backtest. To ensure the accuracy of the backtest results, the current backtest can be repeated until the trading difference is no longer zero. This increases the reliability of the strategy evaluation and avoids erroneous conclusions caused by data selection bias. Furthermore, the trading difference of each backtest is recorded in the backtest results to form a complete strategy evaluation report. This data will be used for subsequent fund allocation, strategy optimization, and risk assessment.
[0071] In order to improve the accuracy of determining the input value of a trading strategy, the method for processing trading business provided in Example 1 of the present application includes: determining a first number of trading differences that are greater than a first preset value; determining a backtest win rate based on the first number and the preset number of times; determining a backtest trading ratio based on the trading difference of each backtest; and determining the input value of the trading strategy based on the backtest trading ratio and the backtest win rate.
[0072] In an embodiment of the present invention, during the backtesting process, the trading difference of each backtest can be recorded, that is, the profit and loss of the strategy after the backtest. Moreover, after all backtests are completed, a first number of trading differences (i.e., YL>0) greater than a first preset value (i.e., 0) can be determined (i.e., the number of profitable times). Then, based on the first number and the preset number of backtests n, the backtest win rate P of the strategy is calculated. hc (ie, the backtest winning rate P hc = Number of profitable times / n). The higher the win rate, the more profitable opportunities the strategy has shown in the backtest, and the stronger its long-term profitability. and the sum of all profitable trade differences And count the number of losses and the sum of all losing trades According to the formula Calculate the backtest trading ratio YK hc , where I is the characteristic function, that is
[0073]
[0074] In this embodiment, a higher transaction ratio means that the gains that the strategy can obtain from profitable transactions are relatively greater than the losses from losing transactions.
[0075] In the embodiment of the present invention, based on the backtest transaction ratio YK and the backtest winning rate P hc , using the formula Calculate the input value f(0) of the trading strategy. The larger the input value, the higher the proportion of capital allocation the strategy should obtain, and vice versa.
[0076] In order to determine whether a trading strategy is a valid trading strategy, in the trading business processing method provided in Example 1 of the present application, after determining the input value of the trading strategy based on the trading difference and the preset number of times, if the input value is greater than a second preset value, the trading strategy is determined to be a valid trading strategy; if the input value is less than or equal to the second preset value, the trading strategy is determined to be an invalid trading strategy, and the strategy parameters of the invalid trading strategy are adjusted.
[0077] In an embodiment of the present invention, the input value of a trading strategy reflects the ratio of the expected return to risk of the strategy in long-term operation, that is, the proportion of funds that should be invested in the strategy. If the calculated input value is greater than a second preset value (such as 0), the strategy is marked as an "effective trading strategy". This means that the strategy has shown a stable profit model in the backtest of historical data and has the potential to make profits in the actual market. If the input value of the strategy is less than or equal to the second preset value, the strategy is marked as an "invalid trading strategy". This indicates that the strategy may have failed to show sufficient profit potential in the backtest or there is a higher risk. For strategies identified as invalid, the system administrator or strategy administrator needs to adjust the strategy parameters (for example, the proportion and amount of purchasing a certain asset, etc.), or optimize the strategy model to increase its input value until the standard of an effective strategy is met.
[0078] In order to improve the accuracy of determining the trading funds of a trading strategy, in the method for processing trading services provided in Example 1 of the present application, in the process of processing trading services based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, after the valid trading strategy is executed for D unit time periods, the end funds of each unit time period are obtained, wherein D is a positive integer, and D unit time periods are less than the execution time of the valid trading strategy; the difference in funds between the end funds of each unit time period and the end funds of the previous unit time period of the unit time period is determined, wherein, when the unit time period is the first unit time period, the end funds of the previous unit time period of the unit time period are the end funds of the previous unit time period of the unit time period. The end funds are trading funds; determine a second amount whose fund difference is equal to a third preset value, and determine a third amount whose fund difference is greater than the third preset value; determine the real winning rate based on the second amount, the third amount and D, and determine the real trading ratio based on the fund difference of each unit time; determine the target winning rate based on the real winning rate, the backtest winning rate and the preset backtest weight, and determine the target trading ratio based on the real trading ratio, the backtest trading ratio and the preset backtest weight; determine the target investment value of the effective trading strategy based on the target winning rate and the target trading ratio; adjust the target trading funds for the next execution of the effective trading strategy based on the target investment value.
[0079] In an embodiment of the present invention, after the strategy has been executed for a certain period of time (D (D is a positive integer) unit time), the total amount of funds (i.e., end funds) M(i) (where i represents the i-th unit time) at the end of the transaction can be recorded for each time unit (e.g., per minute, hour, or day) at the end of the transaction. Here, the total amount of funds at the end of the transaction can be determined by all assets owned at the end of the transaction and the corresponding values of the assets. D unit time represents the time window for monitoring the performance of the strategy, which is shorter than the total execution time of the strategy.
[0080] Then, calculate the difference in funds YL(i) = M(i) - M(i-1) between the ending funds M(i) of each unit time and the ending funds M(i-1) of the previous unit time. For the first unit time, the ending funds of the previous unit time are regarded as the initial trading funds. The difference in funds reflects the profit and loss of the strategy within the unit time. Afterwards, count the number of times the difference in funds is equal to the third preset value (for example, 0) (i.e., the second number, i.e., the number of times YL = 0), and the number of times the difference in funds is greater than the third preset value (i.e., the third number, i.e., the number of times it is profitable). Afterwards, based on the second number, the third number, and D, calculate the true winning rate P of the strategy in actual trading. real , that is, the true winning rate P real =Number of profitable times / [D-(number of times YL=0)].
[0081] In the embodiment of the present invention, the number of profitable times within D unit time can be counted and the sum of all profitable trade differences And count the number of losses within D units of time and the sum of all losing trades According to the formula Calculate the real transaction ratio YK real , where I is the characteristic function, that is Then, according to the actual win rate, backtest win rate and preset backtest weight HW(0) (which can be adjusted dynamically), the target win rate P is determined. final , that is, P final =P hc *HW(0)+P real *(1-HW(0)), and the target transaction ratio YK can be determined based on the actual transaction ratio, the backtest transaction ratio and the preset backtest weight final , namely YK final =YK hc *HW(0)+YK real *(1-HW(0)).
[0082] In the embodiment of the present invention, according to the target winning rate and the target transaction ratio, the formula Calculate the target investment value f of the strategy. This target investment value will guide the system to adjust the target trading funds for the next execution of the effective trading strategy to achieve dynamic optimization of fund allocation.
[0083] Figure 4 This is a schematic diagram of the execution process of the policy management module according to Example 1 of the present application, such as Figure 4 As shown, the strategy management module can first create trading strategies, then backtest each trading strategy, allocate funds for each trading strategy, and then adjust the funds for each trading strategy.
[0084] In order to achieve unified management of the transaction amounts of all trading strategies, in the transaction business processing method provided in Example 1 of the present application, in the process of processing the transaction business based on each valid trading strategy and the transaction funds corresponding to the valid trading strategy, a transaction request initiated by each valid trading strategy is received, wherein the transaction request at least includes: transaction asset type, transaction type, and transaction amount; if there are any two valid trading strategies that trade on the transaction assets indicated by the same transaction asset type within a preset time period, and the transaction types are different, the target transaction amount is determined based on the transaction amount, and the transaction request is processed based on the transaction asset type, transaction type, and target transaction amount; if there are multiple valid trading strategies that trade on the transaction assets indicated by the same transaction asset type within a preset time period, and the transaction types are the same, the processing order of the transaction requests of the valid trading strategies is determined from low to high based on the transaction amount; and the transaction request is processed based on the processing order.
[0085] In an embodiment of the present invention, the order processing module in the trading strategy management system can receive trading requests initiated by each valid trading strategy. These requests include: trading asset type, transaction type (buy or sell) and transaction amount.
[0086] If, within a preset timeframe (e.g., 10 seconds), any two valid trading strategies trade the same asset type, but with different trade types (i.e., one buy, the other sell), the order processing module will determine a target transaction amount based on the transaction amounts of each strategy. This target transaction amount can be the midpoint between the transaction amounts of the two strategies. The order processing module will then process the trade request based on the asset type, transaction type, and target transaction amount, ensuring that the trading needs of the strategies are properly met, effectively reducing capital waste.
[0087] If multiple active trading strategies execute trades of the same asset type (i.e., simultaneous buys or sells) within a preset timeframe, the order processing module prioritizes the strategies' trade requests based on the transaction amounts, from lowest to highest. This approach effectively reduces capital waste. The order processing module then processes the trade requests sequentially according to the predetermined order. This sequential processing mechanism helps optimize trade execution efficiency and reduces execution delays caused by conflicting strategy requests.
[0088] Figure 5 This is a schematic diagram of the execution process of the order processing module according to Example 1 of the present application, such as Figure 5 As shown, the order processing module can receive each trading strategy quotation, and then process the quotation uniformly, and then make quotation to the trading end one by one, and can cancel invalid trading requests.
[0089] Here, an invalid transaction request means that the price quoted by the request is out of the price range given by the transaction terminal.
[0090] The method for processing trading business provided in the embodiment of the present application can screen out effective trading strategies with higher profit potential by constructing a preset number of trading strategies and performing backtesting. At the same time, by dynamically adjusting the trading funds of effective trading strategies, it can maximize the return on investment while ensuring that risks are controllable, effectively improving the transaction success rate and the rate of return on funds, thereby achieving the technical effect of effectively managing trading strategies and reducing trading risks.
[0091] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0092] Example 2
[0093] The present application also provides a transaction processing device. It should be noted that the transaction processing device of the present application can be used to execute the transaction processing method provided in the present application. The transaction processing device provided in the present application is described below.
[0094] According to an embodiment of the present application, a device for implementing the above-mentioned transaction processing method is also provided. Figure 6 is a schematic diagram of an optional transaction service processing device according to an embodiment of the present invention, such as Figure 6 As shown, the processing device may include: a backtesting unit 60 , a first determination unit 61 , a second determination unit 62 , and a processing unit 63 .
[0095] The backtesting unit 60 is configured to construct a preset number of trading strategies for the trading business, and perform a preset number of backtests on each trading strategy to obtain a backtesting result corresponding to each backtest, wherein the backtesting result includes at least: a trading difference;
[0096] A first determining unit 61 is configured to determine an input value of a trading strategy based on the transaction difference and a preset number of times, and to determine whether the trading strategy is a valid trading strategy based on the input value;
[0097] The second determining unit 62 is configured to determine the trading funds allocated to each valid trading strategy based on the input value of each valid trading strategy when the trading strategy is determined to be a valid trading strategy;
[0098] The processing unit 63 is configured to process the transaction based on each valid transaction strategy and the transaction funds corresponding to the valid transaction strategy.
[0099] The processing device for trading business provided in the embodiment of the present application constructs a preset number of trading strategies for trading business through the backtesting unit 60, and backtests each trading strategy a preset number of times to obtain the backtesting results corresponding to each backtest; determines the input value of the trading strategy based on the trading difference and the preset number of times through the first determination unit 61, and judges whether the trading strategy is a valid trading strategy based on the input value; determines the trading funds allocated to each valid trading strategy based on the input value of each valid trading strategy when the second determination unit 62 judges that the trading strategy is a valid trading strategy; processes the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy through the processing unit 63, effectively improving the transaction success rate and the rate of return on funds, thereby achieving the technical effect of effectively managing trading strategies and reducing trading risks, thereby solving the technical problem in the related art that the trading strategies of trading business cannot be effectively managed, resulting in the trading business being prone to loss of income.
[0100] Optionally, the processing device also includes: a first determination module, used to determine the backtesting time length of each backtest based on the execution time of the trading strategy before backtesting each trading strategy a preset number of times; a second determination module, used to determine the preset number of backtests for the trading strategy and determine the initial allocation of funds for the trading strategy.
[0101] Optionally, the backtesting unit includes: a first acquisition module, used to collect historical trading data over a historical time period equal to the length of the backtesting time; a first backtesting module, used to use the historical trading data to backtest the trading strategy a preset number of times; a first acquisition module, used to obtain the end-of-period funds of the current backtesting trading business after each backtesting is completed; a third determination module, used to determine the trading difference of the current backtesting based on the end-of-period funds and the initial allocated funds, and when the trading difference is equal to a first preset value, re-performing the current backtesting until the trading difference of the current backtesting is not the first preset value; and a first recording module, used to record the trading difference in the backtesting results.
[0102] Optionally, the first determination unit includes: a fourth determination module, used to determine a first number of transaction differences greater than a first preset value; a fifth determination module, used to determine a backtest win rate based on the first number and a preset number of times; a sixth determination module, used to determine a backtest transaction ratio based on the transaction difference of each backtest; and a seventh determination module, used to determine the input value of the trading strategy based on the backtest transaction ratio and the backtest win rate.
[0103] Optionally, the processing device also includes: an eighth determination module, which is used to determine the investment value of the trading strategy based on the trading difference and the preset number of times, and determine that the trading strategy is a valid trading strategy when the investment value is greater than a second preset value; a ninth determination module, which is used to determine that the trading strategy is an invalid trading strategy when the investment value is less than or equal to the second preset value, and adjust the strategy parameters of the invalid trading strategy.
[0104] Optionally, the processing device further includes: a second acquisition module for acquiring the end funds of each unit time after the effective trading strategy is executed for D unit time in the process of processing the trading business based on each effective trading strategy and the trading funds corresponding to the effective trading strategy, wherein D is a positive integer and D unit time is less than the execution time of the effective trading strategy; a tenth determination module for determining the difference in funds between the end funds of each unit time and the end funds of the previous unit time of the unit time, wherein, when the unit time is the first unit time, the end funds of the previous unit time of the unit time are the trading funds; an eleventh determination module for determining whether the fund difference is equal to the third predetermined amount. a second quantity of the set value, and determines a third quantity of the capital difference that is greater than the third preset value; a twelfth determination module, for determining the real winning rate based on the second quantity, the third quantity and D, and determining the real trading ratio based on the capital difference of each unit time; a thirteenth determination module, for determining the target winning rate based on the real winning rate, the backtest winning rate and the preset backtest weight, and determining the target trading ratio based on the real trading ratio, the backtest trading ratio and the preset backtest weight; a fourteenth determination module, for determining the target investment value of the effective trading strategy based on the target winning rate and the target trading ratio; a first adjustment module, for adjusting the target trading funds for the next execution of the effective trading strategy based on the target investment value.
[0105] Optionally, the processing device also includes: a first receiving module, which is used to receive a transaction request initiated by each valid trading strategy in the process of processing the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, wherein the transaction request at least includes: trading asset type, transaction type, and transaction amount; a fifteenth determination module, which is used to determine the target transaction amount based on the transaction amount when there are any two valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period and the transaction types are different, and to process the transaction request based on the trading asset type, transaction type, and target transaction amount; a sixteenth determination module, which is used to determine the processing order of the transaction requests of the valid trading strategies from low to high based on the transaction amount when there are multiple valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period and the transaction types are the same; the first processing module is used to process the transaction request according to the processing order.
[0106] The above-mentioned processing device may further include a processor and a memory. The above-mentioned backtest unit 60, the first determination unit 61, the second determination unit 62, the processing unit 63, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to implement corresponding functions.
[0107] The processor includes a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and kernel parameters are adjusted to process trading operations based on each valid trading strategy and the corresponding trading funds.
[0108] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0109] It should be noted that the backtesting unit 60, the first determination unit 61, the second determination unit 62, and the processing unit 63 correspond to steps S201 to S204 in Example 1. The examples and application scenarios implemented by the above units and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above units can also be part of the device and can be run in the computer terminal 10 provided in Example 1.
[0110] Example 3
[0111] An embodiment of the present application may provide an electronic device, Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device may include: one or more ( Figure 7 Only one is shown) processor 702, memory 704, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0112] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the transaction business processing method and device in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned transaction business processing method. The memory may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0113] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: construct a preset number of trading strategies for the trading business, and backtest each trading strategy a preset number of times to obtain the backtest results corresponding to each backtest, wherein the backtest results at least include: trading difference; based on the trading difference and the preset number of times, determine the input value of the trading strategy, and based on the input value, judge whether the trading strategy is a valid trading strategy; if the trading strategy is judged to be a valid trading strategy, determine the trading funds allocated to each valid trading strategy based on the input value of each valid trading strategy; and process the trading business based on each valid trading strategy and the trading funds corresponding to the valid trading strategy.
[0114] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine the backtesting time length of each backtest based on the execution time of the trading strategy; determine the preset number of backtests for the trading strategy, and determine the initial allocation of funds for the trading strategy.
[0115] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: collect historical trading data over a historical time period equal to the length of the backtest time; use the historical trading data to backtest the trading strategy a preset number of times; after each backtest is completed, obtain the end-of-period funds of the current backtest trading business; based on the end-of-period funds and the initial allocated funds, determine the transaction difference of the current backtest, and when the transaction difference is equal to the first preset value, re-perform the current backtest until the transaction difference of the current backtest is not the first preset value; and record the transaction difference in the backtest results.
[0116] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine a first number of trading differences that are greater than a first preset value; determine the backtest win rate based on the first number and the preset number of times; determine the backtest trading ratio based on the trading difference of each backtest; determine the input value of the trading strategy based on the backtest trading ratio and the backtest win rate.
[0117] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: when the input value is greater than the second preset value, determine the trading strategy as a valid trading strategy; when the input value is less than or equal to the second preset value, determine the trading strategy as an invalid trading strategy, and adjust the strategy parameters of the invalid trading strategy.
[0118] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: after the effective trading strategy is executed for D unit time periods, obtain the end funds of each unit time period, where D is a positive integer and D unit time periods are less than the execution time of the effective trading strategy; determine the difference in funds between the end funds of each unit time period and the end funds of the previous unit time period of the unit time period, where, when the unit time period is the first unit time period, the end funds of the previous unit time period of the unit time period are the trading funds; determine a second amount whose fund difference is equal to a third preset value, and determine a third amount whose fund difference is greater than the third preset value; determine the real win rate based on the second amount, the third amount and D, and determine the real trading ratio based on the fund difference of each unit time period; determine the target win rate based on the real win rate, the backtest win rate and the preset backtest weight, and determine the target trading ratio based on the real trading ratio, the backtest trading ratio and the preset backtest weight; determine the target investment value of the effective trading strategy based on the target win rate and the target trading ratio; adjust the target trading funds for the next execution of the effective trading strategy based on the target investment value.
[0119] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: receiving a transaction request initiated by each valid trading strategy, wherein the transaction request includes at least: trading asset type, transaction type, and transaction amount; when there are any two valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period, and the transaction types are different, determining the target transaction amount based on the transaction amount, and processing the transaction request based on the trading asset type, transaction type, and target transaction amount; when there are multiple valid trading strategies that trade trading assets indicated by the same trading asset type within a preset time period, and the transaction types are the same, determining the processing order of the transaction requests of the valid trading strategies from low to high based on the transaction amount; and processing the transaction request based on the processing order.
[0120] An embodiment of the present application provides a solution for processing trading business. A preset number of trading strategies are constructed for trading business, and each trading strategy is backtested a preset number of times to obtain the backtest results corresponding to each backtest. Based on the trading difference and the preset number of times, the input value of the trading strategy is determined. Based on the input value, whether the trading strategy is a valid trading strategy is determined. If the trading strategy is determined to be a valid trading strategy, the trading funds allocated to each valid trading strategy are determined based on the input value of each valid trading strategy. Trading business is processed based on each valid trading strategy and the trading funds corresponding to the valid trading strategy, effectively improving the transaction success rate and capital return rate, thereby achieving the technical effect of effectively managing trading strategies and reducing trading risks. This solves the technical problem in related technologies of being unable to effectively manage trading strategies for trading business, resulting in the proneness of trading business to revenue losses.
[0121] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only, and the electronic device may also be a terminal device such as a smart phone, a tablet computer, a PDA, or a mobile Internet device (MID). Figure 7 It does not limit the structure of the above electronic device. For example, the electronic device may also include Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 7 Different configurations shown.
[0122] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0123] Example 4
[0124] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the transaction service processing method provided in the first embodiment.
[0125] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0126] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the steps of the method for processing transaction services.
[0127] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0128] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0129] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units 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 units or modules, which can be electrical or other forms.
[0130] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0131] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0132] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0133] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for processing a transaction, characterized in that: include: Constructing a preset number of trading strategies for the trading business, and backtesting each of the trading strategies a preset number of times to obtain backtesting results corresponding to each backtest, wherein the backtesting results at least include: trading difference; Determining an investment value of the trading strategy based on the transaction difference and the preset number of times, and judging whether the trading strategy is a valid trading strategy based on the investment value; In the case where the trading strategy is determined to be the effective trading strategy, determining the trading funds allocated to each effective trading strategy based on the input value of each effective trading strategy; Processing the transaction business based on each of the valid transaction strategies and the transaction funds corresponding to the valid transaction strategies; The step of determining the investment value of the trading strategy based on the trading difference and the preset number of times includes: determining a first amount of the transaction difference greater than a first predetermined value; Determining a backtest win rate based on the first number and the preset number of times; Determining a backtest trading ratio based on the trading difference of each backtest; Determining the input value of the trading strategy based on the backtest transaction ratio and the backtest win rate; The process of processing the transaction business based on each of the valid transaction strategies and the transaction funds corresponding to the valid transaction strategies includes: After the effective trading strategy is executed for D unit periods, obtaining the end funds for each unit period, where D is a positive integer and D unit periods are less than the execution duration of the effective trading strategy; determining a difference between the end funds of each unit time length and the end funds of a unit time length preceding the unit time length, wherein, if the unit time length is the first unit time length, the end funds of the unit time length preceding the unit time length is the transaction funds; determining a second amount where the funding difference is equal to a third preset value, and determining a third amount where the funding difference is greater than the third preset value; Determine the real winning rate based on the second amount, the third amount, and D, and determine the real transaction ratio based on the capital difference of each unit time; Determining a target win rate based on the actual win rate, the backtest win rate, and the preset backtest weight, and determining a target transaction ratio based on the actual transaction ratio, the backtest transaction ratio, and the preset backtest weight; Determining a target investment value of the effective trading strategy based on the target win rate and the target transaction ratio; Adjusting the target trading funds for the next execution of the effective trading strategy based on the target investment value; In the process of processing the transaction business based on each of the effective transaction strategies and the transaction funds corresponding to the effective transaction strategies, the method further includes: receiving a transaction request initiated by each valid transaction strategy, wherein the transaction request includes at least: transaction asset type, transaction type, and transaction amount; If any two valid trading strategies trade the same trading asset indicated by the same trading asset type within a preset time period, and the trading types are different, determining a target trading amount based on the transaction amount, and processing the trading request based on the trading asset type, the transaction type, and the target trading amount; If there are multiple valid trading strategies that trade the same trading asset indicated by the same trading asset type within the preset time period, and the trading types are the same, determining the order of processing the trading requests of the valid trading strategies from low to high based on the transaction amounts; The transaction request is processed according to the processing order.
2. The processing method according to claim 1, characterized in that Before backtesting each of the aforementioned trading strategies for a predetermined number of times, it also includes: Determine the length of each backtest based on the execution time of the trading strategy; Determine the preset number of times to backtest the trading strategy and determine an initial allocation of funds for the trading strategy.
3. The processing method according to claim 2, characterized in that The step of backtesting each of the trading strategies a preset number of times and obtaining a backtest result corresponding to each backtest comprises: Collect historical trading data over a historical period equal to the length of the backtesting period; Backtesting the trading strategy a preset number of times using the historical trading data; After each backtest is completed, obtain the ending funds of the trading business after the current backtest; Determining the transaction difference of the current backtest based on the end-of-period funds and the initial allocated funds, and re-performing the current backtest when the transaction difference is equal to a first preset value, until the transaction difference of the current backtest is not the first preset value; The transaction difference is recorded in the backtest result.
4. The processing method according to claim 1, characterized in that After determining the investment value of the trading strategy based on the transaction difference and the preset number of times, the method further includes: When the input value is greater than a second preset value, determining the trading strategy as the effective trading strategy; When the input value is less than or equal to the second preset value, the trading strategy is determined to be an invalid trading strategy, and the strategy parameters of the invalid trading strategy are adjusted.
5. A transaction processing device, characterized in that: include: A backtesting unit is configured to construct a preset number of trading strategies for a trading business, and perform a preset number of backtests on each of the trading strategies to obtain a backtesting result corresponding to each backtest, wherein the backtesting result includes at least a trading difference; The first determining unit is configured to determine an investment value of the trading strategy based on the transaction difference and the preset number of times, and to determine whether the trading strategy is a valid trading strategy based on the investment value. The step of determining the investment value of the trading strategy based on the transaction difference and the preset number of times includes: determining a first amount of the transaction difference greater than a first predetermined value; Determining a backtest win rate based on the first number and the preset number of times; Determining a backtest trading ratio based on the trading difference of each backtest; Determining the input value of the trading strategy based on the backtest transaction ratio and the backtest win rate; a second determining unit, configured to, when determining that the trading strategy is the effective trading strategy, determine the trading funds allocated to each of the effective trading strategies based on the input value of each of the effective trading strategies; A processing unit is configured to process the transaction based on each of the valid transaction strategies and the transaction funds corresponding to the valid transaction strategies. The processing of the transaction based on each of the valid transaction strategies and the transaction funds corresponding to the valid transaction strategies includes: After the effective trading strategy is executed for D unit periods, obtaining the end funds for each unit period, where D is a positive integer and D unit periods are less than the execution duration of the effective trading strategy; determining a difference between the end funds of each unit time length and the end funds of a unit time length preceding the unit time length, wherein, if the unit time length is the first unit time length, the end funds of the unit time length preceding the unit time length is the transaction funds; determining a second amount where the funding difference is equal to a third preset value, and determining a third amount where the funding difference is greater than the third preset value; Determine the real winning rate based on the second amount, the third amount, and D, and determine the real transaction ratio based on the capital difference of each unit time; Determining a target win rate based on the actual win rate, the backtest win rate, and the preset backtest weight, and determining a target transaction ratio based on the actual transaction ratio, the backtest transaction ratio, and the preset backtest weight; Determining a target investment value of the effective trading strategy based on the target win rate and the target transaction ratio; Adjusting the target trading funds for the next execution of the effective trading strategy based on the target investment value; In the process of processing the transaction business based on each of the effective transaction strategies and the transaction funds corresponding to the effective transaction strategies, the method further includes: receiving a transaction request initiated by each valid transaction strategy, wherein the transaction request includes at least: transaction asset type, transaction type, and transaction amount; If any two valid trading strategies trade the same trading asset indicated by the same trading asset type within a preset time period, and the trading types are different, determining a target trading amount based on the transaction amount, and processing the trading request based on the trading asset type, the transaction type, and the target trading amount; If there are multiple valid trading strategies that trade the same trading asset indicated by the same trading asset type within the preset time period, and the trading types are the same, determining the order of processing the trading requests of the valid trading strategies from low to high based on the transaction amounts; The transaction request is processed according to the processing order.
6. A computer program product, characterized in that The invention comprises a non-volatile computer-readable storage medium storing a computer program, wherein the computer program implements the transaction processing method according to any one of claims 1 to 4 when executed by a processor.
7. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the transaction business processing method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Quantitative trading method and system for financial derivatives
CN102339452A
Multi-module automatic trading system based on network distributed computing
CN106934716A