Intelligent quantification strategy generation method, apparatus, device, and medium

CN123011962APending Publication Date: 2026-10-30FUTU NETWORK TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611137854.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

然而,普通投资者往往难以用如此精确的语言描述策略,更多是表达模糊的交易想法,例如“我想做一个当前黄金的短线交易策略”或“帮我设计一个适合震荡行情的策略”

Benefits of technology

[0009]本申请实施例提供的智能量化策略生成方法,通过获取用户以自然语言输入的初始量化策略描述;若初始量化策略描述为目标类别的量化策略描述,提取初始量化策略描述中的关键词;基于关键词进行多维度检索,得到目标检索信息;调用目标大模型,根据初始量化策略描述以及目标检索信息,生成目标量化策略描述;基于目标量化策略描述生成可执行的策略代码,策略代码为目标量化策略描述对应策略流程图所描述的逻辑流程的程序代码;根据可执行的策略代码生成策略流程图的可视化量化策略画布。通过获取用户以自然语言输入的初始量化策略描述,在判定其为目标类别的量化策略描述后提取关键词并进行多维度检索以获取实时市场数据等目标检索信息,进而调用目标大模型将初始描述与检索信息融合生成结构化、参数明确的目标量化策略描述,再基于该目标量化策略描述生成可执行的策略代码并最终转化为可视化量化策略画布,实现了对模糊、非结构化自然语言意图的准确理解与补全,有效降低了量化策略的描述门槛和生成难度,提高了策略生成的准确性、可执行性与用户体验。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011962A_ABST
    Figure CN123011962A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of natural language processing, in particular to an intelligent quantification strategy generation method and device, equipment and medium. The method comprises the following steps: obtaining an initial quantification strategy description input by a user in natural language; if the initial quantification strategy description is a quantification strategy description of a target category, extracting keywords in the initial quantification strategy description; performing multidimensional retrieval based on the keywords to obtain target retrieval information; calling a target large model, generating a target quantification strategy description according to the initial quantification strategy description and the target retrieval information; generating executable strategy code based on the target quantification strategy description, wherein the strategy code is program code of a logical process described by a strategy flowchart corresponding to the target quantification strategy description; and generating a visual quantification strategy canvas of the strategy flowchart according to the executable strategy code. The application effectively reduces the description threshold and generation difficulty of the quantification strategy, and improves the accuracy, executability and user experience of strategy generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure generally relates to the field of natural language processing technology, and specifically to a method, apparatus, device, and medium for generating intelligent quantization strategies. Background Technology

[0002] In the field of quantitative trading, strategy construction typically requires users to possess professional programming skills and quantitative knowledge, enabling them to write trading logic using languages ​​such as Python and C++, or to drag and drop combination condition cards through a graphical interface. While some existing quantitative platforms offer visual strategy editing functions, their underlying implementation still requires users to have a clear and precise understanding of trading conditions, technical indicators, and parameter settings. Users need to explicitly specify complete logic such as "execute a certain operation when a certain indicator exceeds a certain threshold." However, ordinary investors often struggle to describe strategies with such precise language, instead expressing vague trading ideas, such as "I want to create a short-term trading strategy for gold" or "Design a strategy suitable for volatile market conditions." Therefore, existing technologies for generating quantitative strategies from natural language suffer from a lack of effective processing capabilities for ambiguous intentions, limited strategy output formats, low visualization, and low strategy generation efficiency. Thus, how to better achieve quantitative strategy generation has become an urgent problem to be solved. Summary of the Invention

[0003] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide an intelligent quantization strategy generation method, apparatus, device and medium, which transforms the fuzzy natural language strategy description input by the user into a clear strategy through retrieval enhancement and RAG generation, metadata-driven filtering function, generation of programmable flowchart code and conversion into a visual canvas, so that the user can quickly generate an editable and executable visual quantization strategy without programming or precise description.

[0004] In a first aspect, embodiments of this application provide an intelligent quantization strategy generation method, including: Obtain the initial quantization strategy description input by the user in natural language; If the initial quantization strategy description is a quantization strategy description for the target category, extract the keywords from the initial quantization strategy description; A multi-dimensional search is performed based on the keywords to obtain the target search information; Invoke the target large model and generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information; Executable strategy code is generated based on the target quantization strategy description, and the strategy code is the program code of the logical flow described in the strategy flowchart corresponding to the target quantization strategy description; A visual quantitative strategy canvas is generated based on the executable strategy code to create the strategy flowchart.

[0005] Secondly, embodiments of this application provide an intelligent quantization strategy generation device, comprising: The acquisition module is used to acquire the initial quantization strategy description input by the user in natural language; The extraction module is used to extract keywords from the initial quantization strategy description if the initial quantization strategy description is a quantization strategy description of the target category. The retrieval module is used to perform multi-dimensional retrieval based on the keywords to obtain target retrieval information; The first generation module is used to call the target large model and generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information. The second generation module is used to generate executable strategy code based on the target quantization strategy description, wherein the strategy code is the program code of the logical flow described by the strategy flowchart corresponding to the target quantization strategy description; The third generation module is used to generate a visual quantitative strategy canvas of the strategy flowchart based on the executable strategy code.

[0006] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in embodiments of this application.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in embodiments of this application.

[0008] Fifthly, embodiments of this application provide a computer program product, including a computer program, characterized in that, when the computer program is executed by a processor, it implements the method described in embodiments of this application.

[0009] The intelligent quantization strategy generation method provided in this application involves: obtaining an initial quantization strategy description input by the user in natural language; if the initial quantization strategy description is a quantization strategy description for a target category, extracting keywords from the initial quantization strategy description; performing multi-dimensional retrieval based on the keywords to obtain target retrieval information; calling a target large model to generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information; generating executable strategy code based on the target quantization strategy description, where the strategy code is the program code for the logical flow described in the strategy flowchart corresponding to the target quantization strategy description; and generating a visual quantization strategy canvas of the strategy flowchart based on the executable strategy code. By acquiring the initial quantitative strategy description input by the user in natural language, and after determining that it is a quantitative strategy description of the target category, keywords are extracted and multi-dimensional searches are performed to obtain target retrieval information such as real-time market data. Then, the target big model is called to integrate the initial description and retrieval information to generate a structured, parameter-clear target quantitative strategy description. Based on this target quantitative strategy description, executable strategy code is generated and finally transformed into a visual quantitative strategy canvas. This achieves accurate understanding and completion of fuzzy and unstructured natural language intent, effectively reducing the description threshold and generation difficulty of quantitative strategies, and improving the accuracy, executability and user experience of strategy generation.

[0010] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0011] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1A This illustration shows an application scenario diagram of the quantization strategy canvas provided in an embodiment of this application; Figure 1B The implementation environment architecture diagram of the intelligent quantization strategy generation method provided in the embodiments of this application is shown; Figure 2 A flowchart illustrating an embodiment of the intelligent quantization strategy generation method provided in this application is shown. Figure 3 This illustration shows a schematic diagram of the disassembly structure of a quantization strategy canvas provided in an embodiment of this application; Figure 4 A schematic diagram of the structure of an intelligent quantization strategy generation device provided in an embodiment of this application is shown; Figure 5 A schematic diagram of the structure of a computer system suitable for implementing an electronic device or server according to embodiments of this application is shown. Detailed Implementation

[0012] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0013] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0014] Quantitative trading refers to the process of using computer technology to complete trades based on pre-defined quantitative strategies. Quantitative trading greatly reduces the impact of investor sentiment fluctuations and avoids making irrational investment decisions in situations of extreme market euphoria or pessimism.

[0015] Quantitative trading strategies, or quantitative strategies in general, specifically include the driving object, pre-defined trading conditions, and the trading operations triggered when the trading conditions are met. The trading conditions include, but are not limited to, the requirement that the market data and / or related technical indicators of the driving object meet specific conditions. Trading operations include, but are not limited to, order placement and order cancellation. For example, taking a moving average golden cross entry strategy as an example, when the K-line data of the driving object specified in the quantitative strategy crosses above its moving average over a certain long period (i.e., the quantitative condition is met), a buy order for the driving object is executed.

[0016] For example, the strategy logic of a quantitative trading strategy can be: when the technical indicator of the driving object specified in the quantitative trading strategy meets the preset condition, an order is placed on the specified object. Taking the moving average golden cross opening strategy as an example, when the moving average of the driving object specified in the quantitative trading strategy meets the golden cross within a certain period, a buy order is placed on the driving object, thereby helping investors better seize trading opportunities, achieve more accurate and efficient trading operations, and improve trading efficiency and speed.

[0017] Investors can define the strategy logic of preset quantitative trading strategies based on the visual interactive interface provided by the client-side. Specifically, investors can directly specify preset trading conditions and the trading operations to be executed after these conditions are met. The visual interactive interface can include a quantitative strategy canvas, which provides card controls, including start card controls, condition card controls, and action card controls. The start card control specifies the driving object (or trading object) of the quantitative trading strategy canvas and the starting point of the corresponding quantitative trading logic. The condition card control indicates the trading conditions, and the action card control indicates the trading operation to be executed. Users can edit and connect the card controls provided by the quantitative strategy canvas, connecting them in a specific order to form a strategy flowchart. See, for example... Figure 1A Users can edit the condition card control to set the trading conditions of the quantitative trading strategy, edit the action card control to set the trading operations of the quantitative trading strategy, and connect the start card control, condition card control and action card control in sequence to generate a strategy flowchart.

[0018] Understandably, the card control encapsulates code functions that implement its functional logic. When the user triggers the execution of the quantitative trading strategy canvas, the code functions corresponding to the card controls can be executed sequentially according to the logical order of the card controls in the strategy flowchart, so as to realize the trading operation according to the strategy logic of the corresponding quantitative trading strategy.

[0019] During the execution of the quantitative trading strategy, the client obtains the market data of the trading object specified by the start card control in real time, and determines whether the market data of the trading object meets the preset trading conditions specified by the condition card control. When the preset trading conditions specified by the condition card control are met, the client can automatically execute the trading operation indicated by the action card control to send the corresponding trading request to the corresponding trading request interface of the server to realize the transaction.

[0020] However, existing technologies face several challenges when dealing with users' quantitative strategy requirements input in fuzzy natural language. These include inaccurate understanding of intent, the inability to automatically complete missing key strategy elements, and the difficulty in directly converting natural language descriptions into visual and executable strategy flowcharts. These issues severely restrict the level of automation in quantitative strategy generation and the user experience.

[0021] For the specific implementation environment of the intelligent quantization strategy generation method proposed in this application, please refer to [link / reference needed]. Figure 1B . Figure 1B The implementation environment architecture diagram of the intelligent quantization strategy generation method provided in the embodiments of this application is shown.

[0022] like Figure 1B As shown, the implementation environment architecture includes: terminal device 101, server 102 and multiple quantization strategy execution servers 103.

[0023] Terminal device 101 is used to run an application client and provide an interactive interface to the user. The interactive interface receives a quantization strategy description input by the user in natural language and presents a generated visual quantization strategy canvas. Terminal device 101 can be a desktop computer, laptop computer, smartphone, tablet computer, e-book reader, smart glasses, smartwatch, in-vehicle device, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR), virtual reality (VR) device, etc., but is not limited to these.

[0024] Server 102 is connected to terminal device 101 and multiple quantitative strategy execution servers 103. Server 102 executes the intelligent quantitative strategy generation method proposed in the application embodiment. This method extracts keywords from the initial quantitative strategy description input by the user on terminal device 101, performs multi-dimensional keyword retrieval, calls the target model to generate a target quantitative strategy description, generates strategy code, and finally returns visualized quantitative strategy canvas data to terminal device 101. The multiple quantitative strategy execution servers 103 execute user-generated quantitative strategies, including tasks such as strategy backtesting, simulated trading, and live trading, and provide server 102 with strategy execution results and required market data and indicator data.

[0025] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Server 102 is used to provide quantization strategy generation services to terminal device 101 and execute core processing logic such as extracting keywords from the initial quantization strategy description, multi-dimensional keyword retrieval, calling the target model to generate the target quantization strategy description, and strategy code generation.

[0026] Server 102 is directly or indirectly connected to terminal device 101 and multiple quantization strategy execution servers 103 via wired or wireless communication. Optionally, the aforementioned wireless or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to any combination of Local Area Network (LAN), Metropolitan Area Network (MAN), Wide Area Network (WAN), mobile, wired or wireless network, private network, or virtual private network.

[0027] The intelligent quantization strategy generation method proposed in this application can be implemented by an intelligent quantization strategy generation device, which can be installed on a terminal device or a server.

[0028] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation instruction steps as shown in the following embodiments or drawings, the method may include more or fewer operation instruction steps based on conventional or non-creative effort. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application. In actual processing or when the device executes the method, it may be executed sequentially or in parallel according to the method shown in the embodiments or drawings.

[0029] It should be noted that the acquisition or use of data in the embodiments of this application requires the user's consent. The relevant data can only be obtained after the user's authorization and permission, and the acquisition or use of the data complies with the laws and regulations of the relevant regions.

[0030] Please refer to Figure 2 , Figure 2 A flowchart illustrating an embodiment of the intelligent quantization strategy generation method provided in this application is shown. Figure 2 As shown, the method includes: Step 201: Obtain the initial quantization strategy description input by the user in natural language.

[0031] The system receives quantitative strategy descriptions input by users in natural language through the front-end interface, such as: "If the MACD of a stock's daily K-line is a golden cross, then buy 100 shares at the market price; if the MACD of a stock is a death cross, then liquidate the position."

[0032] Specifically, the user's natural language input can be obtained. The natural language input can be classified into intents to determine whether the user's natural language input is a quantization strategy description. If the natural language input is determined to be a quantization strategy description, it is confirmed as the initial quantization strategy description, and subsequent steps S202 to S206 can be executed to convert the initial quantization strategy description input in natural language into a visual quantization strategy canvas.

[0033] Optionally, if the user's natural language input is other than a quantified intent category, it can trigger a transition to the normal AI question-answering process.

[0034] Specifically, a lightweight classifier can be used to classify the natural language input entered by the user through regular expression matching (such as regular expression matching keywords such as "quantitative", "trading", and "strategy") or by using the BERT model. If the classification result output by the BERT model indicates that the probability of the natural language input being related to quantitative strategy is lower than a preset threshold, then the natural language input entered by the user is marked as other inputs that are not related to quantitative intent. If the classification result output by the BERT model indicates that the probability of the natural language input being related to quantitative strategy is greater than or equal to the preset threshold, then the natural language input entered by the user is marked as natural language input related to quantitative strategy.

[0035] Step 202: If the initial quantization strategy description is a quantization strategy description of the target category, extract the keywords from the initial quantization strategy description.

[0036] Once the initial quantization strategy description is determined to be a quantization intent, its quantization intent category is further identified. Quantization intent categories include, but are not limited to, clear quantization intent categories or fuzzy quantization intent categories. In this embodiment, the target category may include a fuzzy quantization intent category. For fuzzy quantization intent categories, keywords can be extracted from the initial quantization strategy description, search information can be obtained based on the keywords, and the initial quantization strategy description needs to be rewritten based on the search information to obtain a clear quantization intent category.

[0037] Specifically, when it is determined that the natural language input entered by the user is natural language input related to the quantitative strategy (i.e., the initial quantitative strategy description), the intent of the initial quantitative strategy description can be identified. By judging whether the initial quantitative strategy description fully contains key elements such as the target (i.e. the trading object), trading conditions, and trading operations, and whether the logical relationship between each key element is clear, the quantitative intent category corresponding to the initial quantitative strategy description can be determined.

[0038] For example, slot extraction technology can be used to identify and extract the set of elements for constructing a quantitative strategy from the initial quantitative strategy description: target (i.e., trading object), conditions (i.e., trading conditions, used to indicate under what circumstances it is triggered), and actions (i.e. trading operations, used to indicate what operations are performed), so as to analyze whether the quantitative strategy description fully contains these three key slots based on the total of the extracted elements.

[0039] Among them, the quantitative strategy description of the clear quantitative intent category fully includes the three key elements of target, condition, and action, and the logical relationship between the elements is clear; the quantitative strategy description of the fuzzy quantitative intent category partially includes or does not include the key elements required for the quantitative strategy, or the key elements of the input are complete but the logical expression is unclear.

[0040] Once the initial quantitative strategy description is determined to be a fuzzy quantitative intent category, keywords can be further extracted from the initial quantitative strategy description. Keyword extraction can be achieved using Named Entity Recognition (NER) or rule-based regular expression matching, such as identifying stock names, indicator names, directional terms (up / down), and quantity terms.

[0041] Step 203: Perform multi-dimensional retrieval based on keywords to obtain target retrieval information.

[0042] To improve the accuracy and relevance of subsequent large-scale model generation, this embodiment introduces a retrieval augmentation generation (RAG) mechanism for fuzzy quantification of intent categories. Specifically, the server performs real-time retrieval from multiple data dimensions based on extracted keywords to obtain auxiliary information related to the user's intent, thereby obtaining the target retrieval information.

[0043] The target retrieval information includes, but is not limited to, at least one of the following: financial data and textual knowledge data.

[0044] Specifically, financial data includes, but is not limited to, market data, technical indicator data, and fundamental data of the entities corresponding to the keywords. Market data includes, for example, current price, price change, trading volume, and turnover rate. Technical indicator data includes, for example, the current values ​​of MACD, RSI, Bollinger Bands, and moving averages. Fundamental data includes, for example, price-to-earnings ratio, price-to-book ratio, financial statement data, and dividend information.

[0045] Textual knowledge data includes, but is not limited to, entity information data, news data, and market environment data of the market to which the entity belongs, corresponding to the keywords. News data includes, for example, recent company announcements, industry news, and policy announcements; entity information data includes, for example, company profile, shareholder structure, and main business; and market environment data includes, for example, market trends, sector popularity, and market sentiment indicators.

[0046] Multi-dimensional retrieval can be achieved by calling pre-built data interfaces (such as market data APIs, news APIs, and database queries). The retrieval results, after being structured, serve as enhanced context for subsequent large-scale model inference.

[0047] In one embodiment, multi-dimensional retrieval based on keywords is performed to obtain target retrieval information, specifically including: Step S2031: Determine the set of search dimensions.

[0048] Based on the keywords extracted from the initial quantitative strategy description, multiple search dimensions are configured, including at least financial data dimensions and textual knowledge dimensions.

[0049] Step S2032, financial data dimension retrieval.

[0050] Based on keywords, the financial data retrieval service is invoked to retrieve financial data associated with the keywords from the internal financial database. The financial data includes, but is not limited to, financial definition knowledge related to the keywords, or market data, technical indicator data, and fundamental data of the entities corresponding to the keywords, such as real-time market data, technical indicator data, company profile data, financial data, institutional holdings data, brokerage trading data, short selling data, and options data.

[0051] Specifically, when the keyword contains a stock name or stock code, the system retrieves real-time market data such as the current price, price change, trading volume, and turnover rate of the entity corresponding to that stock name or stock code from the market data interface of the internal financial database; it also retrieves the calculation methods of technical indicators such as MACD, RSI, Bollinger Bands, and moving averages from the technical indicator library of the internal financial database, and then combines this with the real-time market data to obtain the current values ​​of the technical indicators; and it extracts fundamental data such as the price-to-earnings ratio, price-to-book ratio, and revenue growth rate of the entity corresponding to the stock name or stock code from the financial database of the internal financial database.

[0052] Step S2033, Text knowledge dimension retrieval.

[0053] Based on keywords, the text knowledge retrieval service is invoked to retrieve text knowledge data associated with the keywords from internal and / or external knowledge bases. The text knowledge data includes, but is not limited to, financial definition knowledge related to the keywords, entity information data of the entities corresponding to the keywords, news data, and market environment data of the market to which the entities belong, such as news, announcements, performance briefing records, research reports, market commentary, etc.

[0054] Specifically, when keywords involve vague descriptions such as "gold" or "short-term," the system retrieves financial definition data related to "gold" or "short-term" from the internal knowledge base, and recent financial news data related to the keywords from the external knowledge base. When keywords contain stock names or stock codes, the system retrieves information such as the company profile, shareholder structure, and main business of the entity corresponding to the stock name or stock code from the internal knowledge base, and obtains news data and market environment data of the entity's market from the external knowledge base (such as obtaining search results related to the keywords through a search engine), such as supplementary information like macro policies, industry dynamics, and market hotspots, to help understand the user's vague intent.

[0055] Step S2034, multi-path recall and fusion.

[0056] The financial data retrieved from the financial data dimension and the text knowledge data retrieved from the text knowledge dimension are retrieved through multiple channels. Vector retrieval and keyword retrieval are combined. After data filtering and sorting, the target retrieval information is obtained.

[0057] Specifically, vectorized retrieval is used to semantically expand keywords and perform similarity matching with financial data vectors and text knowledge vectors in the vector database to obtain semantically relevant data. At the same time, keyword retrieval is used for precise matching to obtain entity matching data. The semantically relevant data and entity matching data are then fused together according to relevance to generate structured target retrieval information for subsequent large-scale model inference.

[0058] Step 204: Invoke the target large model and generate a target quantization strategy description based on the initial quantization strategy description and target retrieval information.

[0059] This step aims to transform the initial fuzzy natural language description, combined with the retrieved real-time data, into a structured, process-oriented, and parameter-defined quantization strategy description, i.e., a target quantization strategy description.

[0060] In one embodiment, the initial quantitative strategy description and target retrieval information can be fused to form an enhanced context. The target retrieval information includes at least real-time market data and / or technical indicator data obtained from the financial data dimension, and news and / or announcement data obtained from the textual knowledge dimension. The fused enhanced context provides the target big model with real-time vertical data support for completing ambiguous intents. Then, the enhanced context is input into the target big model, enabling it to semantically complete missing or ambiguous strategy elements in the initial quantitative strategy description based on the enhanced context, and map the completed strategy elements as structured fields. These strategy elements include at least the trading target, quantitative strategy type, trading conditions, trading operations, and risk management constraints. Subsequently, the structured fields output by the target big model are obtained, and a target quantitative strategy description containing a complete logical flow is generated based on these structured fields. This target quantitative strategy description serves as input for subsequently generating executable strategy code.

[0061] In one embodiment, step S204 specifically includes the following steps: Step S2041: Obtain the optimization prompts for the quantitative strategy description.

[0062] In one embodiment, to achieve the above-mentioned semantic completion, element structuring, and structured description generation, the target large model is guided in the following manner: The server pre-configures optimization prompts for the quantization strategy description generated by the target quantization strategy description. Specifically, the optimization prompts are pre-configured structured instruction texts used to guide the target large model to parse and optimize the user's initial quantization strategy description according to a predefined analysis framework.

[0063] The quantitative strategy description optimization prompts include at least the following: role definition layer, task description layer, and output format constraint layer.

[0064] The role definition layer is used to define the behavioral paradigm of the target model, for example, setting the target model to perform reasoning and output in the role of a "quantitative strategy analyst"; The task description layer is used to clarify the core tasks that the target large model needs to perform and defines the processing flow that the target large model needs to execute sequentially. For example, the processing flow defined by the task description layer includes, but is not limited to, parameter extraction, process description rewriting, and parameter logic interpretation. The output format constraint layer specifies the structured fields and organization of the target large model's output content. It defines multiple dimensional fields required to generate a description of the target quantitative strategy, including but not limited to quantitative strategy-related information, trading object-related information, and trading operation-related information. Specifically, quantitative strategy-related information includes the quantitative strategy definition, quantitative strategy type, and applicable scenarios; trading object-related information includes the trading market / instrument / stock, specifying the market, instrument, and trading target; and trading operation-related information includes risk preference, trading rules, trading frequency, associated technical indicators and parameters, market data granularity, and trading cycle.

[0065] Step S2042: Invoke the target large model, optimize the prompt words based on the initial quantization strategy description, target retrieval information and quantization strategy description, and determine the target quantization strategy type and quantization strategy parameters.

[0066] The server concatenates the initial quantitative strategy description, the target retrieval information obtained in step S203, and the aforementioned optimized prompts into a complete input sequence, and sends it to the target large model (e.g., DeepSeek, GPT-4). The target large model performs semantic understanding of the initial quantitative strategy description based on the corresponding instruction text in the role definition layer and task description layer of the optimized prompts in the quantitative strategy description. It then combines this understanding with the financial data and textual knowledge data contained in the target retrieval information to determine the target quantitative strategy type that best matches the user's needs. Simultaneously, it extracts and determines the quantitative strategy parameters for each dimension under this target quantitative strategy type.

[0067] The quantitative strategy type indicates the specific quantitative strategy, such as trend-following strategy or mean reversion strategy.

[0068] The quantitative strategy parameters include, but are not limited to, quantitative strategy-related information, trading object-related information, and trading operation-related information. Quantitative strategy-related information includes the quantitative strategy definition, quantitative strategy type, and applicable scenarios; trading object-related information includes the trading market / instrument / individual stock, used to specify the market, instrument, and trading target; trading operation-related information includes risk preference parameters, trading rules, trading frequency, related technical indicators and parameters, market data granularity, and trading cycle.

[0069] For example, a quantitative strategy definition refers to the text used to describe the core logic of a quantitative strategy; a quantitative strategy type indicates a specific quantitative strategy, such as trend following, grid trading, event-driven quantitative strategies, etc.; and a quantitative strategy application scenario (market conditions) indicates the market trend scenario in which the corresponding quantitative strategy is used, such as a one-sided upward trend, a sideways trend, or a downward trend.

[0070] For example, the constraints related to trading operations determine the specific descriptions, numerical ranges, and logical relationships of the quantitative strategy in the corresponding paragraphs of the preset strategy description template. Specifically, risk preference parameters affect the values ​​of risk control parameters such as stop-loss range and position ratio; trading rule parameters are directly mapped to the specific execution logic in the entry condition segment (i.e., the parameter description indicating the trading conditions for buy operations), exit condition segment (i.e., the parameter description indicating the trading conditions for sell operations), and / or position management segment (i.e., the parameter description indicating the judgment of the number of positions); trading frequency includes high frequency / medium frequency / low frequency, used to indicate the frequency of trading operations during the execution of the quantitative strategy; related technical indicators and parameters include but are not limited to MACD(12,26,9) and RSI(14), used to indicate the technical indicators used in the corresponding quantitative strategy; trading cycle includes but is not limited to intraday, short-term, medium-term, etc., used to indicate the description of the time window for trading operations and the setting of related time conditions during the execution of the quantitative strategy; market data granularity includes but is not limited to 1-minute K-line, 30-minute K-line, and daily K-line, used to indicate the K-line level used for technical indicator calculation during the execution of the quantitative strategy; trading rule parameters can be directly mapped to the specific execution logic in the entry condition segment, exit condition segment, and position management segment.

[0071] Step S2043: Generate a process-oriented description language based on the preset strategy description template corresponding to the target quantization strategy type and the quantization strategy parameters to obtain the target quantization strategy description.

[0072] Specifically, the system pre-configures preset strategy description templates corresponding to various quantitative strategy types. Each preset strategy description template defines a standardized description structure for that type of strategy, including but not limited to structured paragraphs such as strategy overview, entry conditions, exit conditions, and position management. Each paragraph contains parameter placeholders. The server pre-defines a preset strategy description template for each quantitative strategy type, and each preset strategy description template defines a standardized description structure for that type of strategy, including but not limited to structured paragraphs such as strategy overview, entry conditions, exit conditions, and position management. Each paragraph contains parameter placeholders. After determining the target quantitative strategy type, the system retrieves the preset strategy description template corresponding to that target quantitative strategy type from the template library and fills the parameters extracted in step S2042 into the corresponding parameter placeholder positions in the corresponding preset strategy description template. This generates a flow-oriented description language expressed in natural language, containing specific quantitative conditions and execution steps. This flow-oriented description language is the final target quantitative strategy description. The target quantization strategy description clearly defines the complete execution logic of the strategy in a structured and parsable manner, enabling the subsequent system to automatically generate executable quantization strategy code based on the description.

[0073] For example, the template for a "trend-following strategy" is: "This strategy is a trend-following strategy, and the trading target is {target}. Entry condition: When {technical indicator} meets {comparison condition}, buy {quantity} at {price type}; Exit condition: When {technical indicator} meets {comparison condition}, sell the position at {price type}. Stop loss is set to {stop loss rule}, and take profit is set to {take profit rule}." After filling in the specific parameters, you get the target quantitative strategy description, which is logically clear and has complete parameters.

[0074] For initial quantification strategy descriptions categorized as "clear quantification intent," the rewriting steps described above can be skipped. Alternatively, keywords can be extracted, retrieval information can be obtained based on the keywords, and a large model can be invoked to perform parameter completion and standardization on the initial quantification strategy description based on the retrieval information to generate the target quantification strategy description.

[0075] Step 205: Generate executable strategy code based on the target quantization strategy description. The strategy code is the program code of the logical flow described in the strategy flowchart corresponding to the target quantization strategy description.

[0076] Specifically, based on the target quantization strategy description, the target quantization function is determined from the pre-set quantization function library, and the target quantization function is instantiated with parameters to generate a function instance object; based on the function instance object and the pre-set graph node function set, executable strategy code is generated.

[0077] As shown in the quantization strategy canvas above, the quantization strategy is presented in the form of a strategy flowchart. Its storage and organization within the computer employ a graph data structure, recording the logical topological relationships of the quantization strategy in a "node-connection" manner. However, this graph data structure focuses on low-level encoding of connections, and its control flow semantics (such as sequential execution and conditional branching) are implicitly distributed within the topological relationships of nodes and edges, resulting in low semantic density. When a quantization strategy description input by a user in natural language is obtained and converted into a corresponding graph data structure of the strategy flowchart, large language models often need to simultaneously perform natural language semantic understanding and graph topology generation, making it difficult to guarantee the accuracy and robustness of the generated results, especially when dealing with quantization strategies containing complex branching logic.

[0078] To output a policy flowchart on a quantization policy canvas based on natural language input quantization policy descriptions, the large, heterogeneous quantization policy canvas can be pre-abstracted into atomic, structured metadata, forming a component library that can be directly referenced by large language models and programs. When a user inputs a quantization policy description, the large language model does not need to directly generate complex business code or a graph topology. Instead, it quickly and accurately determines the target quantization function corresponding to the user's intent by retrieving and matching these high semantic density metadata definitions corresponding to preset functions. Then, based on the target quantization function, it generates the corresponding quantization policy code. This policy code inherits the semantics of the quantization policy description input from natural language and is backward compatible with the generation of policy flowcharts in existing quantization policy canvases.

[0079] Specifically, during system initialization, the following metadata-driven preparations need to be completed: As mentioned above, refer to Figure 3 The quantization strategy canvas can be broken down into card controls and the connections between them. Each card control can be further broken down into at least one quantization function, through which the functional logic corresponding to the card control can be defined. For example, a condition card control may include an lvalue function, a comparison operator, and an rvalue function to define the conditional judgments involved in the quantization strategy; an action card control may include an rvalue function to define the strategy action in the quantization strategy; and a start card control may include a function for creating global variables. Quantization functions can be constructed based on function code and parameters. Therefore, a library of quantization functions and a set of graph node functions can be pre-built to generate the quantization strategy canvas.

[0080] The quantitative function library includes multiple quantitative functions and their corresponding metadata definitions. For example, quantitative functions may include the order placement function func_order for performing order placement operations, the magic nine-turn function func_nine for determining whether K-line data conforms to the magic nine-turn structure, the position query function func_posiqty for querying the current user's position quantity for the driving object, and so on. These will not be listed one by one here. The graph node function set includes card node functions for constructing card nodes such as condition card controls, action card controls, and start card controls, as well as connection functions for connecting different card nodes. In addition, the graph node function set may also include canvas construction functions, which are used to aggregate all generated card nodes and the connections between card nodes to form a strategy flowchart.

[0081] Understandably, the card node function is used to implement the logical functions of the card controls in the quantization strategy canvas, and the connection function is used to define the execution flow and branch logic of the card controls corresponding to the card node function.

[0082] Specifically, the quantization function library includes metadata definitions for all quantization functions, and each quantization function's metadata definition can be stored in a structured format (JSON / YAML). The metadata definition of a quantization function includes at least the function name, function description, parameter list and parameter information for each parameter, and a function usage example. Parameter information includes, but is not limited to, parameter name, parameter type, default value, parameter value range, whether a parameter is required, and parameter enumeration values.

[0083] The graph node function set includes the metadata definitions of the card node functions and connection functions corresponding to all card controls (condition card controls, action card controls, and start card controls). The metadata definitions of card node functions include the card node function name, card node description, and the function combinations contained therein. The metadata definitions of connection functions include the connection function name, connection description, and condition judgment logic.

[0084] Taking conditional card node functions as an example, the metadata definition of a conditional card node function may include the card node function name, card node function description, lvalue function information, rvalue function information, comparison operator information, and card node usage examples; Taking the connection function as an example, the metadata definition of the connection function may include the connection function name, connection function description, starting card node information, ending card node information, connection type, and connection function usage examples.

[0085] In addition, function libraries can be preloaded. Specifically, the quantization functions in the quantization function library, as well as the Python functions (such as the implementation code of func_order) corresponding to the card node functions and connection functions in the graph node function set, are registered in memory to establish a mapping between function names and function code objects so that they can be called during subsequent instantiation.

[0086] After obtaining the quantization strategy description, semantic analysis can be performed on the quantization strategy description using a large model (such as an LLM model) to obtain the strategy logic flow corresponding to the quantization strategy description. Based on the strategy logic flow, the large model is called to select the most matching quantization function (i.e., the target quantization function) from the pre-built quantization function library, without the large model directly generating any code corresponding to the quantization strategy. This effectively improves the accuracy of converting the quantization strategy description input from natural language into a strategy flowchart on the quantization strategy canvas.

[0087] Specifically, the system uses the function names, descriptions, parameter lists, and usage examples of all quantization functions in the quantization function library as context (system prompt), and the user-inputted quantization strategy description as input. Based on preset prompt words, the system calls a large model to obtain the strategy logic flow corresponding to the quantization strategy description, and determines one or more of the most relevant target quantization functions involved in each strategy logic flow from the preset quantization function library. For any target quantization function, a corresponding function instance object to be executed can be generated based on the semantic information of the strategy logic flow and the metadata definition of the target quantization function.

[0088] It is understandable that a function instance object is a computational unit to be executed, used to implement a specific data processing logic under the quantization strategy.

[0089] For example, the quantitative strategy description entered by the user is: "Create a Magic Nine-Turn Strategy for Stock A, buy one lot when a downward nine-turn pattern appears, and sell the position when an upward nine-turn pattern appears." Through semantic analysis of the quantitative strategy description using a large model, the strategy logic flow can be obtained as follows: S1: Create the driving object stock A; S2: Create a holdings assessment card; S3: Implement the sell branch: If you have a position, sell your position when the nine-upward structure appears; S4: Buy branch: No position, buy one lot when a downward nine structure appears.

[0090] Once the strategy logic flow is determined, for any given strategy logic flow, the quantization functions involved in that flow can be determined from a pre-built quantization function library based on the semantic information of the strategy logic flow. Simultaneously, for any determined target quantization function, a corresponding function instance object to be executed can be generated based on the semantic information of the strategy logic flow and the target quantization function. Taking the above strategy logic flow example, the quantitative functions involved in the above quantitative strategy description include at least: the order placement function func_order, the magic nine-turn function func_nine, and the position query function func_posiqty.

[0091] In one embodiment, given a target quantization function, instantiating the target quantization function to generate a function instance object includes the following steps: Step A2051: Obtain the metadata definition of the target quantization function. The metadata definition shall include at least the function name, parameter list and parameter information.

[0092] Step A2052: Extract the parameter values ​​corresponding to the parameter list from the quantization strategy description.

[0093] Specifically, a large model can perform semantic analysis on the quantization strategy description based on preset prompts to obtain the strategy logic flow corresponding to the quantization strategy description. Based on the semantic information of the strategy logic flow, the target quantization function required by the strategy logic flow and the parameter values ​​required by the target quantization function can be determined from a preset quantization function library.

[0094] Taking the strategy logic flow "implementing the buy branch" as an example, the target quantitative functions corresponding to this strategy logic flow include: the order placement function func_order and the magic nine-turn function func_nine; For the order placement function func_order, the parameter list of func_order includes the driver object code, the order direction trd_side, the order quantity qty, and the order quantity unit qty_type. At this time, the parameter descriptions corresponding to each parameter are obtained from the quantitative strategy description and mapped to the parameter values. For example, if the parameter description of the driver object is stock A, it can be mapped to the stock identifier of stock A. If the parameter description of the order direction is "buy", it can be mapped to "BUY". If the parameter description of the order quantity and the order quantity unit is "1 lot", the order quantity can be mapped to "1" and the order quantity unit can be mapped to "LOT".

[0095] Taking the Magic Nine Turns function func_nine as an example, the parameter list of the Magic Nine Turns function func_nine includes the driving object code and the market data unit k_type. At this time, the parameter descriptions corresponding to each parameter are obtained from the quantitative strategy description and mapped to the parameter values. For example, if the parameter description of the driving object is stock A, it can be mapped to the stock identifier of stock A. The parameter description of the market data unit is empty. At this time, the default value "K_DAY" can be obtained from the parameter information of the market data unit k_type and filled in.

[0096] Taking the strategy logic flow "creating a position judgment card" as an example, the target quantitative function corresponding to this strategy logic flow includes: the position query function func_posiqty; the parameter list of the position query function func_posiqty includes the driver object code. At this time, the parameter descriptions corresponding to each parameter are obtained from the quantitative strategy description and mapped to the parameter values. For example, if the parameter description of the driver object is stock A, it can be mapped to the stock identifier of stock A.

[0097] Step A2053: Perform type validation on the extracted parameter values ​​according to the parameter type.

[0098] As mentioned above, the parameter information in the metadata definition of the quantization function includes parameter name, parameter type, parameter default value, parameter value range, and parameter mandatory field. The system can verify the extracted parameter values ​​based on the parameter default value, parameter value range, and parameter mandatory field of each parameter in the metadata definition of the quantization function.

[0099] For example, taking the order placement function func_order under the above strategy logic flow "implementing the buy branch" as an example, it can verify whether the parameter value qty "1" of the order quantity is an integer type, and verify whether the parameter value "BUY" of the order direction is within the enumeration values ​​("BUY" / "SELL") in its metadata definition.

[0100] If the user does not provide the required parameters for the target quantization function (such as code for func_order), the user can be guided to supplement them through a question-and-answer format, or the default values ​​of the parameter information in the metadata definition can be used.

[0101] Step A2054: Encapsulate the validated parameter values ​​into a parameter value object.

[0102] For example, the system encapsulates the validated parameter values ​​into a parameter value object.

[0103] Continuing with the example of the order placement function `func_order` under the "implementing the buy branch" strategy logic flow described above, the parameter value object of the order placement function `func_order` can be represented as follows: {"code":"symbolA","trd_side":"BUY","qty":1,"qty_type":"LOT"}.

[0104] Step A2055: Call the target quantization function and take the parameter value object as input to generate an executable function instance object.

[0105] After obtaining the parameter value object, it can be injected into the function code of the target quantization function to generate an executable function instance object. Furthermore, based on the semantic information of the strategy logic flow corresponding to the quantization strategy description, the parameter value object can be injected into the function code of the target quantization function to generate a function instance object corresponding to the strategy logic flow.

[0106] Taking the order placement function mentioned above as an example, the system calls the Python function of the pre-defined order placement function func_order, passing the parameter value object generated in the previous step as the parameter. This generates a specific, executable function instance object in memory. This instance object encapsulates the specific operation logic and parameters, but it has not yet been packaged into the node control and placed in the flowchart.

[0107] Furthermore, taking the above strategy logic flow as an example, we can see the steps of "implementing the sell branch", "implementing the buy branch" and "creating the holding judgment card". For the strategy logic flow "implementing the buy branch", its target quantification function can be determined to include the order placement function func_order and the magic nine-turn function func_nine, as well as the parameter value object corresponding to the target quantification function; Specifically, the function code and parameter value object of the order placement function `func_order` under this strategy logic flow can be used as parameters to generate a function instance object under this strategy logic flow, which can be represented as the buy action function instance object `buy_order_func`, i.e.: buy_order_func==func_order(code=symbolA,trd_side="BUY",qty=1,qty_type="LOT")"; Similarly, based on the function code and parameter value object of the "magic nine-turn" function `func_nine` under this strategy logic flow, a function instance object under this strategy logic flow can be generated, which can be represented as the "downward nine-turn structure judgment function object `nine_down_func`, i.e.: nine_down_func=func_nine(code= symbolA,k_type="K_DAY")".

[0108] For the strategy logic flow "implementing the sell branch", its target quantization function can be determined to include the order placement function func_order and the magic nine-turn function func_nine, as well as the parameter value object corresponding to the target quantization function; Among them, the function code and parameter value object of the order placement function func_order under the strategy logic flow can be used as parameters to generate a function instance object under the strategy logic flow, which can be represented as the sell action function instance object sell_order_func, that is, "sell_order_func=func_order(code=symbolA,trd_side="SELL",qty=1,qty_type="MAX_SELL")". Similarly, based on the function code and parameter value objects of the magic nine-turn function func_nine under this strategy logic flow, a function instance object under this strategy logic flow can be generated, which can be represented as the upward nine-turn structure judgment function object nine_up_func, that is: "nine_up_func=func_nine(code= symbolA,k_type="K_DAY")".

[0109] For the strategy logic flow "Creating a Position Judgment Card", the function code of the position query function func_posiqty under this strategy logic flow and its parameter value object can be used as parameters to generate a function instance object under this strategy logic flow. This can include the no-position judgment function object no_position_func and the position judgment function object has_position_func, which are represented as follows: no_position_func==func_posiqty(code symbolA) has_position_func==func_posiqty(code=symbolA) Based on the aforementioned metadata-driven function instantiation approach, large models do not need to understand the complete quantization business code. They only need to learn from the limited and clearly structured metadata definitions of quantization functions to select and match target quantization functions, resulting in fast inference speed and high accuracy. The explicit parameter types and constraints in the metadata definitions enable the system to automatically verify and correct the user-input quantization strategy descriptions, reducing strategy failures caused by parameter errors. When adding a new quantization function, only its metadata definition needs to be added and the implementation code registered, without modifying the core inference logic, greatly reducing maintenance costs. The generated function instance objects are standardized memory objects that can be seamlessly encapsulated as card node instances to build a complete strategy flowchart.

[0110] The graph node function set contains global functions, which may include card node functions and connection functions. These functions are used to create start card controls, condition card controls, action card controls, and to connect different card controls. In one embodiment, the card node functions include start card node functions, condition card node functions, and action card node functions.

[0111] In one embodiment, to achieve efficient interaction between graph node functions and a large language model, and to ensure the accuracy of subsequent strategy code generation, this application associates structured metadata definitions with each type of function in the graph node function set. These metadata definitions are stored in a structured format (such as JSON or YAML) and describe the static properties of the corresponding functions, enabling the system or large model to perform function matching, parameter validation, and code generation based on this metadata.

[0112] Specifically, the metadata definitions for various graph node functions include the following: For a conditional card node function, its metadata definition includes at least: a function name (e.g., "graph_conditional_card"), used to uniquely identify the function; a function description, used to summarize the function of the card in natural language (e.g., "create a conditional judgment card"); lvalue function information, used to specify the core quantitative function on which the condition judgment depends (e.g., referencing a function instance for judging position quantity); rvalue function information, used to specify the benchmark value or another reference function for the condition judgment; and comparison operator information, used to specify the comparison rules between the lvalue and the rvalue (e.g., "greater than", "equal to", "IS", etc.). Through the combination of the above information, the complete judgment logic of a conditional card node can be clearly defined and indexed at the metadata level.

[0113] For an action card node function, its metadata definition includes at least: a function name (e.g., "graph_action_card"), used to uniquely identify the function; a function description, used to summarize the function's purpose in natural language (e.g., "create a card to perform a transaction operation"); and action function information, used to specify the specific operation function encapsulated by the card (e.g., referencing an instance of a buy order function). This definition clarifies the core execution logic of the action card.

[0114] For a connection function, its metadata definition includes at least: a function name (e.g., "graph_line"), used to uniquely identify the function; a function description, used to summarize the function of the connection in natural language (e.g., "create a logical connection between two card nodes"); starting card node information, used to specify the starting card of the connection; ending card node information, used to specify the ending card of the connection; connection type, used to distinguish the nature of the connection (e.g., "sequential connection" or "conditional branch connection"); and condition judgment logic, used to clarify the branch conditions corresponding to the connection when the connection is a conditional branch type (e.g., "condition satisfied" branch or "condition not satisfied" branch).

[0115] By predefining the aforementioned structured metadata for various functions in the graph node function set, this application abstracts the construction logic of the policy canvas from hard-coded graph operations and transforms it into a standardized interface that can be dynamically parsed and invoked by the program. On the one hand, the large language model can accurately map the logical elements in the user's natural language description (such as "if...then...otherwise...") to the corresponding card node function and connection function calls based on these semantically rich metadata definitions. On the other hand, when the system executes these function calls, it can automatically verify them based on the parameter types and constraints in the metadata definitions, thereby avoiding logical errors during the code generation stage and significantly improving the accuracy and robustness of the quantization policy generation process.

[0116] The strategy code, in the form of function calls, expresses all the topological information of the strategy flowchart corresponding to the quantization strategy description, and realizes the direct generation of programming code with equivalent structured semantics from the strategy flowchart semantics implicit in the quantization strategy description input by the user in natural language.

[0117] Specifically, the target quantization function is used to implement single data processing. After obtaining the function instance object of the target quantization function, based on the semantic information of the strategy logic flow corresponding to the quantization strategy description, the card node functions required to implement each strategy logic flow and the target quantization functions required by the card node functions are determined. Then, the function instance objects of the target quantization functions required by the card node functions are injected into the card node functions to generate card node instances corresponding to the strategy logic flow. At the same time, based on the strategy logic flow corresponding to the quantization strategy description, the logical order between different card node instances is determined, and connection instances between card node instances are generated. Finally, based on the card node instances and connection entities, the strategy flowchart corresponding to the quantization strategy description and the strategy code corresponding to the strategy flowchart are determined.

[0118] Based on function instance objects and a pre-defined set of graph node functions, executable strategy code is generated, including the following steps: Step B2051: Based on the card node function, encapsulate the function instance object into the corresponding card node instance, where the card node instance includes condition card node instance and action card instance.

[0119] Specifically, based on the semantic information of the strategy logic flow corresponding to the quantization strategy description, the card node functions required for each strategy logic flow and the target quantization functions involved in the card node functions are determined. Then, the function instance objects of the target quantization functions are injected into the card node functions to generate card node instances corresponding to each strategy logic flow.

[0120] Step B2052: Based on the logical relationships in the quantization strategy description, use the connection function to construct connection instances that connect different card node instances.

[0121] Specifically, based on the semantic information of the corresponding strategy logic flow described by the quantization strategy, the connection relationships between each card node instance are determined, and the graph_line function is called to create connection instances between the card node instances. For example, this includes connection instances connecting the "start card node instance" to the "condition card node instance", and connection instances connecting the "condition card node instance" to the "action card node instance". Each connection can be accompanied by conditions (such as the output port identifier of the conditional branch).

[0122] Step B2053: Encapsulate the card node instance and the connection instance into a strategy flowchart instance object to obtain executable strategy code.

[0123] Specifically, the top-level construction function `build_graph` can be called to aggregate all generated card node instances (start card control, condition card control, action card control) and connection instances to form a strategy graph object that can actually run in memory. This object can fully represent the strategy graph semantics implied by the quantized strategy description input in natural language.

[0124] Understandably, the executable strategy code implicitly contains the graph structure information of the strategy flowchart contained in the quantization strategy description. For example, it is composed of card controls and connections, which can clearly show the execution order, conditional branches, action triggers and other control flow semantics of the quantization strategy corresponding to the quantization strategy description. The strategy code acts as a bridge between the graph structure of the quantization strategy description input by natural language and the strategy flowchart, which improves the accuracy of the subsequent generation of the quantization strategy canvas.

[0125] Taking the above strategy logic flow "implementing the sell branch" as an example, based on the semantic information of the strategy logic flow corresponding to the quantitative strategy description, the required card node functions are determined to include condition card node functions and action card node functions. Specifically, a card node instance for judging the upward nine-turn structure can be generated through a conditional card node function. The function instance object of the target quantization function corresponding to this conditional card node function is the upward nine-turn structure judgment function object `nine_up_func`. Then, based on the semantic information of the strategy logic flow, the upward nine-turn structure judgment function object `nine_up_fun` is determined as the l-value function information of the conditional card node function, "UP" is determined as the r-value function information of the conditional card node function, and "IS" is determined as the comparison operator information. The `graph_conditional_card` function is then called to generate the card node instance, thus obtaining the conditional card node instance used to judge the upward nine-turn structure. Specifically, this card node instance can be represented as follows: nine_up_card = graph_conditional_card( card_desc="Judging the Nine Structures of the Magical Nine Turns Rise", card_func_left=nine_up_func, comparator="IS", card_func_right="UP") Specifically, the action card node function generates the sell position, and the corresponding target quantification function's function instance object is the sell action function instance object `sell_order_func`. Then, based on the semantic description of the strategy logic flow, the sell action function instance object `sell_order_func` is determined as the rvalue function information of the action card node function, and "UP" is determined as the rvalue function information of the condition card node function. The `graph_action_card` function is called to generate a card node instance, resulting in the action card instance used for selling the position. Specifically, this card node instance can be represented as follows: sell_action_card = graph_action_card( card_desc="Sold Positions", action=sell_order_func) Taking the above strategy logic flow "creating a position judgment card" as an example, based on the semantic information of the strategy logic flow corresponding to the quantitative strategy description, the required card node functions are determined to include condition card node functions; among them, card node instances for judging the position quantity of the driving object can be generated through the condition card node functions, and the function instance objects of the target quantitative function corresponding to the condition card node function include no position judgment function object no_position_func and position judgment function object has_position_func; Furthermore, based on the semantic information of the strategy logic flow, the no-position judgment function object `no_position_func` is determined as the lvalue function information of the condition card node function, zero value is determined as the rvalue function information of the condition card node function, and "equal" is determined as the comparison operator information. The `graph_conditional_card` function is then called to generate a card node instance, resulting in a condition card node instance used to determine the number of no-position positions. Specifically, this card node instance can be represented as follows: no_position_card = graph_conditional_card( card_desc="No holdings" card_func_left=no_position_func, comparator="EQUAL", card_func_right=0) Similarly, based on the semantic information of the strategy logic flow, the `has_position_func` function object for determining the position is identified as the lvalue function information of the condition card node function, zero is identified as the rvalue function information of the condition card node function, and "GREATER_THAN" is identified as the comparison operator information. The `graph_conditional_card` function is then called to obtain the card node instance, generating a condition card node instance used to determine the number of no open positions. Specifically, this card node instance can be represented as follows: has_position_card = graph_conditional_card( card_desc="Have a holding decision", card_func_left=has_position_func, comparator="GREATER_THAN", card_func_right=0) Once the corresponding card node instances for each strategy logic flow are identified, the connection relationships between the card node instances can be determined based on the semantic information of the corresponding strategy logic flow described in the quantitative strategy description. The graph_line function is then called to create connection instances between the card node instances. Taking the strategy logic flow "implementing the sell branch" as an example, its semantic information is represented as: has_position_car (holding judgment) → nine-stage upward structure judgment → sell holdings. Correspondingly, the connection instances created by calling the graph_line function can be represented as: has_position_to_nine_up_line = graph_line( start=has_position_card, end=nine_up_card, condition="1") Understandably, as in the quantization strategy canvas described above, the quantization strategy is presented in the form of a strategy flowchart. Its storage and organization within the computer employ a graph data structure, recording the logical topological relationships of the quantization strategy in a "node-connection" manner. However, this graph data structure focuses on low-level encoding of connections, and its control flow semantics (such as sequential execution and conditional branches) are implicitly distributed within the topological relationships of nodes and edges, resulting in low semantic density. When a quantization strategy description input by the user in natural language is obtained, and this description is converted into a graph data structure of the corresponding strategy flowchart, the model is forced to simultaneously perform natural language semantic understanding and graph topology generation. This makes it difficult to guarantee the accuracy and robustness of the generated results, especially when dealing with quantization strategies containing complex branching logic. In the above embodiment, the strategy code acts as a crucial intermediate bridge, both inheriting the semantics of the quantization strategy description input in natural language and being compatible with the generation of strategy flowcharts in existing quantization strategy canvases.

[0126] Specifically, the control flow semantics in the strategy flowchart are explicitly encoded through a set of graph node functions using structured function calls and parameter passing. For example, for the strategy logic "If there is a position and a nine-upward structure appears, then sell," which includes conditional branches, the strategy code does not simply describe two nodes and a labeled edge. Instead, it establishes a programmatic association between the condition-satisfied branches (such as the connection condition="1") and specific action card instances through precise function calls. This coded representation extracts the control flow semantics of the strategy flowchart, such as execution order, branch paths, and triggering conditions, from the implicit graph topology, transforming them into structured statements that can be directly used by program parsing and large models. This allows the logical flow contained in the quantitative strategy description input in natural language to be accurately and unambiguously mapped into a code structure.

[0127] Furthermore, unlike graph data structures where nodes merely serve as abstract endpoints in topological relationships, the strategy code in this embodiment encapsulates the parameterized target quantization function instance object into a card node instance through card node functions. This upgrades each graph node from a "graph element" to a "reasonable semantic unit." For example, a "conditional card node instance" is declared in the strategy code as a complete conditional judgment semantic block, explicitly defining its logical input (such as the target quantization function instance object referenced by card_func_left), operation rules (such as comparator="IS"), and expected judgment benchmark (such as card_func_right="UP"). This structured encapsulation allows the strategy code to accurately correspond to each strategy element in the natural language description when moving upwards; and when moving downwards, it provides complete semantic annotations for each node in the graph data structure, rather than just a node identifier.

[0128] In the strategy code of this embodiment, the connection relationships between nodes are visualized as graph construction instructions, rather than reference pointers directly embedded within node objects. When a connection instance generation function (such as `graph_line`) is called, the strategy code expresses the constructive semantics of "establishing a connection between the output port of node A and the input port of node B according to specific conditions." This expression method, on the one hand, tightly binds the connection relationships with the conditional logic, making it easy for large models to be directly generated based on the logical relationships described in natural language; on the other hand, it also maintains a clear one-to-one correspondence between the strategy code and the final graph data structure. In subsequent steps, only these graph construction instructions need to be parsed and executed to accurately construct the corresponding graph data structure and generate the strategy flowchart seen by the user on the visualization interface.

[0129] This application's embodiments introduce structured policy code as an intermediate representation layer, addressing the conversion problem from natural language description to policy flowcharts. Leveraging the powerful parsing and generation capabilities of large language models for structured program code, the quantization policy description input in natural language is converted into structured policy code, achieving accurate capture of complex semantics. Subsequently, based on the policy code, the deterministic mapping relationship between the structured policy code and graph construction instructions ensures the accuracy of the final output policy flowchart in terms of topological structure and control flow semantics. This effectively overcomes the problem of insufficient semantic expression capabilities when large models directly generate graph data structures, significantly improving the accuracy and robustness of automatically generating complex quantization policies.

[0130] In other words, the strategy code uses programming syntax to express the structured semantics of the strategy flowchart, which can be understood as using the syntax structure of a high-level programming language (Python) to equivalently express the flowchart. Specifically, this is reflected in: Structured node semantics: Each process node (i.e., card) is modeled in the code as an independent function call statement, which explicitly declares the node's type and business parameters. For example, the statement creating a condition card explicitly specifies the lvalue function (e.g., "current holding quantity"), comparison operator (e.g., "greater than"), and rvalue (e.g., "0"); the statement creating an action card explicitly specifies the action function (e.g., "buy") and its parameters (e.g., stock code, quantity); the statement creating a start card requires no additional parameters. In this way, each node is upgraded from a graph element to a reasonable semantic unit. Connections are embedded in the control structure: the direction and conditions of edges are no longer implicitly stored in a separate edge list, but are explicitly expressed through variable references and condition labels in the code. For example: first create node A, then node B, and then create a connection from A to B, specifying a condition identifier (such as "condition satisfied" or "condition not satisfied") in the connection. For branching structures, the code creates multiple condition cards and corresponding connections, each connection bound to a different branch condition. This representation makes path selection directly understandable by static analysis or large models. Order and dependencies are expressed through code order: during strategy construction, the order in which nodes and connections are created naturally reflects the dependencies in the strategy flow. Large models can accurately express the flowchart structure by maintaining a reasonable statement order when generating code.

[0131] For example, the generated strategy code logically includes the following: defining the trading target; creating the strategy's starting card; creating condition cards based on strategy branches, where each condition card specifies its left-hand function (such as the position quantity function or the Magic AA function), comparison operator (such as "greater than" or "equal to"), and right-hand value (such as 0 or "UP"); creating action cards: defining the operation to be performed when the condition is met (such as buying one lot or selling all); creating connections between cards: each connection specifies the starting card, ending card, and the branch condition it represents (such as "condition met" or "condition not met"); and aggregating all cards and connections to construct a complete strategy canvas object.

[0132] This application elevates the storage problem of graph structures to a programmatic expression problem of process semantics, enabling large models to leverage their powerful code understanding and generation capabilities to construct quantization strategies, significantly improving generation success rate and logical accuracy.

[0133] In one embodiment, to accurately transform the quantization strategy described in natural language into a subsequently renderable visualization canvas, this application employs a specific programming syntax to express the structured semantics of the strategy flowchart. The core of this syntax lies in explicitly encoding the control flow logic in the flowchart into structured program statements through card node functions and connection functions in a predefined set of graph node functions.

[0134] Optionally, the control flow semantics in the strategy flowchart are explicitly encoded into structured program statements using card node functions and connection functions from a predefined set of graph node functions. Based on the card node functions, function instance objects are encapsulated into card node instances, and corresponding program statements are generated. These program statements explicitly declare the node type of the card node instance, its associated function instance object, and parameter information. Based on the connection functions and the logical relationships in the quantization strategy description, connection instances connecting different card node instances are generated, and corresponding program statements are generated. These program statements explicitly declare the starting card node, ending card node, and branch conditions of the connection instances. The program statements corresponding to the card node functions and connection functions are executed sequentially to generate a strategy flowchart instance object that aggregates card node instances and connection instances, serving as executable strategy code.

[0135] Specifically, the implementation of this programming syntax is as follows: First, the generated function instance objects are encapsulated using card node functions. For example, when a conditional judgment node needs to be created, the system calls the `graph_conditional_card` function, passing in the function instance object representing the specific judgment logic (such as `nine_up_func` used to judge the "nine-up structure") as a parameter. This operation generates a corresponding program statement. This program statement is not a simple function call, but explicitly declares the type of the created card node (such as "conditional card"), the associated core function instance object (such as `nine_up_func`), the comparison operator (such as "IS"), and the comparison benchmark value (such as "UP"), among other key parameter information. Thus, a previously implicit graph node is explicitly declared at the code level as a code entity containing complete business semantics that can be independently parsed.

[0136] Secondly, the graph function is used to construct the logical relationships between nodes. Based on the logical relationships (such as sequential execution, conditional branching, etc.) parsed from the quantization strategy description, the system calls the `graph_line` function. This function generates another piece of code to create connection instances that link different card node instances. This code explicitly declares the starting and ending card node instances of the connection, and most importantly, the branch condition represented by the connection. For example, in a branch structure of "condition satisfied" and "condition not satisfied", the system generates two different connection statements, carrying the labels `condition="1"` and `condition="0"` respectively, clearly defining the path selection rules for program execution.

[0137] Finally, by executing the program statements generated by the card node function and the connection function in sequence, the system aggregates all generated card node instances and connection instances, encapsulating them into a complete strategy flowchart instance object. This object itself is an executable strategy code. The advantage of this representation is that it elevates the semantics of the flowchart from the implicit graph topology to the explicit code structure level. This allows both the large model and the subsequent program parser to directly and unambiguously understand the logical flow of the strategy, thus providing a foundation for the subsequent stable conversion of the strategy code into a visual canvas.

[0138] Through the programming syntax described in this embodiment, this application realizes the "code-based" expression of flowchart logic, ensuring high accuracy and robustness of the transformation link from natural language description to the final visualization canvas.

[0139] Step 206: Generate a visual quantitative strategy canvas of the strategy flowchart based on the executable strategy code.

[0140] Specifically, it includes the following steps: Step 2061: Convert the executable strategy code into a class abstract syntax tree representation at runtime, and generate canvas protocol data for the strategy flowchart based on the class abstract syntax tree representation.

[0141] The class abstract syntax tree representation can include multiple nodes, each of which can be used to map the strategy flowchart to node controls on the quantized strategy canvas. Specifically, the strategy code is transformed into a structured class abstract syntax tree representation. Through the class abstract syntax tree representation, key information such as the card control type, hierarchical relationship, parameters of the card control, and the calling order and connection relationship between card controls corresponding to the card node instances in the strategy code are represented. The control flow that was originally implicit in the strategy code is expressed in a structured way, and the unstructured and ambiguous nature of the code is significantly reduced, thereby greatly reducing the difficulty of parsing the subsequent generation of the strategy flowchart.

[0142] Specifically, the strategy code can be pre-instrumented, and each function call during the execution of the strategy code can be extracted and transformed in real time into a standardized class abstract syntax tree representation containing rich business semantics. Then, for all nodes in the class abstract syntax tree representation, canvas protocol data for drawing strategy flowcharts can be generated based on the node type and attribute information of the node.

[0143] It should be noted that step 205 above aims to solve the automatic conversion of executable policy code into a visualized policy flowchart in the quantitative policy canvas. Since the code itself is unstructured information, it is difficult and unstable to directly extract graph topology information from it. It is also difficult and inaccurate to directly convert the policy code into a policy flowchart with graph data structure. Therefore, the policy code is first converted into a class-Abstract Syntax Tree (AST) representation, and then canvas protocol data for constructing the policy flowchart is generated based on the class-Abstract Syntax Tree representation. The unstructuredness and ambiguity of the policy code are significantly reduced, and the parsing difficulty of the subsequent generation of the policy flowchart is greatly reduced.

[0144] After obtaining the abstract syntax tree (AST) representation, nodes in the AST representation can be converted into canvas protocol data for the policy flowchart based on preset graph generation rules. The graph generation rules record the mapping relationship between various nodes in the AST representation (each node corresponds to a card node instance in the policy code) and their corresponding primitives (nodes and edges) in the policy flowchart. They also convert control structures such as sequential dependencies, conditional branches, and call chains between nodes into visual topological connections and branch paths, while supplementing node attribute information (such as parameters, inputs, and outputs in card node instances). The same AST representation can produce the same canvas protocol output, ensuring the stability and semantic consistency of the policy code to policy flowchart conversion process.

[0145] In one embodiment, step 2061 specifically includes the following steps: Step S20611: In the runtime environment of executing strategy code, instrument the card node instance of the executable strategy code so that card metadata is automatically recorded each time the card node instance of the executable strategy code is called. The card metadata includes card node type, card node parameters, and the calling order between card nodes.

[0146] The meaning of instrumentation here is that when any canvas construction function (such as creating cards or creating connections) is called, in addition to executing its original function, it will automatically record the function name, input parameters, return value, and calling order of this call. After the strategy code has finished executing, a structured intermediate representation similar to an AST is generated based on the recorded information.

[0147] This type of AST data contains all the component information of the canvas: a list of cards (each card's type, associated function, and parameter values) and a list of connections (each connection's starting card identifier, ending card identifier, and branch condition label). AST data is highly structured and unambiguous. That is, by reducing the unstructured and ambiguous nature of the code, the difficulty of subsequent parsing is significantly reduced.

[0148] In other words, the system instrumentes or proxies graph node functions such as `graph_conditional_card` and `graph_action_card` within the Python runtime environment. When these functions are called, metadata such as the type of card node generated, parameters, and call order is automatically recorded.

[0149] For example, this application pre-instruments the canvas construction functions in the Python runtime environment. Specifically, all functions used to create cards, lines, and the canvas (such as creating condition cards, action cards, and lines) are replaced with wrapper functions that include logging functionality. These wrapper functions, while executing the original logic, perform the following operations: generate a globally unique card or line identifier; record the function name, input parameters (after serialization), and returned card / line objects in a sequential list; and record the current call's sequence number within the entire execution flow.

[0150] Step S20612: Run the executable policy code in the runtime environment, and generate a class abstract syntax tree representation corresponding to the program execution path of the policy code based on the card metadata. The class abstract syntax tree includes multiple node metadata.

[0151] In other words, the strategy code generated in step S205 is executed. Because the code calls graph node functions with instrumentation, the execution path dynamically generates a structured intermediate representation, i.e., an AST-like representation. This AST-like representation differs from the traditional static AST; it is closer to the actual execution semantics of the program and records the actual construction relationships between nodes.

[0152] After the strategy code completes execution, a complete time series table is obtained, containing detailed information for each operation. This time series table is then converted into structured AST-like data. This AST-like data contains two main sets: a card set, where each card entry records the card type (start / condition / action), associated function identifier, function parameter values, descriptive text, etc.; and a connection set, where each connection entry records the start card identifier, end card identifier, and condition identifier (e.g., "0" represents a false branch, "1" represents a true branch, or empty represents a sequential connection). Because this type of AST data is obtained during runtime through actual execution, it accurately reflects the true semantics of the code and is unaffected by coding style.

[0153] In this embodiment, by pre-inserting the canvas construction function in the strategy code runtime environment, the type, parameters, and call order of each function call are automatically recorded during the actual execution of the strategy code. Based on the method of obtaining runtime information, the actual execution path of the code and the actual parameter binding results can be captured. The generated class abstract syntax tree representation is closer to the actual execution semantics of the strategy code, effectively avoiding the limitations of static analysis methods that are affected by coding style and dynamic characteristics.

[0154] Furthermore, by introducing an AST-like intermediate representation, this application decouples code generation from canvas rendering. On one hand, the large model only needs to focus on generating policy code that conforms to the specification, without needing to worry about the specific protocol format; on the other hand, the canvas protocol only needs to process structured AST-like data, without needing to process the raw code text. This two-stage transformation significantly improves the stability and maintainability of the system, and can adapt to future additions of function types and card types, thus improving the stability, maintainability, and scalability of the transformation while ensuring semantic consistency.

[0155] Step S20613: Based on the preset graph generation rules, the nodes of the class abstract syntax tree are mapped to the canvas protocol data of the strategy flowchart.

[0156] The system defines a set of deterministic parsing and mapping rules. These rules define a set of explicit transformation rules. For example, for each card entry in the card set, a corresponding protocol message is generated based on its type, and function parameters are filled into the corresponding fields of the message; for each connection entry in the connection set, a LineMessage is generated, containing the starting card ID, ending card ID, and condition fields; finally, all messages are encapsulated in a GraphMessage. This parsing and mapping rule is deterministic, meaning that the same AST-like input always produces the same canvas protocol output, ensuring the stability of the transformation. The system iterates through the AST generated in the previous step, mapping it to canvas protocol data in Protocol Buffers (PB) format agreed upon by the front-end and back-end, based on node type (e.g., "condition card node," "action card node") and connection relationship (e.g., "connection node"). This data describes the coordinates, style, internal function logic, and connection paths between each card on the canvas.

[0157] Step 2062: Render and generate a visual quantization strategy canvas based on the canvas protocol data.

[0158] After receiving the canvas protocol data generated in step S2061, the front-end (client) calls the rendering engine to present a visual, drag-and-drop editable quantization strategy canvas on the user interface. This canvas is semantically equivalent to the user's initial natural language description, and the generated Python code is completely consistent with the canvas display.

[0159] Specifically, after generating the canvas protocol data, the following steps are performed to complete the visualization rendering: Parse the canvas protocol data: deserialize it into an object model that can be manipulated by the front end; Calculate the layout: automatically calculate the position coordinates of each card on the canvas based on the number of cards and the connection relationship (avoiding overlap and keeping the connection clear); Generate graphic elements: draw card nodes of different shapes and colors according to the card type, and draw connections with arrows; Bind interactive events: support card dragging and moving, connection editing, parameter modification, deletion / addition and other operations; Real-time synchronization: the canvas edited by the user can generate new protocol data in reverse, which can be used for saving or generating code.

[0160] Therefore, the intelligent quantization strategy generation method provided in this application embodiment obtains an initial quantization strategy description input by the user in natural language; if the initial quantization strategy description is a quantization strategy description of the target category, keywords are extracted from the initial quantization strategy description; multi-dimensional retrieval is performed based on the keywords to obtain target retrieval information; the target large model is called to generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information; executable strategy code is generated based on the target quantization strategy description, where the strategy code is the program code of the logical flow described in the strategy flowchart corresponding to the target quantization strategy description; and a visual quantization strategy canvas of the strategy flowchart is generated based on the executable strategy code. By acquiring the initial quantitative strategy description input by the user in natural language, and after determining that it is a quantitative strategy description of the target category, keywords are extracted and multi-dimensional searches are performed to obtain target retrieval information such as real-time market data. Then, the target big model is called to integrate the initial description and retrieval information to generate a structured, parameter-clear target quantitative strategy description. Based on this target quantitative strategy description, executable strategy code is generated and finally transformed into a visual quantitative strategy canvas. This achieves accurate understanding and completion of fuzzy and unstructured natural language intent, effectively reducing the description threshold and generation difficulty of quantitative strategies, and improving the accuracy, executability and user experience of strategy generation.

[0161] Figure 4 A schematic diagram of the structure of an intelligent quantization strategy generation device provided in an embodiment of this application is shown.

[0162] like Figure 4 As shown, the intelligent quantization strategy generation device 10 includes: The acquisition module 11 is used to acquire the initial quantization strategy description input by the user in natural language; Extraction module 12 is used to extract keywords from the initial quantization strategy description if the initial quantization strategy description is a quantization strategy description of the target category; The retrieval module 13 is used to perform multi-dimensional retrieval based on the keywords to obtain target retrieval information; The first generation module 14 is used to call the target large model and generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information. The second generation module 15 is used to generate executable strategy code based on the target quantization strategy description, wherein the strategy code is the program code of the logical flow described in the strategy flowchart corresponding to the target quantization strategy description. The third generation module 16 is used to generate a visual quantitative strategy canvas of the strategy flowchart based on the executable strategy code.

[0163] In some embodiments, the first generation module 14 is specifically used for: Obtain optimization suggestions for quantitative strategy descriptions; The target large model is invoked, and the target quantization strategy type and quantization strategy parameters are determined based on the initial quantization strategy description, the target retrieval information, and the optimized prompt words of the quantization strategy description. Based on the preset strategy description template corresponding to the target quantization strategy type and the quantization strategy parameters, a process-oriented description language is generated to obtain the target quantization strategy description.

[0164] In some embodiments, the second generation module 15 is specifically used for: According to the target quantization strategy description, a target quantization function is determined from a preset quantization function library, and the target quantization function is instantiated with parameters to generate a function instance object; Based on the function instance object and the preset graph node function set, executable strategy code is generated.

[0165] In some embodiments, the graph node function set includes card node functions and connection functions; the second generation module 15 is specifically used for: Based on the card node function, the function instance object is encapsulated into a corresponding card node instance, wherein the card node instance includes a condition card instance and an action card instance; Based on the logical relationships in the quantization strategy description, connection instances connecting different card node instances are constructed using connection functions; The card node instance and the connection instance are encapsulated into a strategy graph instance object to obtain executable strategy code.

[0166] In some embodiments, the third generation module 16 is specifically used for: The executable strategy code is converted into a class abstract syntax tree representation at runtime, and the canvas protocol data of the strategy flowchart is generated based on the class abstract syntax tree representation. A visual quantization strategy canvas is generated based on the canvas protocol data rendering.

[0167] In some embodiments, the third generation module 16 is specifically used for: In the runtime environment where the executable strategy code is executed, the card node instance of the executable strategy code is instrumented so that card metadata is automatically recorded each time the card node instance of the executable strategy code is called. The card metadata includes card node type, card node parameters, and the calling order between card nodes. The executable strategy code is run in the runtime environment, and a class abstract syntax tree representation corresponding to the program execution path of the strategy code is generated based on the card metadata. The class abstract syntax tree represents multiple node metadata. Based on preset graph generation rules, the node identifiers of the class abstract syntax tree are mapped to the canvas protocol data of the strategy flowchart.

[0168] It should be understood that the modules or modules described in the intelligent quantization strategy generation device 10 are related to the reference. Figure 2 The steps in the described method correspond accordingly. Therefore, the operations and features described above for the method also apply to the intelligent quantization strategy generation device 10 and its included modules, and will not be repeated here. The intelligent quantization strategy generation device 10 can be pre-implemented in the browser or other security applications of an electronic device, or it can be loaded into the browser or its security applications of an electronic device through download or other means. The corresponding modules in the intelligent quantization strategy generation device 10 can cooperate with the modules in the electronic device to implement the solutions of the embodiments of this application.

[0169] The division of modules or units mentioned in the detailed description above is not mandatory. In fact, according to the embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0170] The following is for reference. Figure 5 , Figure 5 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of this application is shown. like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. RAM 503 also stores various programs and data required for the system's operating instructions. CPU 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0171] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.

[0172] Specifically, according to embodiments of this application, the flowchart above refers to... Figure 2 The described process can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program contains program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined in the system of this application.

[0173] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0174] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operational instructions of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two connected blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified functions or operational instructions, or using a combination of dedicated hardware and computer instructions.

[0175] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including an acquisition module, a determination module, an update module, a matching module, and a recommendation module. The names of these units or modules do not necessarily limit the specific unit or module itself; for example, an acquisition module can also be described as "acquiring virtual resource requirement information input by the user."

[0176] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments, or may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium stores one or more programs that, when used by one or more processors, execute the intelligent quantization strategy generation method described in this application.

[0177] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A method for generating intelligent quantization strategies, characterized in that, include: Obtain the initial quantization strategy description input by the user in natural language; If the initial quantization strategy description is a quantization strategy description for the target category, extract the keywords from the initial quantization strategy description; A multi-dimensional search is performed based on the keywords to obtain the target search information; Invoke the target large model and generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information; Executable strategy code is generated based on the target quantization strategy description, and the strategy code is the program code of the logical flow described in the strategy flowchart corresponding to the target quantization strategy description; A visual quantitative strategy canvas is generated based on the executable strategy code to create the strategy flowchart.

2. The intelligent quantization strategy generation method according to claim 1, characterized in that, The target large model is invoked, and a target quantization strategy description is generated based on the initial quantization strategy description and the target retrieval information, including: Obtain optimization suggestions for quantitative strategy descriptions; The target large model is invoked, and the target quantization strategy type and quantization strategy parameters are determined based on the initial quantization strategy description, the target retrieval information, and the optimized prompt words of the quantization strategy description. Based on the preset strategy description template corresponding to the target quantization strategy type and the quantization strategy parameters, a process-oriented description language is generated to obtain the target quantization strategy description.

3. The intelligent quantization strategy generation method according to claim 1, characterized in that, Based on the target quantization strategy description, executable strategy code is generated, including: According to the target quantization strategy description, a target quantization function is determined from a preset quantization function library, and the target quantization function is instantiated with parameters to generate a function instance object; Based on the function instance object and the preset graph node function set, executable strategy code is generated.

4. The intelligent quantization strategy generation method according to claim 3, characterized in that, The graph node function set includes card node functions and connection functions; the generation of executable strategy code based on the function instance object and the preset graph node function set includes: Based on the card node function, the function instance object is encapsulated into a corresponding card node instance, wherein the card node instance includes a condition card instance and an action card instance; Based on the logical relationships in the quantization strategy description, connection instances connecting different card node instances are constructed using connection functions; The card node instance and the connection instance are encapsulated into a strategy graph instance object to obtain executable strategy code.

5. The intelligent quantization strategy generation method according to claim 1, characterized in that, The process of generating a visual quantitative strategy canvas based on the executable strategy code includes: The executable strategy code is converted into a class abstract syntax tree representation at runtime, and the canvas protocol data of the strategy flowchart is generated based on the class abstract syntax tree representation. A visual quantization strategy canvas is generated based on the canvas protocol data rendering.

6. The intelligent quantization strategy generation method according to claim 5, characterized in that, The executable strategy code is converted into a class abstract syntax tree representation at runtime, and canvas protocol data for the strategy flowchart is generated based on the class abstract syntax tree representation, including: In the runtime environment where the executable strategy code is executed, the card node instance of the executable strategy code is instrumented so that card metadata is automatically recorded each time the card node instance of the executable strategy code is called. The card metadata includes card node type, card node parameters, and the calling order between card nodes. The executable strategy code is run in the runtime environment, and a class abstract syntax tree representation corresponding to the program execution path of the strategy code is generated based on the card metadata. The class abstract syntax tree represents multiple node metadata. Based on preset graph generation rules, the node identifiers of the class abstract syntax tree are mapped to the canvas protocol data of the strategy flowchart.

7. An intelligent quantization strategy generation device, characterized in that, include: The acquisition module is used to acquire the initial quantization strategy description input by the user in natural language; The extraction module is used to extract keywords from the initial quantization strategy description if the initial quantization strategy description is a quantization strategy description of the target category. The retrieval module is used to perform multi-dimensional retrieval based on the keywords to obtain target retrieval information; The first generation module is used to call the target large model and generate a target quantization strategy description based on the initial quantization strategy description and the target retrieval information. The second generation module is used to generate executable strategy code based on the target quantization strategy description, wherein the strategy code is the program code of the logical flow described by the strategy flowchart corresponding to the target quantization strategy description; The third generation module is used to generate a visual quantitative strategy canvas of the strategy flowchart based on the executable strategy code.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the intelligent quantization strategy generation method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the intelligent quantization strategy generation method as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the intelligent quantization strategy generation method as described in any one of claims 1-6.