Transaction strategy autonomous evolution method and device based on closed-loop feedback

By collecting and analyzing market data based on feedback information from the entire trading process, and generating and evolving trading strategies, the problem of insufficient autonomous iterative evolution capability of financial trading intelligent agents is solved, realizing autonomous iterative optimization and environmental adaptation of strategies.

CN123160265APending Publication Date: 2026-11-24GUANGDONG LAB OF ARTIFICIAL INTELLIGENCE & DIGITAL ECONOMY (SZ)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611383518.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing financial trading agents lack the ability to autonomously iterate and evolve their strategies, failing to effectively support the continuous optimization of information during the trading process, resulting in decreased strategy adaptability and reduced effectiveness.

Method used

By collecting market data based on feedback information from the entire trading process, market state representations are generated, reasoning analysis is performed to generate reasoning chains, trading trajectory data is recorded, reflective analysis is conducted to generate structured reflection records, which are stored in a contextual memory bank, summarized into knowledge entries, and trading strategies are retrieved and evolved to achieve autonomous iterative optimization of strategies.

Benefits of technology

It enables the autonomous iterative evolution of trading strategies, dynamically adapting to the ever-changing financial market environment, thereby improving the long-term effectiveness and environmental adaptability of the strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123160265A_ABST
    Figure CN123160265A_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for the autonomous evolution of trading strategies based on closed-loop feedback, comprising: generating a representation of the current market state based on market data; performing reasoning analysis on the current market state representation based on the currently effective trading strategy, outputting trading decisions according to the reasoning chain to execute trading operations, and recording trading trajectory data; performing reflective analysis on the trading trajectory data and the reasoning chain, generating structured reflection records and storing them in a contextual memory bank; when induction conditions are met, summarizing multiple structured reflection records, generating knowledge entries and storing them in a semantic memory bank; retrieving knowledge entries from the semantic memory bank, evolving the currently effective trading strategy, and generating candidate trading strategies; verifying the candidate trading strategies, and if the verification is successful, upgrading the candidate trading strategy to a new effective trading strategy. This application achieves the autonomous iterative evolution of trading strategies by continuously optimizing trading strategies based on feedback information throughout the entire trading process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically to a method and apparatus for the autonomous evolution of trading strategies based on closed-loop feedback. Background Technology

[0002] With the rapid development of artificial intelligence and intelligent agent technologies, the financial trading field is gradually evolving from traditional rule-driven quantitative trading models to intelligent decision-making models. Financial trading intelligent agents based on large language models can comprehensively process multi-source heterogeneous market data, including market data, technical indicators, and news information, and generate trading decisions through logical reasoning. They demonstrate higher decision-making efficiency and environmental adaptability in complex and ever-changing market environments, becoming a current research and application hotspot in the fintech field.

[0003] Currently, most common financial trading agents adopt a single-link operational architecture, which involves market perception, strategy reasoning, and then trade execution. Trading strategies are typically pre-defined sets of rules or decision models trained offline using historical data. However, in actual operation, these agents often rely on manual review and offline parameter tuning to adjust trading strategies, failing to automatically drive strategy iteration based on information from the entire trade execution process. Furthermore, the decision-making logic, execution trajectory, and other process information generated during trade execution are difficult to transform into reusable experience accumulation, making it difficult for trading strategies to continuously self-optimize in response to dynamic changes in the market environment. This leads to decreased strategy adaptability and diminished effectiveness over long-term operation.

[0004] In summary, existing financial trading agents suffer from insufficient autonomous strategy iteration and evolution capabilities, and the inability of trading process information to effectively support continuous strategy optimization. Summary of the Invention

[0005] This application provides a method and apparatus for autonomous evolution of trading strategies based on closed-loop feedback. By continuously optimizing the trading strategy based on feedback information throughout the entire trading process, the trading strategy can achieve autonomous iterative evolution.

[0006] In a first aspect, embodiments of this application provide a method for the autonomous evolution of a trading strategy based on closed-loop feedback, including: Collect market data and generate a current market status representation based on the market data; Based on the currently effective trading strategy, the current market state representation is analyzed to generate an inference chain, and a trading decision is output based on the inference chain. Execute trading operations based on the aforementioned trading decisions, and record the trading trajectory data generated during the trading execution process; The transaction trajectory data and the inference chain are analyzed in reflection to identify patterns in the transaction process and generate structured reflection records. The structured reflection records are stored in the contextual memory bank; When the context memory bank meets the preset induction conditions, the multiple structured reflection records in the context memory bank are summarized to generate knowledge entries and store the knowledge entries in the semantic memory bank. The knowledge entries are retrieved from the semantic memory, and the currently effective trading strategy is evolved based on the retrieved knowledge entries to generate candidate trading strategies. The candidate trading strategies are verified. If the verification is successful, the candidate trading strategies are upgraded to new effective trading strategies.

[0007] Furthermore, in some embodiments of this application, the method for generating the text-type information includes: inputting the collected raw text data into a language model to generate a text summary and / or sentiment analysis results, and using the text summary and / or the sentiment analysis results as components of the text-type information.

[0008] Furthermore, in some embodiments of this application, a deterministic decoding method is used to output the standardized transaction decision, and the generated transaction decision is deterministically verified; if the verification passes, the transaction decision is output to the execution stage, and if the verification fails, re-inference is triggered.

[0009] Furthermore, in some embodiments of this application, the simulated transaction execution based on the transaction instruction, and the calculation of the simulated transaction price and transaction cost, include: calculating slippage based on market liquidity and volatility at the time of execution of the transaction instruction, and calculating transaction commission and tax based on a preset rate, and determining the simulated transaction price and transaction cost based on the slippage, the commission and the tax.

[0010] Furthermore, in some embodiments of this application, the step of performing reflective analysis on the transaction trajectory data and the inference chain to identify patterns in the transaction process and generate structured reflective records further includes: The net profit during the trading period is decomposed into the contribution value of market environment factors and the contribution value of strategy decision factors; And / or, for the actual action at a historical decision moment, simulate and generate a counterfactual market continuation trajectory when an alternative action is taken at that historical decision moment; calculate the expected payoff of the alternative action based on the counterfactual market continuation trajectory; and calculate the counterfactual regret value of the actual action relative to the optimal alternative action based on the expected payoff.

[0011] Furthermore, in some embodiments of this application, after outputting the inductive results as structured knowledge entries, the method further includes: When semantically contradictory knowledge entries exist in the semantic memory, the confidence levels of the two entries are compared. If the confidence difference is less than the preset confidence threshold, then two of the knowledge entries are retained respectively, and each of the knowledge entries is bound to its own applicable market state context. If the confidence difference is greater than or equal to the preset confidence threshold, the knowledge item with the lower confidence is marked as suppressed, and the marked knowledge item is restricted from participating in subsequent searches.

[0012] Furthermore, in some embodiments of this application, the rollback triggering conditions include hard threshold triggering conditions and composite risk score triggering conditions; when the real-time risk indicator meets any of the hard threshold triggering conditions, a rollback operation is immediately performed; when the composite risk score reaches a preset risk threshold in multiple consecutive monitoring periods, a rollback operation is performed.

[0013] Secondly, embodiments of this application provide a trading strategy autonomous evolution device based on closed-loop feedback, comprising: The data acquisition module is used to collect market data and generate a current market status representation based on the market data. The reasoning and decision-making module is used to perform reasoning analysis on the current market state representation based on the currently effective trading strategy, generate a reasoning chain, and output a trading decision based on the reasoning chain. The transaction execution module is used to execute transaction operations based on the transaction decision and record transaction trajectory data generated during the transaction execution process; The reflection analysis module is used to reflect on and analyze the transaction trajectory data and the reasoning chain, identify patterns in the transaction process, and generate structured reflection records. The contextual memory module is used to store the structured reflection records into the contextual memory database; The inductive abstraction module is used to summarize multiple structured reflection records in the context memory bank when the context memory bank meets the preset inductive conditions, generate knowledge entries, and store the knowledge entries in the semantic memory bank. The strategy evolution module is used to retrieve the knowledge entries from the semantic memory, evolve the currently effective trading strategy based on the retrieved knowledge entries, and generate candidate trading strategies. The strategy upgrade module is used to verify the candidate trading strategy. If the verification is successful, the candidate trading strategy is upgraded to a new effective trading strategy.

[0014] This application provides a method and apparatus for the autonomous evolution of trading strategies based on closed-loop feedback. First, market data is collected to generate a representation of the current market state, providing standardized market input for trading decisions. Then, based on the currently effective trading strategy, inference analysis is performed on the market state representation to generate an inference chain. Combined with trading trajectory data recorded during the execution of trading decisions, this comprehensively covers the entire trading process from decision logic to execution results. Next, the trading trajectory data and inference chain are analyzed reflectively, generating structured reflection records stored in a contextual memory bank, achieving structured accumulation of single trading experiences. When the contextual memory bank meets preset regression requirements… When considering the conditions, multiple structured reflection records are summarized and converted into knowledge entries, which are then stored in the semantic memory. This process refines and upgrades fragmented trading experience into reusable knowledge. Knowledge entries are then retrieved from the semantic memory to drive the evolution of the currently effective trading strategy and generate candidate trading strategies. Once verified, these strategies are upgraded to new effective trading strategies. This constructs a complete closed-loop feedback mechanism, enabling the trading strategy to continuously and autonomously iterate and optimize based on feedback information throughout the entire trading process. It can dynamically adapt to the ever-changing financial market environment without relying on manual offline adjustments, effectively improving the long-term effectiveness and environmental adaptability of the trading strategy. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is an application environment diagram of the self-evolution method for trading strategies based on closed-loop feedback provided in the embodiments of this application; Figure 2 This is a flowchart illustrating the autonomous evolution method of trading strategies based on closed-loop feedback provided in an embodiment of this application. Figure 3 This is a schematic diagram of the structure of the self-evolution system for trading strategies based on closed-loop feedback provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of the autonomous evolution device for trading strategies based on closed-loop feedback provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0017] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of systems and methods consistent with those detailed in the appended claims or with some aspects of this application.

[0018] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover descriptions such as non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.

[0019] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0020] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.

[0021] To address the aforementioned technical issues, this application provides a method and apparatus for autonomous evolution of trading strategies based on closed-loop feedback. By continuously optimizing trading strategies based on feedback information throughout the entire trading process, the autonomous iterative evolution of trading strategies is achieved.

[0022] Figure 1 This is an application environment diagram of a trading strategy self-evolution method based on closed-loop feedback in one embodiment. (Refer to...) Figure 1This closed-loop feedback-based autonomous evolution method for trading strategies is applied to a closed-loop feedback-based autonomous evolution system for trading strategies. This system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; the mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be a standalone server or a server cluster consisting of multiple servers. Terminal 110 is configured to execute the aforementioned self-evolution method for trading strategies based on closed-loop feedback, including: collecting market data and generating a representation of the current market state based on the market data; performing reasoning analysis on the current market state representation based on the currently effective trading strategy, generating a reasoning chain, and outputting a trading decision based on the reasoning chain; executing trading operations based on the trading decision and recording the trading trajectory data generated during the trading execution process; performing reflective analysis on the trading trajectory data and the reasoning chain, identifying patterns in the trading process, and generating structured reflection records; storing the structured reflection records in a context memory bank; when the context memory bank meets preset induction conditions, summarizing multiple structured reflection records in the context memory bank, generating knowledge entries, and storing the knowledge entries in a semantic memory bank; retrieving knowledge entries from the semantic memory bank, evolving the currently effective trading strategy based on the retrieved knowledge entries, and generating candidate trading strategies; verifying the candidate trading strategies, and if the verification is successful, upgrading the candidate trading strategy to a new effective trading strategy.

[0023] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for the autonomous evolution of a trading strategy based on closed-loop feedback, according to an embodiment of this application. This embodiment primarily uses the application of this method to a computer device as an example. Specifically, the method for the autonomous evolution of a trading strategy based on closed-loop feedback provided in this embodiment may include the following steps: S1. Collect market data and generate a representation of the current market status based on the market data; Specifically, for step S1, raw market data is continuously acquired from various data sources in the financial market, covering market information across multiple dimensions such as price and volume trends, technical indicators, and market news. The acquired multi-source heterogeneous data is then standardized and integrated to unify data definitions and formats, forming a current market state representation that comprehensively and objectively reflects the market's operational status at a specific moment. This market state representation serves as a unified market fact benchmark for subsequent decision-making, reasoning, and reflective analysis throughout the entire process, ensuring consistency in the market information definitions used in each stage and avoiding judgment biases caused by differences in data standards.

[0024] For example, in a stock trading scenario, market status representation can include real-time market data such as the opening price, closing price, highest price, lowest price, and trading volume of the target security, technical indicators such as moving averages and relative strength indicators, as well as key market information, presenting a multi-dimensional view of the target security and its market status at the current moment.

[0025] S2. Based on the currently effective trading strategy, perform reasoning analysis on the current market state representation, generate a reasoning chain, and output a trading decision based on the reasoning chain; Specifically, for step S2, the currently active trading strategy is loaded. This strategy consists of a series of executable trading rules and judgment principles. Using the generated current market state representation as input, logical reasoning analysis is carried out step-by-step, combining the rule requirements of the active trading strategy. During the reasoning process, the judgment premises, condition matching, and derivation conclusions of each step are recorded in logical order, forming a complete reasoning chain. This reasoning chain can completely trace back the entire logical path from the market state input to the final decision output, achieving traceability and replayability of the decision-making process. Finally, based on the final conclusion of the complete reasoning chain, the corresponding trading decision is output, containing core information such as a clear direction for trading actions.

[0026] For example, based on the currently effective swing trading strategy, logical deduction is performed by combining information such as price levels and indicator positions in the market status representation. It is then used to determine whether the entry conditions, holding conditions, and exit conditions are met in sequence. The basis and conclusion of each step of the judgment are recorded in sequence to form a complete reasoning chain, and finally, a clear trading decision such as buy, sell, or hold is output.

[0027] S3. Execute trading operations based on trading decisions and record the trading trajectory data generated during the trading execution process; Specifically, in step S3, after receiving the output trading decision, it is first converted into a standardized trading instruction conforming to the execution specifications, and then the corresponding trading execution action is completed according to the instruction. During the execution process, transaction-related parameters are calculated in real time, and the position status and account information are updated synchronously. At the same time, the entire time-series data from decision issuance, instruction generation, transaction execution to status update is recorded in chronological order, forming complete trading trajectory data. This trading trajectory data can completely reconstruct the entire process of a single transaction from decision-making to execution, providing full data support at the execution level for subsequent reflection and analysis.

[0028] For example, for a buy decision, it is first converted into a standard trading instruction containing the target code, trading direction, and order quantity. After the transaction is executed, the transaction price, transaction cost, changes in holdings, changes in account equity, and other time-series data are recorded to form a complete transaction execution trajectory and retain all key information of the entire transaction execution process.

[0029] S4. Conduct reflective analysis on transaction trajectory data and reasoning chains, identify patterns in the transaction process, and generate structured reflection records; Specifically, for step S4, at the preset reflection trigger node, the system retrieves all transaction trajectory data within the corresponding period, as well as the reasoning chain data corresponding to each transaction, and performs correlation and comparison analysis between the decision logic data and the execution result data. From multiple dimensions such as decision rationality, execution accuracy, and result matching, it mines recurring characteristic patterns during the transaction process, including reusable effective patterns and problematic patterns that need correction. Subsequently, the identified patterns are organized according to a preset field structure to form a structured reflection record containing pattern type, occurrence time interval, core logic, and related conclusions, achieving the structured and standardized accumulation of single transaction experience.

[0030] For example, after the market closes each day, the decision-making reasoning process of all transactions that day is matched and analyzed one by one with the actual profit and loss results to identify typical patterns such as misjudgment of strategy conditions and deviation of execution timing, and then organized into a structured reflection record according to a unified structure.

[0031] S5. Store the structured reflection records in the contextual memory bank; Specifically, in step S5, each generated structured reflection record is stored in the context memory bank in chronological order. The context memory bank uses a sliding window approach to store all structured reflection records generated within a certain period, fully preserving the experience fragments of each transaction and their corresponding market environment context, serving as a short-term experience storage unit to provide a batch of original experience materials for subsequent knowledge summarization.

[0032] S6. When the context memory bank meets the preset induction conditions, the multiple structured reflection records in the context memory bank are summarized, knowledge entries are generated, and the knowledge entries are stored in the semantic memory bank. Specifically, for step S6, the accumulation status of the context memory bank is continuously monitored. When the number of stored structured reflection records or the time span meet the preset induction trigger conditions, the induction processing flow is initiated. Multiple structured reflection records within the corresponding time window in the context memory bank are used as input for aggregation analysis. Random factors and individual differences in single transactions are eliminated, and common transaction patterns that recur and have statistical regularity are extracted. These patterns are abstracted into reusable structured knowledge items and stored in the semantic memory bank for long-term storage, realizing the upgrade and transformation from scattered single experiences to systemic reusable knowledge.

[0033] For example, when the number of reflection records accumulated in the contextual memory bank reaches a preset number, these records are summarized and categorized to extract common transaction patterns and typical problems in similar market environments, forming corresponding knowledge entries that are then stored in the semantic memory bank.

[0034] S7. Retrieve knowledge entries from the semantic memory base, and evolve the currently effective trading strategy based on the retrieved knowledge entries to generate candidate trading strategies; Specifically, for step S7, when iterating and optimizing the strategy, the system retrieves the most relevant knowledge entries with the highest matching degree from the semantic memory based on the current market environment characteristics and the strategy optimization direction. Using these inductively verified trading knowledge as the basis for optimization, the system adjusts, supplements, or corrects the relevant rules and logic of the currently effective trading strategy, and generates a complete candidate trading strategy as an alternative for strategy upgrade.

[0035] For example, by combining the volatility characteristics of the current market, trading knowledge corresponding to high volatility environments can be retrieved from the semantic memory, and the risk control rules of the current strategy can be optimized and adjusted based on this knowledge to generate a complete candidate trading strategy.

[0036] S8. Verify the candidate trading strategy. If the verification is successful, upgrade the candidate trading strategy to a new effective trading strategy. Specifically, for step S8, the generated candidate trading strategies are backtested using historical market data to comprehensively evaluate their return performance, risk level, and operational stability. When all performance indicators of the candidate strategy meet the preset verification standards and its core performance is no less than that of the original effective strategy, the verification is deemed successful. Subsequently, the candidate trading strategy is officially switched to the new effective trading strategy and put into use in subsequent trading decision-making processes, completing an autonomous iteration and upgrade of the strategy.

[0037] For example, by conducting rolling backtests on candidate strategies using multiple historical market data, when indicators such as risk-reward ratio and maximum drawdown meet preset requirements, the candidate strategy is officially upgraded to an effective strategy for subsequent trading decisions.

[0038] This embodiment constructs a complete closed-loop feedback mechanism encompassing market perception, decision-making reasoning, trade execution, reflection and accumulation, knowledge summarization, strategy evolution, and verification and upgrading. This enables trading strategies to continuously and autonomously iterate and optimize based on feedback information from the entire trading process. It can dynamically adapt to the ever-changing financial market environment without relying on manual offline adjustments, effectively improving the long-term effectiveness and environmental adaptability of trading strategies.

[0039] Furthermore, in some embodiments, step S1, "collecting market data and generating a current market state representation based on the market data," includes: S11. Collect market data from multiple data sources; Specifically, by adapting to different data interfaces, the system acquires raw market data of different dimensions from multiple independent data sources. Each data source corresponds to different types of market information, covering multiple categories such as numerical transaction data and non-numerical information data. The data update frequency and data format of each data source may differ. The system adopts corresponding collection strategies based on the characteristics of each data source to achieve real-time or near real-time acquisition of multi-dimensional market information, providing comprehensive data source support for the subsequent construction of market status.

[0040] S12. Align the collected market data in time and space according to the timestamps; Specifically, for the collected multi-source heterogeneous market data, the system marks each data point with its corresponding event timestamp. Using a unified timeline as a benchmark, the system matches and aligns market data from different sources, with different sampling frequencies and different arrival delays in the time dimension, so that various types of market data at the same time point correspond one-to-one, eliminating time deviations between different data sources and ensuring the consistency and accuracy of the subsequently generated market status in the time dimension.

[0041] S13. Encapsulate the aligned market data into a unified market state representation, which includes at least market information, technical indicator information, and textual information; wherein, the textual information is generated by: inputting the collected raw text data into a language model to generate text summaries and / or sentiment analysis results, and using the text summaries and / or sentiment analysis results as components of the textual information; Specifically, various market data that have achieved spatiotemporal alignment are encapsulated and processed according to a pre-defined unified data structure to form a standardized market state representation. In this market state representation, market information and technical indicators are stored as numerical fields. For raw text data, it is input into a language model for semantic processing. The language model extracts the core information of the raw text to generate a text summary, and / or analyzes the market sentiment carried by the text to generate sentiment analysis results. The structured text results obtained through the language model are used as components of the text information, together with market information and technical indicators, to constitute a complete market state representation.

[0042] This embodiment collects market information from multiple data sources, covering multiple dimensions. It eliminates the time deviation of multi-source data through timestamp spatiotemporal alignment, and then combines the structured processing of text information with a language model to finally generate a unified format of market status representation. This not only achieves the standardized integration of heterogeneous market data, but also fully explores the semantic value of text-based market information, providing a unified, comprehensive and time-consistent market fact benchmark for subsequent stages.

[0043] Furthermore, in some embodiments, step S2, "to perform inference analysis on the current market state representation based on the currently effective trading strategy, generate an inference chain, and output a trading decision based on the inference chain," includes: S21. At the current moment, conduct market analysis based on the current market state characteristics and generate market analysis results; Specifically, at the current decision-making moment, the system invokes the generated current market state representation. Based on the market data, technical indicators, and textual information contained within, a systematic analysis is conducted focusing on dimensions such as the bullish / bearish trend of the target asset, its relative strength, potential driving factors, and risk factors. This analysis identifies the core operational characteristics and key signals of the current market, forming a structured market analysis result. This market analysis result objectively presents the core judgment of the current market state, providing a market-level basis for subsequent strategy matching and decision-making.

[0044] S22. Obtain current holdings information, perform holdings analysis based on the current holdings information, and generate holdings analysis results; Specifically, the system retrieves the real-time holdings information of the current account. This information includes at least the stock codes, quantity held, average holding cost, floating profit / loss ratio, and the percentage of each stock's position relative to the total account funds. Based on this information, the system analyzes the holdings from the perspectives of position concentration, unidirectional risk exposure, and the suitability of the holding structure to the current market style. This assesses the risk level and suitability of the current holdings, generating a structured holdings analysis result that provides a basis for subsequent strategy principle matching and verification.

[0045] S23. Obtain the strategy principles in the currently effective trading strategy, compare and evaluate the market analysis results and position analysis results with the strategy principles respectively, and determine whether the current state conforms to each strategy principle; Specifically, the system loads all the strategy principles contained in the currently effective trading strategy. These strategy principles are predefined and clearly identifiable trading rules, covering different categories such as entry conditions, position limits, and exit conditions. The system then matches the aforementioned market analysis results and position analysis results against the corresponding strategy principles one by one, determining whether the current market and position status meet the requirements of each strategy principle, and simultaneously records the judgment result and matching basis for each principle.

[0046] S24. The process of comparing and evaluating the market analysis results and position analysis results with the strategy principles generates an inference chain, and outputs standardized trading decisions based on the inference chain; among them, a deterministic decoding method is used to output standardized trading decisions, and the generated trading decisions are subjected to deterministic verification; if the verification passes, the trading decision is output to the execution stage; if the verification fails, re-inference is triggered. Specifically, the entire logical process of market analysis, position analysis, and evaluation against each strategy principle is linked and recorded in sequence according to the decision-making derivation, forming a complete reasoning chain. This chain fully presents the entire logical path from market input to final judgment, enabling the decision-making process to be traceable and reviewable. Based on the final conclusion of the reasoning chain, the system uses a deterministic decoding method to output a standardized trading decision. This trading decision includes clear core information such as trading direction, target, and quantity. Before output, the system performs a deterministic verification of the trading decision, checking whether the decision content conforms to the strategy rule boundaries, numerical range, and format specifications. If the verification passes, the trading decision is output to the subsequent execution stage; if the verification fails, a re-reasoning process is triggered, and analysis and decision derivation are carried out again.

[0047] This embodiment conducts market and position analysis in layers, evaluates each trading strategy principle against the analysis, and generates a complete and traceable reasoning chain simultaneously. It is supplemented by deterministic decoding and verification mechanisms, which not only ensures the logical clarity and reproducibility of trading decisions, but also improves the stability and compliance of decision outputs.

[0048] Furthermore, in some embodiments, step S3, "execute the transaction operation according to the transaction decision and record the transaction trajectory data generated during the transaction execution process," includes: S31. Transform trading decisions into standardized trading instructions; Specifically, after receiving the transaction decision from the upstream, the system parses and converts the core information contained in the decision, such as the transaction direction, target object, and transaction quantity, to generate standardized transaction instructions that conform to the data specifications of the execution stage. These standardized transaction instructions employ a unified data structure and field definitions, and at least include mandatory information such as target identifier, transaction direction, order quantity, and decision timestamp. This eliminates format differences between different decision outputs, ensuring that subsequent execution stages can uniformly identify and process the data, and guaranteeing the consistency and standardization of transaction execution.

[0049] S32. Perform simulated trading according to the trading instructions, and calculate the simulated transaction price and transaction costs, including: calculating slippage based on market liquidity and volatility at the time of execution of the trading instructions, and calculating trading commissions and taxes based on preset rates, and determining the simulated transaction price and transaction costs based on slippage, commissions and taxes; Specifically, the system executes trading operations in a simulated trading environment based on standardized trading instructions. During execution, it first acquires market data at the moment of instruction execution and calculates slippage by combining this data with current market liquidity and price volatility. Slippage reflects the impact cost of placing an order on the market price and the execution cost resulting from the bid-ask spread, making the simulated transaction price closer to the trading level of the real market. Simultaneously, based on preset trading commission rates and securities transaction tax rates, and combined with the transaction amount, it calculates the corresponding trading commissions and related taxes. Finally, by combining the slippage-adjusted transaction price with all transaction costs, it determines the final simulated transaction price and the total transaction cost for a single transaction.

[0050] S33. Update position information and account information based on the results of the simulated trading execution; Specifically, after the simulated trades are completed, the system synchronously updates the account's position and account balance information based on the transaction results. The position updates include changes in the quantity of corresponding assets held, recalculation of the average holding cost, and real-time calculation of profit and loss. Account updates include deductions or increases in available funds and recalculation of total account equity. By synchronously updating position and account data, the system ensures the consistency and accuracy of the account status before and after the trades, providing accurate information on the account status for subsequent trading decisions.

[0051] S34. Record the timing data of the transaction execution process and generate transaction trajectory data; Specifically, the system records all relevant data for each node in the entire transaction execution process in chronological order, including instruction generation time, execution time, simulated transaction price, details of various transaction costs, pre- and post-transaction position snapshots, and account equity change data, forming a complete transaction trajectory data. This transaction trajectory data connects all key nodes of transaction execution along the time dimension, fully reconstructing the entire execution process of a single transaction and providing comprehensive data support at the execution level for subsequent reflection and analysis.

[0052] This embodiment ensures the standardization and consistency of execution by converting trading decisions into standardized trading instructions; it enhances the realism of simulated trading execution by combining market liquidity and volatility to calculate slippage and account for commissions and taxes, making trading costs and transaction prices more closely resemble the real market environment; it ensures the accuracy of account status by synchronously updating positions and account information; and it generates a complete trading trajectory by recording the entire process in time, providing a traceable execution data foundation for subsequent trading review and analysis.

[0053] Furthermore, in some embodiments, step S4, "reflective analysis of transaction trajectory data and inference chain, identification of patterns in the transaction process, and generation of structured reflective records," includes: S41. Extract the transaction trajectory data generated within a preset period and the inference chain corresponding to the transaction trajectory data; Specifically, the system triggers a data extraction operation at the end of a pre-set reflection cycle. It retrieves all transaction trajectory data generated within that cycle from the storage medium, and simultaneously retrieves the inference chain data corresponding to each transaction trajectory. This ensures a complete correspondence between the decision-making logic process and the actual execution result of each transaction, providing a comprehensive data foundation for subsequent integrated reflection and analysis, encompassing both decision-making and execution dimensions. The pre-set cycle can be configured as a single trading day, a single trading week, or other fixed-duration cycles to adapt to different reflection frequency requirements.

[0054] S42. Input the transaction trajectory data, inference chain, and market state representation within the same preset period into the language model; Specifically, the system integrates the extracted transaction trajectory data, corresponding inference chains, and market state representations corresponding to each decision point within the same preset period, and then inputs them into the language model according to a unified input format. These three types of data together constitute a complete transaction context: market state representations reflect the objective market environment at the time of the decision, the inference chain reflects the logical derivation process of the decision, and the transaction trajectory data presents the actual results after the decision is executed, providing comprehensive contextual information support for the language model's analysis.

[0055] S43. Identify error patterns and / or opportunity patterns in the trading process using language models; Specifically, the language model analyzes the rationality of trading decisions, the expected matching degree of execution results, and the effectiveness of market environment response based on the complete input trading context data. It identifies representative characteristic behaviors and outcome patterns in the trading process, specifically including two categories: error patterns and opportunity patterns. Error patterns correspond to typical situations in the trading process that lead to reduced profits or increased risks, while opportunity patterns correspond to potential situations in the trading process that can improve profits or optimize risks. Depending on the analysis scenario, only one type of pattern may be identified, or both types may be identified simultaneously.

[0056] S44. The identified patterns are structured into structured reflection records. The structured reflection records shall include at least the pattern type, the time interval in which the pattern occurred, and suggestions for improvement. Specifically, the system organizes and encapsulates the various patterns identified by the language model according to a preset fixed data structure, generating standardized structured reflection records. Each structured reflection record contains at least a pattern type field, an occurrence time interval field, and an improvement direction suggestion field. The pattern type is used to distinguish between error patterns and opportunity patterns, the occurrence time interval is used to mark the trading period corresponding to the pattern, and the improvement direction suggestion is used to provide optimization directions for the corresponding pattern. Through structured processing, scattered analysis conclusions are transformed into standardized experience fragments that can be uniformly stored and processed in batches.

[0057] This embodiment extracts transaction trajectories and corresponding inference chains, combines them with the representation of the market state at the same time, and uses a language model to automatically identify error patterns and opportunity patterns in transactions. Finally, it generates standardized structured reflection records, realizing the automation and structuring of post-trade review analysis, and improving the comprehensiveness and depth of transaction reflection.

[0058] Furthermore, in some embodiments, step S4, "reflective analysis of transaction trajectory data and inference chain, identification of patterns in the transaction process, and generation of structured reflective records," further includes: S45. Decompose the net profit results within the trading period into the contribution value of market environment factors and the contribution value of strategy decision factors; Specifically, the system uses a two-factor attribution method to decompose the net profit generated within a preset trading period, breaking down the total net profit into two independent components: the contribution value of market environment factors and the contribution value of strategy decision factors. The market environment factor contribution value measures the profit changes caused by external market factors such as overall market fluctuations, market style shifts, and systemic risk events. This part of the profit change is unrelated to the subjective decision-making logic of the trading strategy and only reflects the passive impact of the market's own trend on account returns. The strategy decision factor contribution value measures the excess returns or losses brought about by active decision-making behaviors such as timing judgment, target selection, position control, and stop-loss execution. This part of the profit change directly reflects the decision-making effectiveness and optimization potential of the trading strategy itself. Through this decomposition, the passive market influence and the active role of the strategy in the trading results can be effectively distinguished, avoiding the bias caused by judging the quality of the strategy solely based on the final profit or loss.

[0059] And / or, S46. For the actual action at the historical decision moment, simulate and generate the counterfactual market continuation trajectory when taking the alternative action at the historical decision moment; calculate the expected payoff of the alternative action based on the counterfactual market continuation trajectory; calculate the counterfactual regret value of the actual action relative to the optimal alternative action based on the expected payoff; Specifically, firstly, the system simulates and generates counterfactual market continuation trajectories corresponding to alternative actions. The system identifies the actual trading actions executed at historical decision moments and enumerates all feasible alternative trading actions at that moment. For example, if the actual action was to add to a position, alternative actions could include maintaining the position, reducing the position, or liquidating the position. For each alternative action, based solely on existing market data and state patterns prior to the decision moment, the system simulates and generates the subsequent development trajectory of the market and the account if the alternative action were executed at that moment, forming a counterfactual market continuation trajectory. The simulation process strictly limits the use of future information after the decision moment to ensure the objectivity and rationality of the counterfactual analysis.

[0060] Then, the expected return of each alternative action is calculated. For each counterfactual market continuation trajectory, the transaction price calculation rules, transaction cost calculation standards, and position update logic consistent with actual transactions are used to calculate the net return that the alternative action can realize in the corresponding subsequent period. By combining the return results of multiple sets of simulated trajectories, the expected return value of the corresponding alternative action is obtained, reflecting the expected return level of executing the alternative action at this decision point.

[0061] Finally, the counterfactual regret value is calculated. The expected payoffs of all feasible alternative actions at the decision point are compared horizontally, and the maximum value is selected as the expected payoff of the optimal alternative action. The difference between the expected payoff of the optimal alternative action and the actual payoff of the actual action is calculated to obtain the counterfactual regret value of the decision. This regret value quantifies the difference in payoff between the actual decision and the theoretically optimal choice; the larger the regret value, the greater the optimization space for the decision.

[0062] This embodiment achieves accurate attribution of trading profits and losses through a two-factor attribution decomposition of net trading returns, effectively distinguishing the respective impacts of market environment fluctuations and strategic decision-making ability on trading results. Through counterfactual trajectory simulation and regret value quantification, it further measures the profit gap between actual decisions and the optimal alternative. Both methods deepen the depth and refinement of reflective analysis from a quantitative perspective, providing more accurate quantitative basis for subsequent experience accumulation and strategy optimization.

[0063] Furthermore, in some embodiments, step S6, "when the context memory bank meets the preset induction conditions, summarizing multiple structured reflection records in the context memory bank, generating knowledge entries, and storing the knowledge entries in the semantic memory bank," includes: S61. Determine whether the number of reflection records in the contextual memory bank has reached the preset update threshold; Specifically, the system continuously counts the number of structured reflection records stored in the context memory bank, comparing the current accumulated number of records with a pre-configured update threshold in real time. The preset update threshold is a value pre-set based on the frequency of knowledge updates and the sample size requirements for inductive processing. Its purpose is to control the timing of induction initiation, ensuring that a sufficient number of experience samples have been accumulated before induction begins, avoiding the high randomness and insufficient universality of induction results due to insufficient sample size. When the number of records has not reached the threshold, the system continues to receive and store new structured reflection records without triggering the induction process.

[0064] S62. When the preset update threshold is reached, input all reflection records within the preset time window in the context memory bank into the language model; Specifically, once the number of reflection records in the context memory bank reaches a preset update threshold, the system extracts all structured reflection records within that time window from the context memory bank. The system then integrates the pattern information, scenario information, and analysis conclusions contained in each record according to a unified format and inputs them in batches into the language model, providing complete and continuous batch experience samples for inductive analysis. The preset time window matches the update threshold, covering the transaction periods corresponding to all records to be summarized, ensuring the temporal continuity and content integrity of the input samples.

[0065] S63. Summarize and extract recurring and statistically significant patterns from multiple reflection records using language models; Specifically, after receiving a batch of structured reflection records, the language model conducts cross-sample aggregation analysis and abstract induction. It performs frequency statistics and commonality extraction on various transaction patterns across multiple records, eliminating occasional factors and individual differences in single transactions, and selecting common transaction patterns and rules that repeatedly appear in multiple samples, meet statistical requirements, and possess universal representativeness. The extracted patterns are no longer limited to the specific circumstances of a single transaction but reflect common transaction patterns in similar market scenarios, possessing cross-scenario reference value.

[0066] S64. Output the inductive results as structured knowledge entries; Specifically, the system organizes and encapsulates the common patterns and rules extracted from the language model according to a preset knowledge item data structure, generating standardized structured knowledge items. These knowledge items adopt a unified field structure, including at least core content such as pattern category, applicable market scenario, and core rule description. They possess a standardized storage format and searchable attributes, enabling direct storage in the knowledge base for long-term storage and subsequent retrieval, thus realizing the transformation from scattered experience to systematic knowledge.

[0067] This embodiment controls the timing of induction by setting an update threshold to ensure a sufficient number of induction samples; it uses a language model to aggregate and summarize batch reflection records, eliminating the accidental factors of individual transactions and extracting statistically significant common patterns; finally, it outputs structured knowledge items, realizing the upgrade and transformation from scattered individual transaction reflection experiences to systematic and reusable trading knowledge, providing callable knowledge support for the iterative optimization of trading strategies.

[0068] Furthermore, in some embodiments, after step S64 "outputting the induction results as structured knowledge entries", the method further includes: S65. When there are semantically opposite knowledge entries in the semantic memory, compare their confidence levels; Specifically, during the knowledge entry process or periodic database verification, semantic matching detection is performed on the knowledge entries in the semantic memory to identify pairs of knowledge entries with contradictory core conclusions and opposite semantics. For each of the two identified semantically contradictory knowledge entries, their respective confidence scores are extracted. The confidence score is an indicator used to quantify the reliability and statistical support of a knowledge entry, and its value is positively correlated with the effective sample size supporting the knowledge entry and the frequency of pattern repetition. The difference between the confidence scores of the two knowledge entries is calculated, and this difference is used as the basis for subsequent differential processing.

[0069] S66. If the confidence difference is less than the preset confidence threshold, then retain two knowledge entries respectively, and bind each knowledge entry to its own applicable market state context. Specifically, when the confidence difference between two semantically contradictory knowledge entries is less than a pre-set confidence threshold, it indicates that both knowledge entries have corresponding statistical support, and neither has an absolute confidence advantage. In this case, the system does not delete either knowledge entry but retains both. Simultaneously, the system matches and binds each knowledge entry to its corresponding applicable market state context. This market state context includes limiting conditions such as corresponding market environment characteristics, volatility range, market cycle, and industry scenario, clarifying the applicable boundaries of each knowledge entry. This ensures that both can function normally in their respective scenarios, avoiding knowledge failure due to semantic conflicts.

[0070] S67. If the confidence difference is greater than or equal to the preset confidence threshold, the knowledge item with lower confidence is marked as suppressed, and the marked knowledge item is restricted from participating in subsequent searches. Specifically, when the confidence difference between two semantically opposite knowledge items is greater than or equal to a pre-set confidence threshold, it indicates that one knowledge item has a significant confidence advantage, while the other has insufficient statistical support and low reliability. In this case, the system marks the knowledge item with the lower confidence as suppressed. During subsequent routine knowledge retrieval, this suppressed item is restricted from participating in retrieval matching, preventing it from being retrieved for strategy evolution and reducing the interference of low-reliability conflicting knowledge on strategy optimization. Simultaneously, the complete data record of this item is retained, allowing for re-evaluation of its effectiveness after subsequent sample replenishment.

[0071] This embodiment compares and classifies semantically contradictory knowledge items with confidence metrics. When the confidence difference is small, it achieves scenario-compatible retention of conflicting knowledge by binding it to the applicable market state context. When the confidence difference is significant, it suppresses low-confidence items, avoiding the loss of effective experience information caused by simply discarding conflicting knowledge. This effectively reduces the interference of low-reliability conflicting knowledge on strategy optimization and improves the knowledge accuracy and scenario adaptability of the semantic memory.

[0072] Furthermore, in some embodiments, step S7, "retrieving knowledge entries from the semantic memory base, evolving the currently effective trading strategy based on the retrieved knowledge entries, and generating candidate trading strategies," includes: S71. Calculate the relevance score of each knowledge item in the semantic memory bank, and extract the knowledge items with the highest relevance scores; Specifically, when the trading strategy evolution process is initiated, the system uses current market environment characteristics, the optimization direction of the current trading strategy, and the market phase of the target asset as matching dimensions to calculate the relevance score of each knowledge item in the semantic memory bank to the current evolution requirements. The relevance score quantifies the degree of matching between the knowledge item and the current optimization scenario; a higher score indicates stronger reference value for the knowledge item in this strategy optimization. Based on the scoring results, the system sorts all knowledge items in descending order and extracts the top-ranked knowledge items as the core knowledge basis for this strategy evolution, ensuring that the experiential knowledge used for strategy optimization has a high degree of scenario relevance and application adaptability.

[0073] S72. Input the currently effective trading strategy and the extracted knowledge items into the language model, and generate a strategy improvement plan through the language model. The strategy improvement plan includes at least one of the following operations: adding, deleting, strengthening or modifying the original strategy principles. Specifically, the system takes the complete text of the currently effective trading strategy, along with several knowledge entries extracted earlier, and inputs them into the language model according to a preset structured prompt format. The language model performs strategy optimization, combining the common trading patterns and empirical conclusions accumulated in the knowledge entries to conduct a line-by-line adaptation evaluation and analysis of each principle of the currently effective trading strategy, generating targeted strategy improvement plans. These improvement plans achieve targeted adjustments to the original strategy through four types of operations: addition (supplementing missing trading principles and risk control rules); deletion (removing strategy principles that have been proven ineffective or no longer suitable for the current market scenario); strengthening (tightening the judgment conditions of the original strategy principles, increasing the execution standards and rigor of the strategy); and modification (adjusting the internal logic or parameter values ​​of the original strategy principles). Depending on the actual needs of the optimization scenario, the improvement plan may include one or more combinations of these four types of operations.

[0074] S73. Generate complete candidate trading strategies based on the strategy improvement plan; Specifically, based on the strategy improvement plan output by the language model, the system applies the corresponding addition, deletion, enhancement, and modification operations to the currently effective trading strategy, adjusting and integrating the principles of the original strategy accordingly. This results in a complete, logically consistent candidate trading strategy that can be directly used for subsequent verification. The candidate trading strategy retains the overall framework and format of the original strategy, adjusting only the clauses related to the improvement plan to ensure the overall integrity and executability of the strategy, serving as a formal alternative version for strategy upgrades.

[0075] This embodiment uses relevance scoring to screen knowledge items that highly match the current evolutionary needs, ensuring the accuracy of the knowledge basis for strategy optimization; it combines accumulated experience knowledge with language models to generate strategy improvement schemes containing multiple adjustment methods, realizing the targeted mapping of experience knowledge to strategy optimization; finally, it integrates and generates complete and executable candidate trading strategies, providing verifiable alternatives for strategy iteration, effectively improving the pertinence and implementability of trading strategy evolution.

[0076] Furthermore, in some embodiments, after step S73 "generating a complete candidate trading strategy based on the strategy improvement scheme", the method further includes: S74. Calculate the sensitivity of each key parameter in the candidate trading strategy to the performance evaluation indicators; Specifically, the system first extracts key parameters that significantly impact trading behavior and performance results from candidate trading strategies, such as entry signal thresholds, stop-loss ratios, single-stock position limits, and total position limits. For each key parameter, based on its current value, minor adjustments are made within a reasonable range. The performance evaluation index values ​​for the candidate strategies before and after the parameter changes are calculated, thus determining the sensitivity of the parameter relative to the performance evaluation index. This sensitivity quantifies the magnitude of performance index changes caused by unit changes in the parameter; higher sensitivity indicates a greater impact of parameter changes on the overall strategy performance. Performance evaluation indicators can be selected from one or more of the following, depending on the application scenario: Sharpe ratio, annualized return, maximum drawdown, and risk-reward ratio.

[0077] S75. Mark key parameters whose sensitivity exceeds a preset sensitivity threshold as high-sensitivity parameters; Specifically, the system pre-sets a sensitivity threshold, which is used to define whether the impact of a parameter on performance falls within a high-risk range. The system compares the calculated sensitivity values ​​for each key parameter with the preset sensitivity threshold. When the sensitivity of a key parameter exceeds the preset threshold, it indicates that even small fluctuations in that parameter may trigger significant changes in strategy performance, indicating low robustness of the parameter value. The system then marks this parameter as a high-sensitivity parameter and focuses on it.

[0078] S76. Adjust the verification conditions based on highly sensitive parameters, or reject candidate trading strategies from entering the verification stage; Specifically, for the marked highly sensitive parameters, the system performs two types of differentiated processing based on the sensitivity of the parameter and the overall strategy. The first type is to adjust the verification conditions, such as expanding the historical data time range for verification, increasing the verification samples for different market conditions, tightening the qualification threshold of performance indicators, and adding robustness test items for the highly sensitive parameter. Through more rigorous and comprehensive verification, the stability of the highly sensitive parameter under different environments is fully tested. The second type is to directly reject the candidate trading strategy from entering the subsequent verification stage if the sensitivity of the highly sensitive parameter is too high, the strategy performance relies excessively on the precise value of a single parameter, and the overall robustness of the strategy is extremely poor. This avoids the strategy obtained after investing verification resources having no practical application value.

[0079] This embodiment performs sensitivity quantification calculations on the key parameters of candidate trading strategies, identifies highly sensitive parameters, and adopts differentiated verification and control measures. By adjusting the verification conditions, it can strengthen the stability test of highly sensitive parameters, ensure the robustness of the launched strategy, screen out candidate strategies with excessively high parameter sensitivity and insufficient reliability in advance, reduce ineffective verification investment, and improve the risk controllability and overall efficiency of the strategy evolution process.

[0080] Furthermore, in some embodiments, step S8, "verifying the candidate trading strategy; if the verification passes, upgrading the candidate trading strategy to a new effective trading strategy," includes: S81. Divide the historical data into training window, validation window and test window according to time series; Specifically, the system selects historical market data over a preset time span and divides it into three continuous and non-overlapping data windows in chronological order: the training window, the validation window, and the testing window. Each window performs a different validation function: the training window simulates the historical phase of the strategy's actual operation and outputs baseline performance data; the validation window compares the performance of different strategies horizontally, completing the initial screening and suitability verification of the strategies; and the testing window is independent of the first two windows, does not participate in any strategy parameter adjustment process, and is used to perform the final verification of the generalization ability of candidate strategies to avoid overfitting problems that may occur during the validation process.

[0081] S82. In the same trading execution engine as the execution phase, run the current strategy in the training window, run the current strategy and candidate strategies in the verification window, and run the candidate strategies in the test window to obtain the performance indicators of each strategy in each window. Specifically, the system uses a trading execution engine that is completely consistent with the actual trading execution process to conduct backtesting calculations. The execution engine's transaction price calculation logic, transaction cost accounting rules, and position and account update mechanisms are all consistent with the live trading execution rules, eliminating the deviation in verification results caused by differences in execution logic and ensuring the consistency and reproducibility of backtesting performance with live trading results.

[0082] The backtesting process is executed step-by-step in windows. In the training window, the currently active trading strategy is run to obtain its benchmark performance data during the training phase. In the validation window, both the currently active strategy and candidate trading strategies are run to obtain their performance data for horizontal comparison. In the test window, only the candidate trading strategies are run to obtain their final performance data on independent samples that were not optimized. After each window is completed, multiple performance indicators for the corresponding strategy within that window are output, covering multiple dimensions such as return level, risk control, and risk-reward ratio.

[0083] S83. Determine whether the candidate strategy passes the verification based on the performance indicators on the test window. When the candidate strategy meets the preset threshold value on each performance indicator and the core indicator is not lower than the current strategy, the candidate strategy is determined to pass the verification. Specifically, the system uses the performance indicators under the test window as the final verification basis and adopts a dual verification standard for judgment. First, all performance indicators of the candidate strategy must meet the pre-set qualification threshold value to ensure that the strategy's performance meets the basic operational requirements. Second, the core performance indicators of the candidate strategy must not be lower than the corresponding indicators of the currently effective strategy to ensure that the core performance will not degrade after the strategy is upgraded. When both conditions are met, the candidate strategy is judged to have passed the verification; if either condition is not met, the verification is judged to have failed.

[0084] S84. Assign a version identifier to the verified candidate trading strategy, store the candidate trading strategy, its verification data, upgrade timestamp, and parent version information into the strategy repository, and switch the pointer of the currently effective trading strategy to the candidate trading strategy; Specifically, for each validated candidate trading strategy, the system assigns a unique version identifier to distinguish strategy versions at different iteration stages. Then, the complete rule content of the candidate trading strategy, its corresponding full-window validation performance data, strategy upgrade timestamp, and its parent version information (i.e., the effective strategy version before this upgrade) are packaged and persistently stored in the strategy repository, fully preserving the strategy's version iteration trajectory. After storage, the system switches the call pointer of the currently effective trading strategy to the new candidate trading strategy, completing the formal strategy upgrade. Subsequent trading decisions will be executed based on the new version strategy.

[0085] S85. Monitor the performance and risk indicators of the newly effective trading strategy during its online operation. When a preset rollback trigger condition is detected, roll back the trading strategy pointer to the previous version. The rollback trigger conditions include hard threshold trigger conditions and composite risk score trigger conditions. When the real-time risk indicator meets any hard threshold trigger condition, the rollback operation is executed immediately. When the composite risk score reaches the preset risk threshold in multiple consecutive monitoring periods, the rollback operation is executed. Specifically, after a new strategy is launched, the system continuously monitors its performance and risk indicators in real time and pre-sets two types of rollback trigger mechanisms. The first is a hard threshold trigger condition, which sets insurmountable risk red lines for key risk indicators. When any real-time risk indicator reaches any hard threshold, a strategy rollback operation is immediately executed, switching the trading strategy pointer back to the previous stable version, achieving rapid risk management. The second is a composite risk score trigger condition, which calculates a comprehensive composite risk score through weighted calculation of multi-dimensional risk indicators. When the composite risk score reaches a preset risk threshold for multiple consecutive monitoring periods, the strategy is deemed to have experienced persistent operational abnormalities, and a rollback operation is executed. This mechanism avoids erroneous rollbacks caused by single market fluctuations, improving the stability and accuracy of rollback judgments.

[0086] This embodiment employs a layered backtesting verification architecture with a three-window time-series division, combined with a trading engine originating from the same source as the execution phase, to fully ensure the authenticity and reproducibility of the verification results. It strictly controls the qualification threshold and performance requirements for strategy upgrades through dual-dimensional verification standards, preventing strategy degradation. Through versioned storage and pointer switching mechanisms, it achieves smooth strategy upgrades and complete version traceability. Finally, through a dual-mechanism rollback strategy combining immediate response to hard thresholds and continuous judgment using composite scores, it balances the timeliness of risk handling with the accuracy of anomaly detection.

[0087] To facilitate understanding of the self-evolution method for trading strategies based on closed-loop feedback provided in this embodiment, a specific scenario will be used as an example to further illustrate the method. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0088] In a specific embodiment, the self-evolution method for trading strategies based on closed-loop feedback provided in this embodiment can be applied to, for example... Figure 3 The following is an example of a self-evolving trading strategy system based on closed-loop feedback. The system consists of eight functional layers: data layer, decision layer, execution layer, reflection layer, memory layer, strategy evolution layer, experimental verification layer, and strategy management layer.

[0089] I. Data Layer: As the market fact foundation of the entire intelligent agent, the data layer is only responsible for constructing an objective and unified representation of the market state and does not participate in any transaction decision-making logic.

[0090] In practice, the data layer obtains the following five types of raw data from multiple heterogeneous data sources in real time or near real time through data adapters: Stock market data: opening price, highest price, lowest price, closing price, and trading volume in daily candlestick charts; Technical indicators: Moving averages, relative strength index, Bollinger Bands, MACD, and other indicators calculated from market data; Company news data: Announcements and information related to the target company, retrieved through news APIs or web crawlers; Macroeconomic data: Officially released data such as interest rates, money supply, and purchasing managers' index; Large-scale news analysis results: The original news text is fed into a large language model, which automatically generates a summary of the news and market sentiment tags.

[0091] The data layer performs spatiotemporal alignment and standardization encapsulation on all collected heterogeneous data to form a unified data structure, namely a market snapshot. A market snapshot is a multi-dimensional vectorized record that contains at least the following fields: Basic stock information: stock code, name, and sector. Candlestick data: Opening price, highest price, lowest price, closing price, and trading volume within the current time window; Technical indicators: These should include at least RSI, MACD, and moving average alignment values. News Summary: Key points extracted from a large language model; Market sentiment: Quantitative sentiment values ​​derived from large language models, such as continuous values ​​in the range [-1,1]. Macroeconomic Environment Description: A structured textual description of current interest rates, economic cycles, and major policy events.

[0092] Each trading day, the data layer continuously generates new market snapshots and pushes them to the decision-making layer and storage module for subsequent backtesting.

[0093] Furthermore, numerical market data and text-based news are aligned using event timestamps and concatenated at the feature level. Let the market snapshot time be... The standardized market data and technical indicator vectors are: ; for time window Inner The news article uses FinBERT to extract the original semantic embedding at the [CLS] position. And according to the time of the news occurrence Perform exponential decay aggregation.

[0094] For valid news items, a normalized exponentially decaying weight is applied, and a weighted semantic vector is calculated: in, In one embodiment, , ;when When using a zero semantic vector with an appended news missing flag, use an all-zero semantic vector.

[0095] The aggregated text vectors are then dimensionality-reduced using a linear projection layer: The projection matrix is ​​initialized uniformly using Xavier: Numerical features are transformed to the same dimension using independent mapping layers and then concatenated with text features: The aforementioned 32-dimensional, 64-dimensional, and 128-dimensional configurations are implementable configurations that can be adjusted based on the actual data fields and inference resources.

[0096] Streaming processing employs an "event time watermark and dual priority queue" scheduling approach. Market data events and news events are respectively entered into bounded, lock-free queues. and And build a min-heap based on event time. For the data source... Record the maximum observed event time as Allow out-of-order boundaries The combined water level line is: The system only merges events with timestamps no greater than [amount missing]. The data. In one embodiment, If a data source fails to generate an event within the configurable idle timeout period, the source is marked as idle to prevent the combined water level from permanently stagnating. The scheduler processes market data and news queues in a 4:1 weighted round-robin fashion, and prioritizes events with an earlier deadline for events with a waiting time exceeding 200 ms. When the market data queue reaches its limit, it only merges unprocessed quotes for the same target and retains the latest value, without discarding trade reports, risk alerts, and news events.

[0097] Second, the decision-making layer is the core of the system's reasoning. It uses a large language model and a fixed structured reasoning paradigm to transform market snapshots and current trading strategies into trading decisions with a complete reasoning chain.

[0098] The reasoning mechanism in this layer is implemented using multi-step collaborative hinting engineering. The processing steps are as follows: Step 1: Market Analysis. The decision-makers organize all fields of the current market snapshot into text prompts according to a preset template and input them into the large language model. The prompts explicitly require the model to analyze the current market's bullish / bearish environment, the relative strength of individual stocks, and potential risk factors, and output the analysis results in natural language.

[0099] Step 2: Portfolio Analysis. The system provides the large language model with current holdings information. The holdings information structure includes: holding assets, quantity held, average cost, floating profit / loss ratio, and the position percentage of each asset. The system prompts the model to summarize the current position concentration risk, degree of one-sided exposure, and the degree of matching between the holdings and the current market style.

[0100] Step 3: Strategy Principle Check. The decision-making level loads the currently effective strategy version, such as Trading Policy V1. The strategy consists of a series of explicit trading principles that can be expressed in text form, such as: "When RSI is below 30 and market sentiment is greater than 0.2, buying is allowed"; "The maximum holding of a single stock is 20% of the total capital"; "Immediate stop loss and exit when floating loss exceeds 5%", etc. The decision-making level inputs these strategy principles, the market analysis from Step 1, and the combined analysis from Step 2 into the large language model, requiring the model to determine whether the current situation meets each entry principle, holding principle, and exit principle, and provide the "yes / no" judgment criteria.

[0101] Step 4: Decision Synthesis and Inference Chain Generation. Based on the above analysis, the large language model is required to output the final standardized trading decision, with the decision action set limited to: {buy, sell, hold}. For "buy", the specific target code and the quantity to be bought must be included; for "sell", the holding target and the quantity to be sold must be specified. At the same time, the model must output a complete inference chain, which is a structured text that records each logical deduction step from market perception to the final decision in sequence. For example: "Observing that RSI(14)=28, the oversold condition is met; the market sentiment value is 0.3, and the sentiment is positive; it meets the entry condition in strategy principle 1; therefore, it is decided to buy stock X." This chain of reasoning is a key input for subsequent reflection and knowledge accumulation.

[0102] Furthermore, the decision-making layer implements semantic caching to reduce the overhead of repetitive large model inference. The current market snapshot, position summary, risk status, and strategy version are encoded into query vectors. , will cache library The same-dimensional query key for the item is denoted as The cosine similarity is: Only when the strategy version is consistent, the holdings and risk levels are within the same discrete range, and the cache has not expired, and Only then can the corresponding decision results be reused.

[0103] The dynamic hit threshold is adaptively adjusted based on market volatility. in, To achieve volatility for the current window, The threshold is the median volatility over the past 60 trading days. The threshold increases as volatility rises to reduce erroneous reuse in rapidly changing markets. In one embodiment, the cache is valid for 300 seconds; strategy upgrades, out-of-position changes, or major risk events immediately invalidate the relevant cache.

[0104] To improve decision reproducibility, structured transaction actions employ deterministic decoding: Temperature = 0, top-k = 1, and within the set of tokens allowed by the constrained JSON syntax tree. Internal execution of greedy choice: Candidate tokens with equal probability are selected based on a fixed token number, while the model version, prompt word version, and random seed are also fixed. For inference services that do not support Temperature = 0, a near-deterministic configuration of Temperature = 0.01 and top-p = 0.05 can be used. Since underlying parallel computing may still introduce minor non-determinism, the system uses deterministic verification of the action set, quantity boundaries, and risk rules as the final execution threshold; outputs that fail verification are not allowed to enter the execution layer and trigger re-inference.

[0105] III. Execution Layer: The execution layer employs a transaction execution engine completely independent of the large language model and based on deterministic rules, thereby ensuring the reproducibility, verifiability, and consistency of transaction behavior in historical backtesting. After receiving structured instructions from the decision layer, the execution engine's internal processing flow is as follows: 1. Order Generation: Convert "buy / sell" decisions into standard order objects, including the target code, direction, quantity, and decision timestamp.

[0106] 2. Simulated Transaction and Cost Calculation: Calculate the transaction price and transaction cost based on the liquidity, slippage, commission and tax models below, and update the open positions, available funds, open position costs and account equity after the transaction.

[0107] 3. Risk indicator calculation: Real-time recalculation of total account equity, daily profit and loss, cumulative return, and risk exposure of current holdings (such as beta coefficient and maximum drawdown).

[0108] While executing actions, the execution layer packages and records all state changes as "trading trajectory data." A single trading trajectory data entry is a time-series record containing: timestamp, decision instruction, inference chain reference, transaction price, transaction volume, transaction cost, pre- and post-transaction position snapshots, and account equity.

[0109] Furthermore, the execution layer calculates slippage based on the bid-ask spread, volatility, order size, and market liquidity. Let the midpoint be... The bid price and ask price are respectively and The number of commissioned items is The average trading volume over the past 20 trading days was The liquidity coefficient, which indicates better liquidity with a larger value, is defined as follows: The simulated transaction price corresponding to the slippage rate and the buy / sell direction is as follows: In one embodiment, , , , , The above parameters are calibrated according to the trading market and the liquidity of the underlying asset.

[0110] set up Indicates buying, Indicates selling. For traded assets, positions, fees, cash, and equity are updated recursively as follows: In one embodiment, it can be configured , Yuan, The actual fee rate is loaded from the trading market's allocation table. If the trading market has different regulations regarding minimum commissions, stamp duty, or other fees, they will be determined by the same allocation table based on the transaction direction and the type of underlying asset.

[0111] In addition to the existing fields, a liquidity coefficient has been added to the transaction trajectory data. Buy-sell spread Model-predicted slippage rate Actual slippage rate, order completion rate, and data source timestamp are used to differentiate between profit and loss differences caused by strategy errors and execution friction.

[0112] Fourth, the reflection layer is triggered at a preset reflection cycle (e.g., at the end of each trading day or weekly). Its task is to automatically attribute success and failure and mine patterns in historical trading trajectories.

[0113] This layer first extracts all transaction trajectory data generated within the current period and the associated complete inference chain from storage. Then, this data, along with a concurrent market snapshot, is organized into reflective prompts and input into the large language model for targeted analysis. The reflective layer requires the large language model to identify and output two types of patterns: (1) Error modes, including the following subtypes: Violation of strategic principles: The decision-making reasoning chain or the actions taken contradict the strategic principles that were in effect at the time; Reasoning flaws: logical jumps and omission of key opposing information exist in the reasoning chain; Risk assessment error: Failure to identify clustered risks before the emergency; Cognitive biases: such as overconfidence leading to excessive position size, and the anchoring effect causing delayed stop-loss.

[0114] (2) Opportunity model, including the following subtypes: Missed trading opportunity: Market snapshots showed a buy signal from the strategy, but the decision-makers did not execute it; Early exit opportunity: Hold a favorable position, but sell too early before significant profits are made; Opportunity with insufficient position: When there is an opportunity with an excellent risk-reward ratio, the position size does not reach the upper limit specified by the strategy. Opportunities arising from changes in market structure: Discovering that existing strategies and principles are no longer suitable for the current new volatility or correlation structures.

[0115] The results of the reflection are mandated to be recorded as structured reflection logs, each log containing at least: the type of pattern identified, the time frame in which it occurred, a description of the market conditions involved, the causal chain of the error or the logic of the opportunity, and suggestions for improvement.

[0116] Furthermore, the reflective layer employs a two-factor Shapley attribution method to decompose the net profit and loss relative to the benchmark into contributions from the market environment and strategic decisions. Let... Indicating in market path and trading strategies The net profit and loss are calculated by the deterministic execution engine. For a predefined benchmark market path, This could be a holding strategy, a market benchmark strategy, or a previous stable strategy.

[0117] The contributions from the market environment and strategic decision-making are as follows: This decomposition satisfies the efficiency property: The benchmark path and benchmark strategy remain fixed within the same evaluation batch to ensure that the contributions of different trading cycles are comparable.

[0118] For decision-making moments and alternative actions The system generates data through historical similar state replay or conditional state transition models. A counterfactual market trajectory. The net profit at each step (which already includes slippage, commissions, and taxes) is recorded as... The expected discounted profit or loss of the alternative decision is: The first action is forced to be set to Subsequent actions are generated by a fixed evaluation strategy; the initial transaction cost is not deducted again from the net profit. The counterfactual regret value between the actual action and the optimal alternative action is: To avoid future information leakage, the state transition model is trained using only data prior to the decision moment, and the same batch of candidate actions shares a random seed and counterfactual market perturbation.

[0119] Fifth, the memory layer. The memory layer simulates the human memory system, transforming short-term and fragmented reflections into systematic long-term knowledge. It consists of two storage and processing mechanisms: episodic memory and semantic memory.

[0120] 1. Contextual Memory: The contextual memory bank stores all structured reflection records from the most recent N trading periods (e.g., the most recent 60 trading days) in a sliding window format. Each record contains all the fields from the reflection layer, plus the complete environmental context and the final profit or loss result, forming a complete experience fragment.

[0121] 2. Semantic memory: Semantic memory is a dynamically updated long-term knowledge base. When the contextual memory base reaches a preset update threshold (e.g., every 30 new reflection records accumulated), the system initiates the semantic retrieval process. Batch input of all contextual memory records within the window into the large language model; The prompt requires the model to perform multi-document induction, eliminate randomness, and extract recurring, statistically significant patterns. The output is in the form of structured "knowledge entries", which are divided into five categories: success patterns, failure patterns, risk patterns, opportunity patterns, and market rule knowledge.

[0122] For example, a possible failure pattern is: "On the day when macroeconomic policies suddenly tighten, failure to stop losses in time leads to continuous large losses."

[0123] All knowledge entries are persistently stored in the semantic memory database. Each entry has a unique number, summary, and confidence score, and can be sorted by confidence score during subsequent searches.

[0124] Furthermore, when inducing semantic knowledge from episodic memory, the timeliness of the sample, the reliability of the source, and conflicting relationships are jointly weighted. This applies to both supporting and refuting knowledge entries. The Each scene memory is weighted as follows: in, To ensure the reliability of the data source, To reflect on quality ratings, It represents the number of trading days since the current time. The time decay half-life; in one embodiment, One trading day.

[0125] The weighted support, weighted conflict, and effective sample size are as follows: Knowledge confidence is defined as: This formula uses the Beta(1,1) prior to suppress overconfidence in small samples and reduces evidence that is highly repetitive or weighted by using an effective sample size.

[0126] Knowledge items with opposite semantics and Define conflict advantage points: when At that time, instead of directly deleting any entry, each entry is retained and bound to its applicable market state, volatility range, and industry context; when When low-confidence entries are marked as "suppressed," they will only be included in the retrieval process if their contextual conditions are met again.

[0127] VI. Strategy Evolution Layer: This layer is the core of self-evolution. Based on knowledge in its semantic memory, it automatically generates improved trading strategies. The process consists of three steps: Step 1: Knowledge Retrieval. The system calculates the frequency or relevance score of each knowledge item in the semantic memory within the current period, and extracts the K knowledge items with the highest scores as the basis for evolution.

[0128] Step 2: Hypothesis Generation. Input the full text of the currently effective trading strategy and the K retrieved high-frequency empirical knowledge points into the large language model, combining them according to the template. The prompt states: "You are a strategy optimizer, and you need to generate an improved list of trading principles based on this empirical knowledge." The "Strategy Improvement Hypotheses" output by the large language model must specifically specify the four operations to be performed on the original strategy principles: New principle: Add a previously missing principle, such as "suspend buying when keywords such as 'investigation' or 'case filing' appear in the news summary"; Deletion principle: Remove a principle that has been verified to be invalid or no longer applicable; Reinforcement principle: Tighten the conditions of a certain principle, such as adjusting the stop-loss line from -5% to -4%; Modification principle: Adjusting the internal logic or parameters of a certain principle.

[0129] Step 3: Candidate Policy Generation. The large language model applies the above operations to the original policy text to generate a complete, directly interpretable and executable candidate policy version, and identifies it as a "candidate policy".

[0130] Furthermore, the policy evolution layer requires the large language model to output point estimates, confidence intervals, nominal confidence levels, number of support samples, and value boundaries for each key hyperparameter in a constrained structure. For the ... Parameters ,Depend on Sub-auto-resampled estimate empirical distribution Constructing percentile confidence intervals: Candidate parameters must also satisfy: In one embodiment, , , The endpoints of the intervals are taken from the 2.5% and 97.5% quantiles of the bootstrap distribution. Here, 95% is the nominal confidence level for the interval construction, not a posterior probability assigned to a fixed true value. Candidate parameters that cannot form valid intervals or whose intervals cross hard risk boundaries are not allowed to enter the validation layer.

[0131] Sensitivity analysis of candidate strategies uses a finite difference approximation of the partial derivatives of the parameters with respect to the Sharpe ratio. Let... To fix the Sharpe ratio on the verification window, For the first The allowed range of each parameter is defined as follows: Normalization using the parameter range rather than the current parameter value avoids artificially suppressing sensitivity when the parameter is close to zero; all perturbations are confined within the hard boundaries of the parameter.

[0132] For points not located on the parameter boundaries, the system simultaneously calculates the normalized second-order difference to identify sharp optima: Boundary points are finite-edge differences of the same order. When ,or If the parameter exceeds the 95th percentile of its historical curvature distribution, it is marked as a highly sensitive parameter, and the validation interval is required to be expanded, the single adjustment range reduced, or the candidate strategy rejected.

[0133] VII. Experimental Validation Layer. To ensure stability, any candidate strategy must undergo rigorous rolling window backtesting before being deployed.

[0134] The implementation steps for this layer are as follows: Window partitioning: The historical data is divided into three consecutive windows according to time sequence: training window, validation window and test window.

[0135] Rolling backtesting: Using a deterministic trading execution engine that is completely consistent with the execution layer, the original strategy is applied and recorded in the training window to simulate the part that has occurred in live trading; then, the original strategy and the candidate strategy are run in the verification window respectively to compare the performance; finally, the candidate strategy is evaluated in the test window without any parameter adjustment.

[0136] Multi-metric validation: During the test window, the candidate strategies are evaluated in multiple dimensions, including Sharpe ratio, maximum drawdown, win rate, annualized return, and risk-reward ratio (return / maximum drawdown).

[0137] A candidate strategy is considered to have passed validation only if it meets the thresholds on all metrics and the core metrics (such as the Sharpe ratio) are not lower than those of the original strategy.

[0138] Furthermore, in one embodiment, the scrolling window is set to a training window of 240 trading days, a validation window of 60 trading days, and a test window of 60 trading days, with the window length ratio being [missing information]. Each time, the scroll moves forward by 20 trading days, meaning the scrolling step is equal to the length of the verification window. The training window is used to generate candidate parameters and empirical statistics, the validation window is used for strategy selection and threshold determination, and the testing window is kept isolated and used only for the final upgrade decision.

[0139] The overfitting penalty index is calculated based on the difference in training-validation performance. Let... The Sharpe ratio is used for training and validation, respectively. The maximum drawdown is expressed as a positive number. For the win rate, then: In one embodiment, a candidate strategy must satisfy the following conditions to pass verification: This means that the Sharpe ratio is allowed to decrease by a maximum of 0.05 relative to the benchmark strategy during the test window, and the maximum drawdown is allowed to deteriorate by no more than 10%. If the test fails, the reason for the failure and the corresponding parameter range will be fed back to the strategy evolution layer.

[0140] 8. Strategy Management Team. The strategy management team is responsible for version control and lifecycle management of trading strategies. Version generation: Once a candidate strategy passes all tests in the experimental verification layer, the strategy management layer assigns it an official version number.

[0141] Version storage: The complete text of the strategy, the metrics data that passed the test, the upgrade timestamp, and the parent version number (V1) are packaged together and stored in the strategy repository. The strategy records of the old version V1 and its complete backtest tracks are still retained and will not be overwritten.

[0142] Strategy Upgrade: The system automatically switches the current trading strategy pointer called by the decision-making layer to the new version V2, and it will take effect from the next decision.

[0143] Strategy rollback: If a new strategy triggers a manually set risk monitoring red line during live trading (such as abnormal drawdowns over several consecutive days), the system supports one-click or automated hot rollback, the decision pointer is redirected to the previous stable version, and an alarm is triggered.

[0144] Furthermore, the policy version employs a dual-buffer system to achieve seamless hot-switching. The system maintains an active buffer. and spare buffer The current activity strategy is determined by atomic pointers. Pointing to. The candidate version is first fully loaded to The process sequentially performs checks on file hashes, dependency versions, parameter boundaries, risk rules, and pre-inference; after successful checks, it executes: This operation atomically switches to B only while the pointer still points to A. Each in-transit decision acquires an immutable policy pointer and version number at the start and increments the reference count, so requests already entered before the switch continue to use A, and new requests immediately use B, preventing version mixing within the same decision. The old buffer is released only after the reference count reaches zero and two monitoring cycles have passed, and is retained during the rollback observation period.

[0145] Automatic rollback is determined using a combination of hard threshold and composite risk score. Let... This represents the maximum real-time drawdown after deployment. The number of consecutive losing trades. For execution or data anomaly rate, To provide a rolling real-time Sharpe ratio, Given the baseline Sharpe ratio before going live, then: The automatic rollback trigger condition is defined as follows: An immediate rollback occurs when any hard threshold is triggered; a composite risk score requires two consecutive monitoring windows to reach the threshold. Execution occurs after triggering. The system rolls back to the previous stable version and freezes the new version, while generating alerts and diagnostic tasks. If the pointer comparison fails, it indicates that a concurrent switch has occurred. The system then rereads the current version and performs a consistency check to avoid overwriting the update. All of the above thresholds are stored as configurable risk parameters in the policy version metadata.

[0146] Combining the above eight layers, such as Figure 3 As shown, the entire intelligent agent system operates continuously in a closed loop, and a typical complete cycle is as follows: During the online trading phase: The data layer continuously generates market snapshots. The decision-making layer, based on the current strategy (e.g., V2) provided by the strategy management layer, infers from each snapshot, outputting decisions and inference chains. The execution layer immediately executes instructions, generating trading trajectory data.

[0147] Offline Reflection and Knowledge Accumulation Phase: During non-trading periods, the reflection layer is activated, reading all transaction trajectories and reasoning chains of the day to generate reflection records, which are then stored in contextual memory. The memory layer determines whether the contextual memory bank has reached the update threshold. If it has, it uses a large language model to summarize and store new knowledge items in the semantic memory bank.

[0148] Strategy Evolution and Validation Phase: The strategy evolution layer is periodically activated (e.g., every weekend) to retrieve high-value knowledge from semantic memory, generate strategy improvement hypotheses, and form candidate strategy versions. The experimental validation layer then performs a complete backtest of the candidate strategy on historical data using the rolling window method. If successful, the strategy management layer registers it as the next official version (e.g., V3) and automatically switches to online.

[0149] Feedback enters a new cycle: at the start of the next trading cycle, the system has been loaded with the evolved new strategy and begins a new round of trading execution, thus realizing the uninterrupted continuous learning and autonomous evolution of the trading agent in a dynamic open market environment.

[0150] In summary, compared with existing technologies, the self-evolution method for trading strategies based on closed-loop feedback provided in this embodiment constructs a complete closed-loop feedback mechanism encompassing market perception, decision-making reasoning, trade execution, reflection and accumulation, knowledge summarization, strategy evolution, and verification and upgrading. This enables trading strategies to continuously and autonomously iterate and optimize based on feedback information from the entire trading process, dynamically adapting to the ever-changing financial market environment without relying on manual offline adjustments. This effectively improves the long-term operational effectiveness and environmental adaptability of trading strategies.

[0151] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0152] To facilitate better implementation of the self-evolution method for trading strategies based on closed-loop feedback in the embodiments of this application, this application also provides a device for self-evolution of trading strategies based on closed-loop feedback, which is based on the aforementioned self-evolution method for trading strategies based on closed-loop feedback. The meanings of the terms used are the same as in the aforementioned self-evolution method for trading strategies based on closed-loop feedback, and specific implementation details can be found in the descriptions in the method embodiments.

[0153] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of the self-evolution device for trading strategies based on closed-loop feedback provided in an embodiment of this application. Specifically, the self-evolution device may include a data acquisition module 201, a reasoning and decision-making module 202, a trade execution module 203, a reflection and analysis module 204, a contextual memory module 205, an inductive and abstract module 206, a strategy evolution module 207, and a strategy upgrade module 208, as follows: Data acquisition module 201 is used to collect market data and generate a representation of the current market status based on the market data; The reasoning and decision-making module 202 is used to perform reasoning analysis on the current market state representation based on the currently effective trading strategy, generate a reasoning chain, and output a trading decision based on the reasoning chain. The transaction execution module 203 is used to execute transaction operations based on transaction decisions and record transaction trajectory data generated during the transaction execution process. The reflection analysis module 204 is used to reflect on and analyze transaction trajectory data and reasoning chains, identify patterns in the transaction process, and generate structured reflection records. Contextual memory module 205 is used to store structured reflection records into the contextual memory bank; The inductive abstraction module 206 is used to summarize multiple structured reflection records in the context memory bank when the context memory bank meets the preset inductive conditions, generate knowledge entries, and store the knowledge entries in the semantic memory bank. The strategy evolution module 207 is used to retrieve knowledge entries from the semantic memory, evolve the currently effective trading strategy based on the retrieved knowledge entries, and generate candidate trading strategies. The strategy upgrade module 208 is used to verify candidate trading strategies. If the verification is successful, the candidate trading strategy will be upgraded to a new effective trading strategy.

[0154] Specific limitations regarding the self-evolution device for trading strategies based on closed-loop feedback can be found in the limitations of the self-evolution method for trading strategies based on closed-loop feedback described above, and will not be repeated here. Each module in the aforementioned self-evolution device for trading strategies based on closed-loop feedback can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0155] The self-evolution device for trading strategies based on closed-loop feedback provided in this embodiment constructs a complete closed-loop feedback mechanism encompassing market perception, decision-making reasoning, trade execution, reflection and accumulation, knowledge summarization, strategy evolution, and verification and upgrading. This enables trading strategies to continuously and autonomously iterate and optimize based on feedback information from the entire trading process. It can dynamically adapt to the ever-changing financial market environment without relying on manual offline adjustments, effectively improving the long-term operational effectiveness and environmental adaptability of trading strategies.

[0156] Furthermore, embodiments of this application also provide an electronic device, such as... Figure 5 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically: The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 301 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 302, and by calling data stored in the memory 302, thereby providing overall monitoring of the electronic device. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 301.

[0157] The memory 302 can be used to store software programs and modules. The processor 301 executes various functional applications and a self-evolving trading strategy based on closed-loop feedback by running the software programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.

[0158] The electronic device also includes a power supply 303 that supplies power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0159] The electronic device may also include an input unit 304, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0160] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 301 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 302 according to the following instructions, and the processor 301 runs the applications stored in the memory 302 to realize various functions, as follows: The system collects market data and generates a representation of the current market state. It then performs reasoning analysis on this representation based on the currently effective trading strategy, generating a reasoning chain and outputting a trading decision. Based on the trading decision, it executes trading operations and records the trading trajectory data generated during execution. The system reflects on and analyzes the trading trajectory data and reasoning chain to identify patterns in the trading process and generate structured reflection records. These structured reflection records are stored in a contextual memory. When the contextual memory meets preset induction conditions, it summarizes multiple structured reflection records in the contextual memory, generating knowledge entries and storing them in a semantic memory. Knowledge entries are retrieved from the semantic memory, and the currently effective trading strategy is evolved based on the retrieved knowledge entries to generate candidate trading strategies. The candidate trading strategies are verified; if verification is successful, the candidate trading strategy is upgraded to a new effective trading strategy.

[0161] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0162] This application's embodiments construct a complete closed-loop feedback mechanism encompassing market perception, decision-making reasoning, trade execution, reflection and accumulation, knowledge summarization, strategy evolution, and verification and upgrading. This enables trading strategies to continuously and autonomously iterate and optimize based on feedback information from the entire trading process. It allows for dynamic adaptation to the ever-changing financial market environment without relying on manual offline adjustments, effectively improving the long-term operational effectiveness and environmental adaptability of trading strategies.

[0163] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0164] To this end, embodiments of this application provide a storage medium storing multiple instructions that can be loaded by a processor to execute steps in any of the self-evolutionary trading strategy method based on closed-loop feedback provided in embodiments of this application. For example, the instructions can execute the following steps: The system collects market data and generates a representation of the current market state. It then performs reasoning analysis on this representation based on the currently effective trading strategy, generating a reasoning chain and outputting a trading decision. Based on the trading decision, it executes trading operations and records the trading trajectory data generated during execution. The system reflects on and analyzes the trading trajectory data and reasoning chain to identify patterns in the trading process and generate structured reflection records. These structured reflection records are stored in a contextual memory. When the contextual memory meets preset induction conditions, it summarizes multiple structured reflection records in the contextual memory, generating knowledge entries and storing them in a semantic memory. Knowledge entries are retrieved from the semantic memory, and the currently effective trading strategy is evolved based on the retrieved knowledge entries to generate candidate trading strategies. The candidate trading strategies are verified; if verification is successful, the candidate trading strategy is upgraded to a new effective trading strategy.

[0165] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0166] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0167] Since the instructions stored in the storage medium can execute the steps in any of the self-evolution methods of trading strategies based on closed-loop feedback provided in the embodiments of this application, the beneficial effects that any of the self-evolution methods of trading strategies based on closed-loop feedback provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0168] The above provides a detailed description of a method and apparatus for autonomous evolution of trading strategies based on closed-loop feedback, as provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for the autonomous evolution of trading strategies based on closed-loop feedback, characterized in that, include: Collect market data and generate a current market status representation based on the market data; Based on the currently effective trading strategy, the current market state representation is analyzed to generate an inference chain, and a trading decision is output based on the inference chain. Execute trading operations based on the aforementioned trading decisions, and record the trading trajectory data generated during the trading execution process; The transaction trajectory data and the inference chain are analyzed in reflection to identify patterns in the transaction process and generate structured reflection records. The structured reflection records are stored in the contextual memory bank; When the context memory bank meets the preset induction conditions, the multiple structured reflection records in the context memory bank are summarized to generate knowledge entries and store the knowledge entries in the semantic memory bank. The knowledge entries are retrieved from the semantic memory, and the currently effective trading strategy is evolved based on the retrieved knowledge entries to generate candidate trading strategies. The candidate trading strategies are verified. If the verification is successful, the candidate trading strategies are upgraded to new effective trading strategies.

2. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The process of collecting market data and generating a current market status representation based on that data includes: Collect market data from multiple data sources; The collected market data are spatiotemporally aligned according to timestamps; The aligned market data is encapsulated into a unified market status representation, which includes at least market information, technical indicator information, and textual information.

3. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The step of performing reasoning analysis on the current market state representation based on the currently effective trading strategy, generating a reasoning chain, and outputting a trading decision based on the reasoning chain includes: At the current moment, market analysis is performed based on the current market state characteristics to generate market analysis results; Obtain current holdings information, perform holdings analysis based on the current holdings information, and generate holdings analysis results; Obtain the strategy principles of the currently effective trading strategy, compare and evaluate the market analysis results and the position analysis results with the strategy principles respectively, and determine whether the current state conforms to each of the strategy principles; The reasoning chain is generated by comparing and evaluating the market analysis results and the position analysis results with the strategy principles, and standardized trading decisions are output based on the reasoning chain.

4. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The step of executing trading operations based on the trading decision and recording trading trajectory data generated during the trading execution process includes: The trading decisions are then converted into standardized trading instructions; The simulated transaction is executed according to the transaction instructions, and the simulated transaction price and transaction cost are calculated. Update position and account information based on the results of simulated trading; Record the time-series data of the transaction execution process to generate the transaction trajectory data.

5. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The process of reflecting on and analyzing the transaction trajectory data and the inference chain to identify patterns in the transaction process and generate structured reflection records includes: Extract the transaction trajectory data generated within a preset period and the inference chain corresponding to the transaction trajectory data; Input the transaction trajectory data, the inference chain, and the market state representation within the same preset period into the language model; The language model is used to identify error patterns and / or opportunity patterns in the trading process. The identified patterns are structured into structured reflection records, which include at least the pattern type, the time interval of occurrence, and suggestions for improvement.

6. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, When the context memory base meets the preset induction conditions, the multiple structured reflection records in the context memory base are summarized to generate knowledge entries and stored in the semantic memory base, including: Determine whether the number of reflection records in the context memory bank has reached a preset update threshold; When the preset update threshold is reached, all the reflection records within the preset time window in the context memory bank are input into the language model; The language model is used to summarize and extract recurring patterns that are statistically significant. The inductive results are output as structured knowledge entries.

7. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The step of retrieving the knowledge entries from the semantic memory and evolving the currently effective trading strategy based on the retrieved knowledge entries to generate candidate trading strategies includes: Calculate the relevance score of each knowledge item in the semantic memory, and extract the knowledge items with the highest relevance scores; The currently effective trading strategy and the extracted knowledge items are input into the language model, and the language model is used to generate a strategy improvement plan. The strategy improvement plan includes at least one of adding, deleting, strengthening or modifying the original strategy principles. The complete candidate trading strategy is generated based on the strategy improvement scheme.

8. The self-evolution method for trading strategies based on closed-loop feedback according to claim 7, characterized in that, After generating the complete candidate trading strategy based on the strategy improvement scheme, the method further includes: Calculate the sensitivity of each key parameter in the candidate trading strategy to the performance evaluation indicators; The key parameters whose sensitivity exceeds a preset sensitivity threshold are marked as high-sensitivity parameters; The verification conditions may be adjusted based on the highly sensitive parameters, or the candidate trading strategies may be rejected from entering the verification process.

9. The self-evolution method for trading strategies based on closed-loop feedback according to claim 1, characterized in that, The step of verifying the candidate trading strategy, and if the verification passes, upgrading the candidate trading strategy to a new effective trading strategy, includes: Historical data is divided into training windows, validation windows, and test windows according to time series. In the same trading execution engine as the execution phase, the current strategy is run on the training window, the current strategy and the candidate strategy are run on the verification window, and the candidate strategy is run on the test window to obtain the performance indicators of each strategy on each window. The candidate strategy is determined to pass the verification based on the performance indicators on the test window. When the candidate strategy meets the preset threshold value on each performance indicator and the core indicator is not lower than the current strategy, the candidate strategy is determined to pass the verification. Assign a version identifier to the verified candidate trading strategy, store the candidate trading strategy, its verification data, upgrade timestamp, and parent version information in the strategy repository, and switch the pointer of the currently effective trading strategy to the candidate trading strategy; Monitor the performance and risk metrics of the new effective trading strategy during its online operation, and when a preset rollback trigger condition is detected, roll back the trading strategy pointer to the previous version.

10. A trading strategy self-evolution device based on closed-loop feedback, characterized in that, include: The data acquisition module is used to collect market data and generate a current market status representation based on the market data. The reasoning and decision-making module is used to perform reasoning analysis on the current market state representation based on the currently effective trading strategy, generate a reasoning chain, and output a trading decision based on the reasoning chain. The transaction execution module is used to execute transaction operations based on the transaction decision and record transaction trajectory data generated during the transaction execution process; The reflection analysis module is used to reflect on and analyze the transaction trajectory data and the reasoning chain, identify patterns in the transaction process, and generate structured reflection records. The contextual memory module is used to store the structured reflection records into the contextual memory database; The inductive abstraction module is used to summarize multiple structured reflection records in the context memory bank when the context memory bank meets the preset inductive conditions, generate knowledge entries, and store the knowledge entries in the semantic memory bank. The strategy evolution module is used to retrieve the knowledge entries from the semantic memory, evolve the currently effective trading strategy based on the retrieved knowledge entries, and generate candidate trading strategies. The strategy upgrade module is used to verify the candidate trading strategy. If the verification is successful, the candidate trading strategy is upgraded to a new effective trading strategy.