A user transaction intention intelligent analysis method and system based on natural language processing

CN122760240BActive Publication Date: 2026-10-30BANK OF SHANGHAI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611221223.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-30
Estimated Expiration
2046-08-12

AI Technical Summary

Technical Problem

[0004]然而,现有部分方案在将用户的模糊交易意图逐步转化为可执行量化代码的全链路过程中,存在以下缺陷:对代码内部逻辑一致性的深层校验与结构化修复能力尚显不足

Benefits of technology

通过将初始量化交易代码映射至三维拓扑网格并进行流形网格检测,有助于从拓扑几何层面发现条件分支矛盾、变量作用域冲突或时序逻辑倒置等深层逻辑缺陷,在一定程度上弥补了现有方案主要依赖语法层面检查、不易有效识别代码内部逻辑一致性问题的局限。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122760240B_ABST
    Figure CN122760240B_ABST
Patent Text Reader

Abstract

The application provides a user transaction intention intelligent analysis method and system based on natural language processing, and relates to the technical field of financial transaction data processing.The method comprises the following steps: according to a natural language transaction description text, performing feature fusion through a pre-trained semantic-logic dual-space mapping model to obtain a standardized transaction strategy logic; performing code compilation conversion according to the standardized transaction strategy logic to obtain an initial quantization transaction code; constructing a control logic flow graph according to the initial quantization transaction code, and mapping the control logic flow graph into a three-dimensional topological grid.The application can realize accurate identification and targeted repair of deep logic defects of quantization codes, thereby effectively reducing potential risks of real-time trading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial transaction data processing technology, and in particular to a method and system for intelligently parsing user transaction intent based on natural language processing. Background Technology

[0002] With the integration of fintech and artificial intelligence, more and more ordinary investors hope to transform their trading ideas into automated quantitative trading strategies. In practical applications, users may only be able to describe their vague trading intentions in natural language, such as establishing a position when the short-term moving average crosses above the long-term moving average and stopping the loss when the price falls below the lower Bollinger Band, but they lack the professional programming ability to directly write these into executable computer code.

[0003] Currently, some quantitative trading platforms have begun to incorporate natural language processing (NLP) technology to convert users' text descriptions into quantitative strategy code and then backtest them on historical market data. This approach lowers the barrier to entry for quantitative trading to some extent, providing ordinary users with an initial path from trading ideas to strategy implementation.

[0004] However, some existing solutions have the following shortcomings in the entire process of gradually transforming users' vague trading intentions into executable quantitative code: Their ability to deeply verify and structurally repair the internal logic consistency of the code is still insufficient. Specifically, AI-generated quantitative code may contain deep logical defects such as contradictory conditional branches, conflicting variable scopes, or inverted timing logic. These defects are mostly difficult to effectively identify through conventional syntax checks, and once they enter a live trading environment, they are prone to triggering unexpected abnormal trading behaviors. When backtesting exposes strategy malfunctions, existing systems struggle to accurately pinpoint the specific root cause of logical defects in the code and perform targeted repairs. This may require manual line-by-line checks or a complete system regeneration of the code, resulting in a long trial-and-error cycle and low efficiency in strategy iteration. Summary of the Invention

[0005] This invention provides a method and system for intelligently parsing user trading intentions based on natural language processing, which can accurately identify and target the repair of deep logical defects in quantitative code, thereby effectively reducing potential risks in live trading.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: Firstly, a method for intelligently parsing user transaction intent based on natural language processing, the method comprising: Obtain natural language transaction description text; based on the natural language transaction description text, perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain standardized transaction strategy logic; The code is compiled and converted according to the standardized trading strategy logic to obtain the initial quantitative trading code; A control logic flow graph is constructed based on the initial quantitative trading code, and the control logic flow graph is mapped to a three-dimensional topological mesh. Based on the three-dimensional topological mesh, manifold mesh detection is performed using a pre-trained execution flow-control flow bi-graph comparison model to obtain candidate quantitative trading codes. Preliminary backtesting is performed on the candidate quantitative trading codes to obtain preliminary backtesting results; if the preliminary backtesting results are abnormal, non-manifold mesh repair is performed based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code; A second in-depth backtest is conducted based on the target quantitative trading code to obtain the results; a performance quantitative evaluation is then performed based on the results to obtain a qualified quantitative trading strategy. Based on the qualified quantitative trading strategy, live trading execution instructions are obtained, and the live trading account is controlled to execute automated trading according to the live trading execution instructions.

[0007] Secondly, a user transaction intent intelligent analysis system based on natural language processing includes: The intent parsing module is used to acquire natural language transaction description text, and to perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain standardized transaction strategy logic; The code compilation module is used to compile and convert code according to the standardized trading strategy logic to obtain the initial quantitative trading code. The topology review module is used to construct a control logic flow graph based on the initial quantitative trading code and map it to a three-dimensional topology mesh. It performs manifold mesh detection through a pre-trained execution flow-control flow bi-graph comparison model to obtain candidate quantitative trading codes. The backtesting repair module is used to perform preliminary backtesting based on the candidate quantitative trading code to obtain preliminary backtesting results. If the preliminary backtesting results are abnormal, non-manifold mesh repair is performed based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code. The in-depth evaluation module is used to perform a second in-depth backtest based on the target quantitative trading code to obtain the second in-depth backtest results, and to perform a quantitative performance evaluation based on the second in-depth backtest results to obtain a qualified quantitative trading strategy. The live trading control module is used to obtain live trading execution instructions based on qualified quantitative trading strategies, and to control the live trading account to execute automated trading based on the live trading execution instructions.

[0008] The above-described solution of the present invention has at least the following beneficial effects: By mapping the initial quantitative trading code to a three-dimensional topological grid and performing manifold grid detection, it helps to discover deep logical defects such as contradictory conditional branches, conflicting variable scopes, or inverted temporal logic from the topological geometry level. To a certain extent, this makes up for the limitations of existing solutions that mainly rely on syntax-level checks and are not easy to effectively identify internal logic consistency issues.

[0009] When the initial backtesting reveals that the strategy is not running properly, the abnormal signal is mapped to the defect area of ​​the topology mesh for edge folding or face splitting repair. Then, the code is reconstructed in reverse based on the topological isomorphic mapping relationship of the nodes. This forms a closed loop of processing from anomaly detection to root cause location and then to targeted repair. It is expected to reduce the trial and error cost of manual line-by-line inspection or full code regeneration and improve the overall efficiency of strategy iteration.

[0010] The six-step closed-loop process from intent parsing, code compilation, topology review, backtesting and repair, in-depth evaluation to live trading control, with topology review and backtesting and repair forming a dual verification of detection and repair, ensures that only strategies that pass manifold consistency verification and in-depth backtesting evaluation are pushed to the live trading environment, which helps control potential risks in live trading caused by code logic defects. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating a method for intelligently parsing user transaction intent based on natural language processing, provided by an embodiment of the present invention.

[0012] Figure 2 This is a schematic diagram of a user transaction intent intelligent parsing system based on natural language processing, provided by an embodiment of the present invention.

[0013] Figure 3 This is a schematic diagram of the process of performing dual-space alignment and fusion of multi-dimensional temporal semantic features and logical rule constraint features based on logical mutual exclusion masks and causal temporal masks, provided by an embodiment of the present invention. Detailed Implementation

[0014] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0015] like Figures 1 to 3As shown, embodiments of the present invention propose an intelligent parsing method for user transaction intent based on natural language processing. The pre-trained semantic-logical dual-space mapping model refers to a neural network model that can simultaneously extract temporal semantic features and logical rule constraint features from natural language text and align and fuse the two heterogeneous features. Its output is a standardized transaction strategy logical structure. It adopts a dual-branch parallel encoding architecture, including a temporal semantic encoding branch and a logical rule constraint branch. After each branch independently completes feature extraction, it performs cross-space alignment and fusion through logical mutual exclusion masks and causal temporal masks.

[0016] The temporal semantic encoding branch consists of a word embedding layer, a positional encoding layer, a multi-layer temporal encoder, and a semantic aggregation layer, all sequentially connected. The word embedding layer maps each word in the input text to a dense real-valued vector of fixed dimensions. The positional encoding layer uses an alternating sine-cosine encoding method to superimpose positional vectors at each position, enabling the model to distinguish the order of words. The multi-layer temporal encoder is composed of several stacked encoder layers based on a self-attention mechanism. Each layer contains a multi-head self-attention sublayer and a feedforward fully connected sublayer. Residual connections and layer normalization are used between layers to capture long-distance temporal dependencies across time steps in the text. The semantic aggregation layer uses learnable attention weights to weight and sum the features at each position, outputting a multi-dimensional temporal semantic feature vector.

[0017] The logical rule constraint branch consists of an entity recognition submodule, a state transition graph construction submodule, a causal reachability calculation submodule, and a logical feature encoding submodule, which are sequentially connected. The entity recognition submodule is used to perform named entity recognition on the input natural language transaction description text, extract four types of transaction entities: transaction target entity, transaction condition entity, transaction action entity, and transaction parameter entity, and label the start and end positions and type labels of each entity.

[0018] The state transition graph construction submodule constructs a directed acyclic graph (DAG) of transaction state transitions based on the extracted entities. This DAG uses holding states as nodes and state transition operations triggered by transaction conditions as directed edges. During construction, a depth-first search is used to detect loops; if a closed loop is found, the last added edge is deleted to maintain acyclicity. The causal reachability calculation submodule calculates the shortest directed path length for text entity pairs on the graph as the causal reachability path length. Shorter paths indicate stronger causal relationships between entities. The logical feature encoding submodule encodes the graph's topological structure information and causal reachability path information into logical rule constraint feature vectors using the message passing mechanism of a graph attention network.

[0019] The dual-space alignment and fusion module, placed after the two branches, consists of a mask construction layer, an orthogonal projection layer, a conflict suppression layer, a temporal rearrangement layer, and a residual fusion layer connected in series. The mask construction layer generates a logically mutually exclusive mask based on logical rule constraint features, marking feature dimensions with logically mutually exclusive relationships and causal temporal masks, and calculating the temporal constraint strength of each dimension based on the causal reachable path length. The orthogonal projection layer constructs an orthogonal projection matrix to define the quantification rule constraint space, projecting the dimension-adapted semantic features into this space to obtain compliant semantic projection features. The conflict suppression layer multiplies the compliant semantic projection features element-wise with the logically mutually exclusive mask to set the mutually exclusive dimensions to zero. The temporal rearrangement layer multiplies the suppressed features element-wise with the causal temporal mask to complete temporal weighting. The residual fusion layer adds the temporal alignment features element-wise with the logical rule constraint features to output the standardized trading strategy logic.

[0020] The process of constructing training data is as follows: Raw natural language trading description texts were collected from quantitative trading community forums, brokerage strategy research reports, and trading logs to form a raw text corpus. Professional annotators with quantitative trading programming experience annotated each raw natural language trading description text in three ways: they wrote a corresponding standardized trading strategy logic structure, which includes six fields in a structured attribute format: strategy name, list of trading targets, entry conditions, exit conditions, position management rules, and risk control parameters; they annotated the start and end positions and entity type labels of the trading target entities, trading condition entities, trading action entities, and trading parameter entities in the text; and they drew the corresponding directed acyclic graph of trading state transitions, annotating the trigger condition description text for each directed edge in the graph. The annotated data was then divided into training, validation, and test sets according to a preset ratio, such as 8:1:1.

[0021] During training, the text is input into both the temporal semantic encoding branch and the logical rule constraint branch. In the temporal semantic encoding branch, the text undergoes word embedding, positional encoding, and multi-layer self-attention encoding before being output by the semantic aggregation layer as multi-dimensional temporal semantic features. In the logical rule constraint branch, the text undergoes entity recognition, state transition graph construction, causal reachability calculation, and graph neural network encoding before being output as logical rule constraint features. In the dual-space alignment and fusion module, two types of masks are generated, and orthogonal projection, conflict suppression, and temporal rearrangement are performed sequentially. Residual fusion yields the standardized trading strategy logic.

[0022] The model training employs a multi-task joint loss function, comprising three loss terms: the first loss term is the policy logic reconstruction loss, calculated as the sum of the cross-entropy losses between the six fields in the standardized trading strategy logic output by the model and the labeled ground truth; the second loss term is the entity recognition loss, calculated as the cross-entropy loss between the entity category prediction output by the entity recognition submodule and the labeled ground truth; and the third loss term is the causal reachability loss, calculated as the mean squared error loss between the causal reachability path length predicted by the model and the labeled ground truth. The joint loss is a weighted sum of the above three losses, with weights set according to the importance of each task; for example, the weight of the first loss term is set to 1.0, the weight of the second loss term is set to 0.5, and the weight of the third loss term is set to 0.3.

[0023] Parameter optimization employs a mini-batch stochastic gradient descent strategy, with the batch size dynamically determined based on hardware conditions. The learning rate uses a stepped decay rule based on validation set monitoring: the joint loss of the validation set is continuously monitored. If the validation set loss does not decrease within a first predetermined number of training epochs, the current learning rate is multiplied by a preset first decay factor, typically 0.5. If the loss still does not decrease within a second predetermined number of epochs, it is multiplied again by a preset second decay factor, which is smaller than the first decay factor to accelerate decay; a typical value is 0.1. This process can be triggered multiple times until the learning rate falls below a preset minimum threshold or the validation set loss no longer improves, at which point training terminates, and the model parameters with the lowest validation set loss are retained. The first predetermined number can be 5 training epochs, the second predetermined number can be 10 training epochs, and the preset minimum threshold can be 1×10^6. -6 A random dropout strategy is used during training to reduce overfitting; the typical random dropout rate is between 0.1 and 0.3.

[0024] The execution flow-control flow dual-graph comparison model refers to a neural network model specifically designed to detect the topological consistency between the control logic flow graph and the data execution flow of quantitative trading code. Its input is a pair of graph structures (data execution flow subgraph and control logic flow subgraph), and its output is the temporal topological consistency score between the two graphs. It adopts a dual-channel manifold convolutional coding architecture, which includes a first manifold convolutional channel, a second manifold convolutional channel, and a graph comparison layer.

[0025] The first manifold convolution channel is used to process the data execution flow subgraph. It is constructed with variable definition-use chains as directed edges and basic blocks as nodes, and consists of manifold convolution layers, topological pooling layers, and topological invariant extraction layers connected in series. The manifold convolution layer takes the target node as the center and aggregates the feature vectors of its neighbors in its K-hop neighborhood according to graph distance to obtain a local manifold feature vector. The weighting coefficient is the ratio of 1 to (graph distance + 1), so that the more distant the neighboring node, the smaller its contribution. Here, K is a preset positive integer. In this embodiment, K is 2 in manifold convolution and topological pooling, and K is 1 to 2 in the repair stage. The two are independent parameters. The topological pooling layer merges similar nodes into supernodes according to the similarity of the feature vectors of adjacent nodes to achieve graph coarsening. The topological invariant extraction layer counts the number of nodes, the number of closed loops, and the degree distribution in the local neighborhood of each supernode, and concatenates them into a local topological invariant vector.

[0026] The second manifold convolutional channel is used to process the control logic flow subgraph, which is a directed graph structure built with control flow jump instructions as edges and basic code blocks as nodes. Each edge has a control flow type label, such as sequential execution, conditional jump, unconditional jump, loop return, etc. It is composed of the second manifold convolutional layer, the second topological pooling layer and the second topological invariant extraction layer connected in series. Its internal structure is the same as that of the first manifold convolutional channel, but the parameters of the two channels are independent and not shared.

[0027] The graph alignment layer is used to compare the local topological invariant vectors output by the first and second manifold convolution channels one by one. Specifically, the graph alignment layer first pairs the local topological invariant vector sequences output by the two channels according to the structural position of the nodes in the graph. The pairing rule is: in their respective subgraphs, two local topological invariant vectors with the same topological sorting position of the nodes form a pair.

[0028] For each pair of paired local topological invariant vectors, the feature distance between them is calculated. This feature distance is the average of the sums of the absolute differences between corresponding elements of the two vectors, or the cosine of the angle between the two vectors. The feature distances of all pairs are averaged to obtain the temporal topological consistency score for that pair of subgraphs. The temporal topological consistency score ranges from 0 to 1. A score closer to 1 indicates higher topological consistency between the data execution flow and the control logic flow, meaning that the actual data flow path in the code closely matches the expected path of the control logic. A score closer to 0 indicates significant topological inconsistency between the two flows.

[0029] The training data construction process is as follows: sample code is collected from an open-source quantitative trading code library, and the sample code is automatically transformed using a code mutation tool. The code mutation tool generates mutated code by randomly inserting redundant conditional branches, swapping the execution order of adjacent statements, and modifying the scope of variables, forming positive and negative sample pairs. The original sample code is used as a positive sample, that is, without logical defects, and the mutated code is used as a negative sample, that is, containing logical defects.

[0030] For each sample code, its control logic flow graph and variable definition-usage chain are extracted to construct the corresponding control logic flow subgraph and data execution flow subgraph, forming a pair of training graph samples. Furthermore, each pair of training graph samples is labeled with a logical consistency label: positive samples are labeled 1 (consistent), and negative samples are labeled 0 (inconsistent).

[0031] Each pair of graph samples (control logic flow subgraph and data execution flow subgraph) from the training set is input into the first and second manifold convolution channels of the execution flow-control flow bi-graph alignment model, respectively. Each channel independently performs manifold convolution, topological pooling, and topological invariant extraction operations on the input subgraph, outputting a sequence of local topological invariant vectors. The graph alignment layer then pairs these local topological invariant vector sequences together and calculates the temporal topological consistency score.

[0032] The model training uses binary cross-entropy as the loss function, and the optimization objective is to minimize the difference between the model's predicted temporal topological consistency score and the true logical consistency label. The same gradient descent strategy and learning rate decay rule are used as in the semantic-logic dual-space mapping model training. Training is terminated and the model parameters with the lowest validation set loss are retained when the loss value on the validation set no longer decreases within a predetermined number of consecutive training epochs. A random dropout strategy is also employed during training to enhance the model's generalization ability.

[0033] In this embodiment, it is assumed that the natural language transaction description text input by the user is: when the 5-day moving average crosses above the 20-day moving average, buy 100 shares of target A at the current market price, and sell all shares at the market price when the price falls below the 20-day moving average.

[0034] Step 1: Obtain the natural language transaction description text; based on the natural language transaction description text, perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain the standardized transaction strategy logic.

[0035] The user-input natural language transaction description text is fed into the temporal semantic encoding branch of a pre-trained semantic-logic dual-space mapping model. First, the word embedding layer segments the description text, mapping each word to a dense real-valued vector of dimension D (256 in this embodiment), resulting in a word embedding vector sequence. For example, the text "When the 5-day moving average crosses above the 20-day moving average" is segmented into the word sequence [when, 5-day, moving average, crosses above, 20-day, moving average, time]. Each word is mapped to a 256-dimensional vector, forming a 7-row, 256-column word embedding matrix.

[0036] The positional encoding layer generates a positional encoding vector for each position in the word embedding vector sequence. The positional encoding vector has the same dimension as the word embedding vector, which is 256 dimensions. The generation rule is as follows: for the p-th position in the sequence, the 2i-th dimension of its positional encoding vector is the sine function value of the ratio of p to the power of 10000 to the dimension D, and the (2i+1)-th dimension is the cosine function value of the ratio of p to the power of 10000 to the dimension D, where i ranges from 0 to (D / 2-1).

[0037] The word embedding vector at each position is added element by element to the position encoding vector at the corresponding position to obtain a sequence of word representation vectors with position information.

[0038] The word representation vector sequence with location information is input into a multi-layer temporal encoder. In this embodiment, a 6-layer encoder is stacked. In each layer, a multi-head self-attention operation is first performed. The input vector sequence is projected through multiple different linear projection matrices into three subspaces: query vector, key vector, and value vector. The dimension of each subspace is D divided by the number of attention heads. In this embodiment, the number of attention heads is 8, and the dimension of each subspace is 32. In each attention head, the dot product similarity between the query vector and all key vectors is calculated. The dot product similarity is divided by the square root of the query vector dimension and then normalized by Softmax as a weight. The value vectors are then weighted and summed to obtain the self-attention output of that head.

[0039] The multi-head self-attention outputs are concatenated and restored to D-dimensionality via linear projection. After residual connection with the input vector sequence, layer normalization is performed. The output is then input into a feedforward fully connected sub-layer, subjected to two linear projections and one nonlinear activation, and then residual connection and layer normalization are performed again with the input to obtain the output of the encoder layer.

[0040] Finally, the semantic aggregation layer performs a weighted average aggregation of the feature vectors output from the last encoder layer. The aggregation weights are determined by a learnable attention scoring function, which takes each positional feature vector as input and outputs a scalar score. This score, after Softmax normalization, serves as the aggregation weight for each position. The feature vectors at each position are then summed according to their corresponding weights to obtain a fixed 256-dimensional multi-dimensional temporal semantic feature vector. This feature vector encodes the temporal sequence and semantic association information between transaction conditions, transaction actions, and transaction parameters in the text.

[0041] The same natural language transaction description text is synchronously input into the logical rule constraint branch of the semantic-logical dual-space mapping model. First, the entity recognition submodule performs named entity recognition on the text. This submodule employs a sequence labeling model based on a joint architecture of bidirectional long short-term memory networks and conditional random fields, outputting an entity type label for each word in the input text. The label set includes five categories: transaction target entity labels, transaction condition entity labels, transaction action entity labels, transaction parameter entity labels, and non-entity labels.

[0042] Taking the example text of this embodiment as an example, the entity recognition results are: 5-day moving average, transaction condition entity; cross above, transaction condition entity; 20-day moving average, transaction condition entity; buy, transaction action entity; 100 shares, transaction parameter entity; target A, transaction target entity; fall below, transaction condition entity; 20-day moving average, transaction condition entity; sell, transaction action entity.

[0043] The state transition graph construction submodule builds a directed acyclic graph (DAG) of transaction state transitions based on the extracted entities. Starting with an empty position as the initial node, it traverses the condition-action entity pairs in the text: entry conditions trigger a directed edge from an empty position to a held position, and exit conditions trigger a directed edge from a held position to an empty position. After each edge is added, a depth-first search for cycle detection is performed. If a cycle is found, the last added edge is deleted to ensure acyclicity. In this example, the constructed text results in a DAG of transaction state transitions containing two nodes, "empty position" and "held position," and two directed edges (one leading to "buy," and the other to "sell").

[0044] The causal reachability calculation submodule calculates the causal reachability paths between text entity pairs on the graph, mapping causal entities to starting nodes and result entities to target nodes. A breadth-first search is used to calculate the shortest directed path length; unreachable paths are marked as positive infinity. Path length directly reflects the tightness of the causal relationship between entities. For example, in the sample text, the causal reachability path length between the "upward crossing" condition and the "buy" action is 1 (directly triggered), while the length between it and the "sell" action is 2 (after buying and then selling), thus distinguishing the causal tightness of different condition-action pairs.

[0045] Finally, the logical feature encoding submodule encodes the topology information using the message passing mechanism of the graph attention network: it initializes the feature vector for each node (by one-hot encoding of node type and concatenation of the mean of embedded related entities), and through multiple rounds of message passing, each node calculates the aggregate weight of the features of its neighbors (concatenated with edge features) through the attention mechanism in each round and performs a weighted summation, which is then fused and updated with its own features. After completion, all node features are sequentially concatenated into logical rule constraint features.

[0046] Based on the obtained logical rule constraint features, construct logical mutual exclusion masks and causal timing masks.

[0047] The specific process of constructing a logical mutual exclusion mask is as follows: The logical relationships between the transaction condition entities encoded in the logical rule constraint features are analyzed. Specifically, the logical rule constraint features are input into a two-layer fully connected classification network. The network outputs a mutual exclusion probability matrix between each pair of transaction condition entities. The matrix dimension is the product of the total number of transaction condition entities. The element in the i-th row and j-th column of the matrix represents the probability that the i-th transaction condition entity and the j-th transaction condition entity have a logical mutual exclusion relationship, that is, the probability that the two conditions cannot be logically true at the same time.

[0048] For example, if the text contains two conditions, "buy when the moving average crosses above" and "buy when the moving average crosses below," their mutual exclusion probabilities should be close to 1. Elements in the mutual exclusion probability matrix with probabilities greater than a preset mutual exclusion threshold, such as 0.5, are marked as mutually exclusive pairs. Then, each dimension of the compliance semantic projection feature is associated with a trading condition entity. This association is determined by the meaning of the dimension during orthogonal projection. If a dimension corresponds to any of the mutually exclusive condition pairs, that dimension is marked as 0 in the logical mutual exclusion mask, indicating that the dimension needs to be suppressed; otherwise, it is marked as 1, indicating that the dimension is retained. Finally, a binary vector with the same dimensions as the compliance semantic projection feature is obtained, which is the logical mutual exclusion mask.

[0049] The specific process of constructing a causal temporal mask is as follows: The causal reachability path length information between each transaction condition entity is extracted from the logical rule constraint features. This information has already been obtained in the causal reachability calculation in the previous steps. The shorter the causal reachability path length, the tighter the causal chain between the two entities and the stronger the temporal constraint. For each pair of transaction condition entities, a temporal constraint strength value is defined, which is calculated as the ratio of 1 to (the sum of the causal reachability path length + 1). That is, the shorter the path length, the closer the constraint strength is to 1; the longer the path length, the closer the constraint strength is to 0.

[0050] The temporal constraint strength values ​​of each dimension are arranged in dimensional order according to the compliant semantic projection features. For dimensions without corresponding causal relationships, their temporal constraint strength values ​​are set to 0. The final result is a vector of real numbers with each element taking values ​​between 0 and 1, which is the causal temporal mask.

[0051] After obtaining multi-dimensional temporal semantic features, logical rule constraint features, logical mutual exclusion masks, and causal temporal masks, a dual-space alignment and fusion operation is performed. The specific process is as follows: The logical rule constraint features are reshaped into a matrix with dimensions of M rows and N columns, where M is the dimension of the logical rule constraint feature vector (in this embodiment, M is 128) and N is the dimension of the preset quantization rule constraint space (also 128).

[0052] The matrix is ​​decomposed into an orthogonal triangular matrix by applying orthogonal triangular decomposition, which is a product of an M-row N-column orthogonal matrix Q and an N-row N-column upper triangular matrix R. The orthogonal matrix Q is taken as the orthogonal projection matrix to define the quantitative rule constraint space. The quantitative rule constraint space refers to the N-dimensional linear space spanned by the column vectors of the orthogonal projection matrix as the basis. Each point in this space corresponds to a set of effective trading strategy configurations that satisfy the logical rule constraints.

[0053] A multidimensional temporal semantic feature vector with dimension 256 is mapped to a 128-dimensional feature vector through a linear projection layer to achieve dimension adaptation. The adapted 128-dimensional feature vector is then treated as a row vector and multiplied by an orthogonal projection matrix (128 rows and 128 columns). This involves calculating the dot product between the row vector and each column of the orthogonal projection matrix, resulting in 128 scalar values ​​arranged sequentially. This yields a 128-dimensional projection result vector, where each dimension represents the projection component of the multidimensional temporal semantic feature onto the basis direction in the quantization rule constraint space. This projection result vector is the compliant semantic projection feature.

[0054] The compliance semantic projection feature vector and the logical mutual exclusion mask vector are multiplied element-wise. Specifically, for each position in the vector, the value of the compliance semantic projection feature at that position is multiplied by the value of the logical mutual exclusion mask at that position (0 or 1). If the mask value is 0, the multiplication result is 0, and the feature in that dimension is suppressed; if the mask value is 1, the multiplication result remains unchanged, and the feature in that dimension is preserved. Setting the mutual exclusion dimension to zero yields the mutually exclusive suppressed feature.

[0055] The mutual exclusion suppression feature vector and the causal temporal mask vector are multiplied element-wise. The values ​​of each position of the causal temporal mask are between 0 and 1. After multiplying by the value of the corresponding position of the mutual exclusion suppression feature, if the mask value is close to 1, the causal constraint is strong, and the feature value of that dimension is basically preserved; if the mask value is close to 0, the causal constraint is weak or there is no constraint, and the feature value of that dimension is significantly attenuated.

[0056] Through the above element-wise weighting operation, the dimensions that conform to the causal temporal relationship in the mutual exclusion suppression feature are preserved and strengthened, while the dimensions that do not conform to the causal temporal relationship are weakened, thus obtaining the temporal alignment feature.

[0057] The temporal alignment feature vector and the logical rule constraint feature vector are added element by element. Since the two vectors have the same dimension, both being 128-dimensional, the element values ​​at each corresponding position in the two vectors are summed directly to obtain the fused feature vector.

[0058] The fused feature vector retains both temporal semantic information from the semantic space (after mutual exclusion suppression and temporal rearrangement) and rule constraint information from the logical space. The fused feature vector is input into a two-layer fully connected decoding network, and the decoding output is a standardized policy logic structure.

[0059] The standardized trading strategy logic retains causal reachability path information in a structured attribute format, including the following fields: strategy name (text string), list of trading targets (string array), entry condition group and exit condition group (condition tree structure, each condition node contains condition description, associated trading action and causal path length value), position management rules and risk control parameters (stop-loss ratio, take-profit ratio, maximum drawdown threshold, etc.). This output fully records the parsed trading intent elements and their causal logical relationships, providing deterministic input for subsequent code compilation.

[0060] Step 2: Compile and convert the code according to the standardized trading strategy logic to obtain the initial quantitative trading code.

[0061] The standardized trading strategy logic is analyzed, and a directed graph of the strategy logic is constructed. The output standardized trading strategy logic is parsed field by field. First, each condition node in the entry and exit condition groups of the standardized trading strategy logic is traversed. A logical execution node is created for each condition node. The logical execution node is a vertex in the directed graph of the strategy logic, representing a logical judgment or operation step in the strategy execution process. A corresponding logical execution node is created for each trading action associated with each condition node.

[0062] Based on the causal path lengths between condition nodes and the parent-child relationships in the condition tree, the data flow relationships between each logical execution node are determined. If the logical judgment of condition node B requires the execution result of condition node A as a prerequisite, a data flow edge is established between logical execution node A and logical execution node B. The final constructed policy logic directed graph is a graph structure with logical execution nodes as vertices and data flow edges as directed edges.

[0063] Taking this example, the directed graph of the strategy logic contains the following nodes: get the 5-day moving average value, get the 20-day moving average value, determine if it crosses above, execute a buy, get the current price, get the 20-day moving average value (for exiting), determine if it falls below, execute a sell, and the corresponding data flow edges.

[0064] Furthermore, each logic execution node in the policy logic directed graph is mapped to a pre-defined code abstract syntax tree template node. This template node is a predefined template fragment corresponding to a specific programming language syntax structure, containing slot placeholders for subsequent filling in of specific variable names, expressions, and parameter values. The specific mapping rules are as follows: Data acquisition logic execution nodes, such as retrieving moving average values ​​and current prices, are mapped to abstract syntax tree templates for variable declaration nodes. These templates include variable type declaration slots and initialization expression slots. Condition judgment logic execution nodes, such as judging upward crossovers and judging downward crossovers, are mapped to abstract syntax tree templates for conditional control flow nodes. These templates include conditional expression slots, code block slots for true conditions, and code block slots for false conditions. Trading operation logic execution nodes, such as buy and sell, are mapped to abstract syntax tree templates for function call nodes. These templates include function name slots and parameter list slots.

[0065] After mapping is completed, an initial code skeleton is obtained. The initial code skeleton is a code abstract syntax tree that has not yet been filled with specific variable names and parameter values. Its top level contains a sequence of variable declaration nodes and a sequence of assignment nodes. The slots of each node have not yet been bound to specific variable identifiers and data sources.

[0066] Based on the data flow edges in the directed graph according to the strategy logic, scope binding is performed on the variable declaration and assignment nodes in the initial code skeleton. Scope binding refers to determining the effective visibility scope of each variable, that is, in which locations in the code the variable can be referenced. The scope binding rules are as follows: Traverse each data flow edge. If the edge points from node A to node B, it means that node B needs to reference the calculation result of node A. In this case, the scope of the variable declared in node A is extended to cover the location of node B. If the same variable is referenced in multiple non-overlapping scopes, an independent copy of the variable is created for each non-overlapping scope to avoid cross-contamination of scopes. If the calculation result of a node is referenced in multiple subsequent branch nodes, the variable declaration is hoisted to the outermost common scope of all referencing branches.

[0067] After scope binding is completed, the scope binding code containing control flow nodes is obtained. Compared with the initial code skeleton, each variable declaration node in the scope binding code has its scope marked, and each variable reference node has been bound to a specific declaration node, eliminating potential problems such as undefined variables or overlapping scopes.

[0068] Based on the causal reachability path information retained in the standardized trading strategy logic, conditional branch validation is performed on each control flow node in the scope-bound code. The validation rules are as follows: For each condition judgment node, extract the judgment variables in its condition expression; based on the causal reachability path information, check whether the data source entity corresponding to each judgment variable in the condition expression is reachable on the causal path. If it is not reachable, mark the condition branch as an invalid branch; for each condition judgment node, compare the intersection of the variable reference set in its true and false condition branches with the condition expression judgment variable set. If a branch references a variable unrelated to the condition and that variable is not reachable on the causal path, mark the branch as an unreachable branch.

[0069] For code segments marked as invalid or unreachable branches, a pruning operation is performed, deleting the corresponding abstract syntax tree subtree entirely and removing jump instructions pointing to the deleted branches from the parent node's control flow structure. After pruning, a consistency check is performed on the remaining control flow structure to ensure that each conditional decision node retains at least one reachable branch. If all branches of a conditional decision node have been pruned, the conditional decision node along with its parent node's related references are deleted, and its predecessor and successor nodes are directly connected. After the above verification and pruning, the verified code structure is obtained.

[0070] Two operations are performed on the verified code structure: instantiation of the underlying trading interface and syntax expansion. Instantiation of the underlying trading interface means replacing function call nodes in the verified code structure, such as buy and sell, with the actual application interface function names and parameter lists provided by the target quantitative trading platform. For example, the buy function call node is replaced with the order_buy interface function, and the parameters include the code of the trading target, the order price type, the order quantity, the order type, etc.

[0071] Replace the moving average value acquisition with the corresponding function call from the platform's market data interface. Syntax expansion refers to expanding the validated code structure into a plain text source code file according to the syntax rules of the target programming language. During the expansion process, syntax details such as code indentation, line breaks, and bracket matching are handled to ensure the generated code conforms to the target language's syntax, such as Python. After the above operations, the initial quantitative trading code is generated.

[0072] Step 3: Construct a control logic flow graph based on the initial quantitative trading code, and map the control logic flow graph to a three-dimensional topological mesh; based on the three-dimensional topological mesh, perform manifold mesh detection through a pre-trained execution flow-control flow bi-graph comparison model to obtain candidate quantitative trading codes.

[0073] Static code analysis is performed on the output initial quantitative trading code. First, the code is divided into basic blocks, which are continuous sequential execution statements. Only the first statement is the entry point, i.e., the target of the control flow jump, and only the last statement is the exit point, i.e., the starting point of the control flow jump. There are no control flow jump instructions in between.

[0074] The basic block division adopts the standard predecessor-successor analysis method: scan all code statements, and take the first statement of the code as the starting position of the first basic block; start scanning from the starting position and scan backward. When a control flow jump instruction is encountered, such as a conditional statement, loop statement, function call return statement, etc., the current basic block is marked as ending, and the next statement starts a new basic block; at the same time, the jump target of each basic block is recorded, and the jump target is used as the starting position of the new basic block.

[0075] Extract all variable definition and usage statements from the code, and establish a variable definition-usage chain. This chain means that for each statement in the code where a variable is assigned a value (definition point), record in which subsequent statements that the variable is accessed (usage point), establishing a data dependency chain between the definition point and the usage point. For example, if the first line of code defines variable S and assigns it the value of a moving average line, and the tenth line references the value of variable S in a conditional statement, then a definition-usage chain is established between the first line (definition point) and the tenth line (usage point).

[0076] Using basic code blocks as logical nodes (referring to vertices in the control logic flow graph, where each vertex represents a basic code block), control flow jump instructions as directed edges, and variable definition-use chains as directed edges for data dependencies, the control logic flow graph is constructed.

[0077] Directed edges for control flow point from the source block to the target block, and are labeled with the jump type, such as true condition jump, false condition jump, or no condition jump. Directed edges for data dependency point from the block containing the defined variable to the block using the variable, and are labeled with the variable name. Both types of edges coexist in the control logic flow graph, forming a complete graph representation that includes both control flow and data flow information.

[0078] For each logic node in the control logic flow graph, extract features in three dimensions, which correspond to the three coordinate axes in three-dimensional space.

[0079] The first dimension, execution timing features, is mapped to the horizontal coordinate in three-dimensional space. Execution timing features reflect the sequential order of each logical node during code execution. The extraction method is as follows: A topological sort is performed on the control logic flow graph. Starting from the entry node, all nodes are traversed according to the direction of the directed edges of the control flow, and an incrementing timing number is assigned to each visited node. Specifically, the current timing counter is initialized to 1; the entry node is visited, a timing number of 1 is assigned, and the timing counter is incremented by 1; all successor nodes of the entry node are visited in breadth-first order, and for each successor node that has not been assigned a timing number, the current timing counter value is assigned as its timing number, and the timing counter is incremented by 1; this process is repeated until all nodes are assigned timing numbers. The timing number of each node is used as its execution timing feature, normalized to the interval of 0 to 100, and then mapped to a horizontal coordinate value in three-dimensional space. The normalization rule is that the timing number of each node is divided by the maximum timing number and then multiplied by 100.

[0080] The second dimension, logical nesting depth, is mapped to the vertical coordinate in three-dimensional space. Logical nesting depth reflects the hierarchy of each logical node within the code nesting structure. The extraction method is as follows: On the abstract syntax tree of the code, the depth of the code segment corresponding to each basic block from the root node of the syntax tree is calculated. Specifically, starting from the root node of the syntax tree (depth 0), the code is traversed downwards along the parent-child node relationship, with the depth incremented by 1 for each level of child nodes entered. The minimum syntax tree depth of the statements in each basic block is taken as the logical nesting depth of that basic block. For example, a basic block located at the top level of a function (without any nesting) has a logical nesting depth of 1; a basic block located within a conditional branch has a logical nesting depth of 2; and a basic block located within a conditional branch nested within a loop has a logical nesting depth of 3.

[0081] After normalizing the logical nesting depth of each node to the range of 0 to 100, it is mapped to the vertical coordinate value in three-dimensional space. The normalization rule is to divide the nesting depth of each node by the maximum nesting depth and then multiply by 100.

[0082] The third dimension, the variable scope hierarchy feature, is mapped to a vertical coordinate in three-dimensional space. The variable scope hierarchy feature reflects the scope range of variables within each logical node. The extraction method is as follows: For each logic node in the control logic flow graph, count all variables defined or used within that node, find the scope of each variable, i.e., the number of basic code blocks that the variable crosses from its definition point to its last use point, and take the median of the scope of all variables as the variable scope hierarchy feature of that node.

[0083] For example, if a basic block defines a temporary variable that is only used in the next 3 basic blocks and a global variable that spans 10 basic blocks, then the variable scope spans [3, 10] and the median is 6.5. The median of the variable scope hierarchy for each node is normalized to the range of 0 to 100 and then mapped to a vertical coordinate value in three-dimensional space. The normalization rule is to divide the median of each node by the largest median among all nodes and then multiply by 100.

[0084] Through the above three-dimensional mapping, each logic node in the control logic flow graph obtains a target space coordinate consisting of horizontal, vertical and vertical coordinates, and the control logic flow graph is transformed into a set of discrete points in three-dimensional space.

[0085] After obtaining the target spatial coordinates of each logical node, grid edges are generated by connecting the logical nodes with target spatial coordinates based on the control flow directed edges and data dependency directed edges in the control logic flow graph. A grid edge is a line segment in three-dimensional space connecting two logical nodes. Each grid edge corresponds to either a control flow directed edge or a data dependency directed edge in the control logic flow graph, and the two endpoints of the edge represent the coordinate positions of the two logical nodes in three-dimensional space. Grid edges are divided into two categories: control flow grid edges (corresponding to control flow directed edges) and data dependency grid edges (corresponding to data dependency directed edges), distinguished by different labels.

[0086] Triangular patches are constructed based on adjacent mesh edges and logical nodes. A triangular patch is a triangular planar region formed by three mesh edges connected end-to-end. The construction rules are as follows: For any three logical nodes A, B, and C in the control logic flow graph, if every pair of them is connected by a grid edge (i.e., edges AB, BC, and CA all exist), then construct a triangular facet using these three nodes as vertices and the three grid edges as boundaries. The constraints are: Directed edges of control flow and directed edges of data dependencies in the control logic flow graph are originally directed edges, but their directions are ignored when constructing the triangular facet; only undirected connections are considered. Each triangular facet must be a simple triangle, where the three edges do not intersect and the three vertices are not collinear. If the three vertices are collinear, the triangular facet is discarded.

[0087] Traverse all possible combinations of three nodes in the control logic flow graph and construct triangular faces one by one according to the rules described above. After construction, a three-dimensional topological mesh is formed by all logical nodes (as vertices), all mesh edges (as edges), and all triangular faces (as faces). The three-dimensional topological mesh is a two-dimensional manifold mesh structure embedded in three-dimensional space, where each logical node corresponds to a vertex in the mesh, each control flow or data dependency corresponds to an edge in the mesh, and every three logical nodes that are interconnected form a triangular face in the mesh.

[0088] The 3D topological mesh fully preserves the control flow topology and data flow topology of the code and presents them intuitively in a geometric form.

[0089] The obtained 3D topological mesh is parsed to separate data-dependent edges and control-dependent edges from its mesh edges. Specifically, all mesh edges in the 3D topological mesh are traversed, and the label type of each mesh edge is checked: mesh edges labeled as data-dependent mesh edges belong to the data-dependent edge set, and mesh edges labeled as control-flow mesh edges belong to the control-dependent edge set.

[0090] A data execution flow subgraph is constructed based on a set of data dependency edges. This subgraph is a graph structure built using logical nodes in a 3D topological mesh as nodes and directed edges from the data dependency mesh as edges. The construction rule is as follows: for each data dependency mesh edge in the set, a directed edge is created in the data execution flow subgraph from the node where the variable is defined to the node where the variable is used, ensuring that the subgraph reflects the data flow path from the definition point to the usage point in the code. Each node in the data execution flow subgraph is accompanied by its original 3D spatial coordinates and a node type label, i.e., the basic block type, such as sequential execution block, conditional block, loop block, etc.

[0091] A control logic flow subgraph is constructed based on a set of control dependency edges. This subgraph is a graph structure built using logical nodes in a 3D topological mesh as nodes and directed edges in the control flow mesh as edges. The construction rule is as follows: for each control flow mesh edge in the control dependency edge set, a directed edge is created in the control logic flow subgraph from the jump source node to the jump target node, so that the control logic flow subgraph reflects the jump logic of the control flow during code execution. Each node in the control logic flow subgraph also includes its original 3D spatial coordinates and node type label.

[0092] The constructed data execution flow subgraph and control logic flow subgraph are input into a pre-trained execution flow-control flow bi-graph alignment model. The data execution flow subgraph enters the first manifold convolution channel, and the control logic flow subgraph enters the second manifold convolution channel.

[0093] The execution process of manifold convolution is as follows: For the target node, perform a K-hop neighborhood expansion along the directed edge direction, where K is a preset positive integer. Aggregate the feature vectors of all neighboring nodes within the neighborhood using graph distance weighting, with the weighting coefficient decreasing as the graph distance increases. Finally, sum the weighted feature vectors of all neighbors to obtain the local manifold feature vector of the node. This operation is performed on each node in the graph.

[0094] The first topological pooling layer performs topological clustering downsampling on the manifold convolutional data using a subgraph. The clustering operation is as follows: All unmerged nodes in the graph are considered as a candidate node set. A node is randomly selected from this set as a clustering seed. The cosine similarity between the seed node and the local manifold feature vectors of all its K-hop neighbors is calculated. Neighbors with a cosine similarity higher than a preset clustering threshold (e.g., 0.7) are merged with the seed node into a single supernode. The feature vector of the merged supernode is the average of the feature vectors of the merged nodes, and the supernode inherits all the connectivity relationships of the merged nodes in the graph. Merged nodes are then removed from the candidate set. This process is repeated until the candidate set is empty, meaning all nodes have been merged or are retained as isolated nodes. After clustering, a coarser execution flow subgraph with a reduced number of nodes is obtained.

[0095] Subsequently, the first topological invariant extraction layer extracts local topological invariants for each supernode in the coarsened graph: the number of nodes, the number of closed loops (calculated through the algebraic relationship between multipath count and the number of edges and nodes), and the degree distribution (mean and variance of in-degree and out-degree) are counted in the K-hop neighborhood subgraph of each supernode, and then concatenated into a local topological invariant vector.

[0096] The second channel performs the same manifold convolution, topological pooling, and topological invariant extraction process (parameter-independent) on the control logic flow subgraph to obtain the corresponding local topological invariant vector sequence.

[0097] Finally, the graph alignment layer pairs the local topological invariant vectors output from the two channels according to the node topological sorting position. For each pair of vectors, the absolute values ​​of the differences between corresponding elements are summed and divided by the number of elements to obtain the mean absolute difference. Then, the feature distance is obtained by raising the power of e to the base and the negative mean absolute difference as the exponent. The average of all paired feature distances is used to obtain the temporal topological consistency score, which takes a value between 0 and 1.

[0098] In a 3D topological mesh, the number of adjacent triangular faces for each mesh edge is counted: An adjacency list is constructed with the mesh edge identifier as the key and the list of adjacent faces as the value. All triangular faces are iterated through, and each face is appended to the list of its three edges. The length of each edge list after the iteration is complete is the number of adjacent faces. In a standard 2D manifold mesh, an internal edge is shared by exactly two faces. If the number of adjacent faces for an edge is greater than two, then the local region exhibits a non-manifold structure, and the same control flow or data dependency is given multiple inconsistent meanings.

[0099] Based on the obtained temporal topological consistency score and the obtained statistical characteristics of adjacent patches, non-manifold defects are determined. The determination rule includes two independent conditions; if either condition is met, the 3D topological mesh is determined to have a logical conflict.

[0100] The first criterion for determining temporal topology consistency score is as follows: The preset consistency threshold is a discrimination boundary calibrated experimentally, and its calibration process is as follows: Collect several quantized code samples known to contain logical defects and several quantized code samples known to be logically correct. Calculate the temporal topology consistency score for each sample. Statistically analyze the distribution of scores for the two types of samples. Take the score that minimizes the sum of the false positive rate of logically defective samples and the false negative rate of logically correct samples as the consistency threshold.

[0101] The typical value of the consistency threshold, as determined by calibration, is between 0.6 and 0.8. If the temporal topology consistency score calculated in step 3.5 is lower than this consistency threshold, it is determined that there is a logical conflict in the three-dimensional topology mesh. This means that there is a significant topological difference between the data execution flow (how the data actually flows) and the control logic flow (how the data should logically flow) in the code. There may be deep-seated defects in the code, such as incorrect variable usage order, missing data dependencies, or logical contradictions in conditional branches.

[0102] The second criterion is the determination of the number of adjacent faces: the preset face threshold is 2, which is the maximum number of adjacent faces of an internal edge in a standard manifold mesh. If the number of adjacent triangular faces of any mesh edge is greater than 2, it is determined that there is a non-manifold defect in the local area of ​​the 3D topological mesh. This means that there is a ambiguity in the code control flow or data dependency relationship corresponding to the mesh edge, that is, the same control flow or data dependency relationship is given three or more different meanings, and the logic of the code at this time is inconsistent.

[0103] If any of the above judgment conditions are met, a logical conflict interception instruction is generated. This instruction is a structure containing a conflict type field (valued as temporal topology inconsistency or non-manifold structure); a conflict location information field (recording the identifier of the triggering mesh edge or supernode in the 3D topological mesh); and a conflict severity field (classified as low, medium, or high based on the degree to which the score deviates from the threshold or the number of adjacent faces exceeds the threshold). The logical conflict interception instruction is then passed to step 4. Upon receiving the instruction, if a logical conflict interception instruction exists, the non-manifold defect area is directly located using the conflict location information in the instruction. The initial backtesting is skipped, and the non-manifold mesh repair operation described in the following steps is executed directly. After repair, the obtained target quantitative trading code undergoes a supplementary initial backtest verification. If no interception instruction exists, the initial backtest is executed according to the normal procedure.

[0104] If neither of the above two judgment conditions is met—that is, the sequential topology consistency score is not lower than the preset consistency threshold, and there is no grid edge in the three-dimensional topology mesh with more than 2 adjacent triangular faces—then no logical conflict interception instruction is generated. In this case, the initial quantitative trading code output in step 2 is directly used as the candidate quantitative trading code and enters the preliminary backtesting stage in step 4.

[0105] Step 4: Perform preliminary backtesting based on the candidate quantitative trading codes to obtain preliminary backtesting results; if the preliminary backtesting results are abnormal, perform non-manifold mesh repair based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code.

[0106] Step 4, after receiving the output from Step 3, first checks for any logical conflict interception instructions. If a logical conflict interception instruction exists, the preliminary backtesting step is skipped. The conflict location information in the interception instruction is used as the basis for locating the non-manifold defect area, and the process directly proceeds to the following steps to perform the non-manifold grid repair operation. After the repair is completed, a preliminary backtesting verification is performed on the obtained target quantitative trading code. After successful verification, the process proceeds to Step 5. If no interception instruction exists, the following preliminary backtesting process is executed.

[0107] Candidate quantitative trading codes are integrated into a pre-set historical market database for initial backtesting. The database stores the opening price, highest price, lowest price, closing price, and volume of each candlestick in chronological order. The backtesting engine progresses candlestick by candlestick: at each step, the market data processing function is called to update the technical indicator values, and then the strategy judgment function is called to execute the logical judgment; if a trading signal is returned, the timestamp, trading direction, order price, quantity, and signal source node are recorded; if a runtime error occurs in the code (undefined variable, division by zero, array out of bounds, etc.), the error information is written to the runtime error log. After traversing all market data records, preliminary backtesting results are generated.

[0108] The initial backtesting results are then subjected to anomaly detection. The criteria for anomaly detection fall into two categories: The first is runtime anomalies, where at least one error record exists in the runtime error log, indicating a runtime logic error beyond the syntax level in the candidate quantitative trading code. The second is signal anomalies, such as conflicting buy / sell signals with the same timestamp, frequent directional reversals between adjacent candlesticks, or the total number of signals exceeding three times the standard deviation of the average signal generation frequency of the strategy over the same historical interval. If the runtime error log is empty and no signal anomaly detection pattern is found, the candidate code is directly used as the target quantitative trading code, and repair is skipped; otherwise, it is determined to be an anomaly, and the timestamp and variable identifier of the anomaly signal are extracted.

[0109] The extracted timestamps and variable identifiers are mapped to the corresponding logical nodes in the 3D topological mesh. The mapping rules are as follows: The timestamp corresponds to the execution timing characteristics. In the previous steps, each logical node has been mapped to the horizontal coordinate of the three-dimensional space according to its execution timing characteristics. Therefore, the logical node corresponding to the timing number closest to the abnormal timestamp is taken as the candidate node. The variable identifier corresponds to the directed edge of data dependency. In the control logic flow graph, the starting node of the directed edge of data dependency labeled by the variable identifier is the logical node that defines the variable and the ending node. That is, the logical node that uses the variable is a related node.

[0110] The intersection of the timestamp candidate node and the variable-related node is used as the localization result. The local area pointed to by this localization result in the three-dimensional topological mesh is the non-manifold defect region. The non-manifold defect region is a local sub-mesh in the three-dimensional topological mesh where there is a topological defect. This sub-mesh contains all the mesh edges and triangular faces in the located logical node and its K-hop neighborhood (K is 1 to 2).

[0111] Topological defect type identification is performed on the located non-manifold defect region. All mesh edges and triangular faces within the non-manifold defect region are traversed, and the following checks are performed: Mesh Self-Intersection Detection: Checks if two non-adjacent triangular faces intersect in 3D space, i.e., the interior regions of one triangular facet intersect with the interior regions of another triangular facet. If this occurs, it is marked as a self-intersection defect. Non-Manifold Edge Detection: Counts the number of adjacent triangular faces for each mesh edge. If a mesh edge has more than 2 adjacent triangular faces, it is marked as a non-manifold edge defect. Isolated Vertex Detection: Checks if a logical node has 0 adjacent triangular faces, i.e., the node does not participate in any triangular facets. If this occurs, it is marked as an isolated vertex defect. Degenerate Facet Detection: Checks if there are triangular faces with zero area, i.e., three vertices are collinear or two vertices coincide. If this occurs, it is marked as a degenerate facet defect.

[0112] Based on the identified topological defect type, perform the corresponding repair operation.

[0113] If the defect type is a self-intersecting defect or a non-manifold edge defect, perform an edge folding operation. This operation involves shrinking a target edge in the 3D topological mesh into a single point, thereby eliminating the non-manifold structure caused by that edge. The operation steps are as follows: First, select the target mesh edge to be folded. This edge must satisfy the condition that the number of adjacent triangular faces is greater than 2 or that it is an edge marked as a self-crossing defect region.

[0114] Calculate the midpoint of the coordinates of the two endpoints of the edge and use it as the folding target point; replace the coordinates of the corresponding vertices in all triangular patches in the 3D topological mesh that contain any endpoint of the edge with the coordinates of the folding target point, and at the same time, redirect all mesh edges pointing to the two endpoints of the folded edge to the folding target point.

[0115] During the redirection process, if two or three vertices of a triangle overlap after coordinate replacement, the degenerate triangle is deleted. Finally, the node merging mapping corresponding to the edge folding operation is recorded, that is, which new logical node is merged into the two original logical nodes that were folded.

[0116] If the defect type is an isolated vertex defect, perform a face splitting operation. This operation involves splitting a triangular facet adjacent to the isolated vertex in the 3D topological mesh into multiple smaller triangular facets, thus incorporating the isolated vertex into these facets and eliminating its isolation. The operation steps are as follows: First, determine the triangular facet closest to the isolated vertex in Euclidean distance as the facet to be split; then connect the three vertices of the triangular facet to be split to the isolated vertex to form three new mesh edges; further, replace the original triangular facet with these three new triangular facets and update the three-edge-facet adjacency list; finally, record the node splitting mapping corresponding to the face splitting operation, that is, the change in the connection relationship between the three vertices of the original triangular facet and the newly added isolated vertex in the topological structure.

[0117] After the repair operation is completed, the repaired area is locally remeshed. Centered on the folded target point or the newly added vertex, the triangular facet construction rules of the previous steps are re-executed in its local neighborhood to reconstruct the triangular facet connectivity of the local area, ensuring that the repaired local area is restored to a standard two-dimensional manifold structure. The repaired three-dimensional topological mesh is called the target topological mesh.

[0118] Based on the recorded node merging or splitting mappings, calculate the node topological isomorphism mapping relationship between the target topological mesh and the original 3D topological mesh, i.e., the mapping function from the original node set to the target node set, ensuring the consistency of the connection relationships between nodes before and after mapping. The calculation process is as follows: If the repair operation is edge folding (node ​​merging), then the node topological isomorphism mapping is a many-to-one mapping, which maps multiple original nodes to be merged to the same target node; for nodes that do not participate in the repair, the mapping is an identity mapping, that is, each node is mapped to itself.

[0119] If the repair operation is a face split, the node topological isomorphism mapping records the new connections between the original isolated vertices and the vertices of the split face after repair, i.e., the topological associations established by the three newly generated mesh edges; the original face vertices are mapped to themselves, and the identifiers of isolated vertices in the target mesh remain unchanged. By traversing all repair operation records, a complete node topological isomorphism mapping table is constructed, which uses the node identifiers of the original 3D topological mesh as keys and the corresponding node identifiers (or a list of node identifiers) in the target topological mesh as values.

[0120] Based on the obtained node topology isomorphism mapping, the control flow jump logic and variable scope in the candidate quantitative trading code are reverse-reconstructed to generate the target quantitative trading code. The specific operation is divided into two levels: Control flow jump logic refactoring. During many-to-one merging, the basic blocks that were originally executed sequentially or had mutually exclusive branches are merged into a single sequential basic block according to the execution order, the inter-block jump instructions are deleted, and logically equivalent conditional branch redirection references are checked and deleted; during one-to-many splitting, new basic blocks and necessary jump instructions are inserted at the corresponding positions.

[0121] Variable scope reconstruction. Based on the node topology isomorphism mapping relationship, recalculate the variable scope characteristics of each logical node after merging or splitting (refer to the method in the previous steps), and then adjust the variable declaration position and variable reference relationship in the candidate quantitative trading code according to the new variable scope characteristics.

[0122] For node merging: If each merged node defines a variable with the same name, it will be declared as a single variable in the merged code block, and all subsequent references to that variable will be checked to ensure they correctly point to the merged declaration. For node splitting: If a variable is referenced in multiple split nodes, an independent copy of the variable will be created for each new node, and the references to the variable in each node will be updated to point to the corresponding local copy.

[0123] After completing the above two levels of refactoring, the refactored code undergoes syntax correctness verification. A syntax tree is parsed using the target programming language's parser to check for syntax errors. If the syntax tree parsing is successful, it indicates that the refactoring operation did not introduce any new syntax errors. The code that passes the syntax verification is then used as the target quantitative trading code.

[0124] Step 5: Perform a second deep backtest based on the target quantitative trading code to obtain the second deep backtest results; perform a performance quantitative evaluation based on the second deep backtest results to obtain a qualified quantitative trading strategy.

[0125] Backtesting based on multi-volatility interval slicing using volatility clustering. First, all market records in a pre-defined historical market database are sliced ​​into multiple volatility intervals according to pre-defined volatility clustering rules. The slices exhibit different time spans depending on the volatility interval. The specific execution process of the volatility clustering rules is as follows: Historical market data is aggregated into daily candlestick charts, and the logarithmic return is calculated daily, which is the natural logarithm of the ratio of the closing price of the current day to the closing price of the previous trading day. The sample standard deviation of the returns within the window is calculated as the volatility value by sliding the window daily with a preset window length, and the volatility series is obtained by arranging them in chronological order.

[0126] The volatility series is divided into three volatility ranges—low, medium, and high—according to their values ​​from smallest to largest. Consecutive trading days belonging to the same range are grouped into market slices. Each slice is a set of market records corresponding to a consecutive segment of trading days, labeled with the corresponding volatility. Slice lengths are kept below a preset minimum; for example, slices of 10 trading days are merged with adjacent slices to ensure statistical significance. This results in multiple market slices.

[0127] The target quantitative trading code is run in each of the multiple market data slices to obtain a secondary deep backtesting result containing the trading records of each market data slice. The secondary deep backtesting result is a set of trading records organized by market data slice. Each trading record contains a slice identifier, volatility label, trading timestamp, trading direction, transaction price, transaction quantity, trading profit / loss (in monetary terms), and position status fields.

[0128] Extract the net asset value curve for each market segment, with time as the horizontal axis and daily account net value as the vertical axis. The daily net value is the initial capital plus the accumulated realized profit and loss plus the floating profit and loss of the holding position, as well as the transaction profit and loss sequence, that is, the sequence of profit and loss amounts of each transaction arranged in chronological order.

[0129] For the net asset value curve, calculate the characteristics in two dimensions: The first dimension is the drawdown depth characteristic. On the equity curve, for each trading day, the highest historical net asset value (NAV) before that day (including that day) is found, and the ratio of the difference between the current day's NAV and the historical highest NAV to the historical highest NAV is calculated as the drawdown ratio for that day. Over the entire NAV curve period, the maximum drawdown ratio among all trading days is taken to obtain the maximum drawdown rate. The maximum drawdown rate reflects the maximum proportion of capital loss that the strategy may suffer during the historical drawdown period.

[0130] The average drawdown rate is obtained by taking the average drawdown percentage of all trading days. The maximum drawdown rate and the average drawdown rate are combined to form the drawdown depth feature.

[0131] The second dimension is the recovery time characteristic. On the net asset value (NAV) curve, whenever a drawdown occurs—that is, the NAV begins to decline from its peak—the start date of the drawdown is recorded. The NAV is then continuously tracked until it returns to the peak level at the start of the drawdown, and the recovery date is recorded. The number of trading days between the recovery date and the start date is the recovery time of that drawdown. For all drawdown events on the NAV curve, the maximum and average recovery times are calculated and combined to form the recovery time characteristic.

[0132] For the trading profit and loss sequence, calculate the features in two dimensions, as follows: The third dimension is the skewness characteristic. The skewness characteristic reflects the symmetry of the trading profit and loss distribution. It is calculated as follows: take the mean of all profit and loss values ​​in the trading profit and loss sequence; for each profit and loss value in the profit and loss sequence, take the difference between the value and the mean, calculate the cube of the difference, sum the cubed deviations of all profit and loss values, and divide by the length of the profit and loss sequence to obtain the third central moment.

[0133] Take the cube of the sample standard deviation of the profit and loss sequence; divide the third central moment by the cube of the sample standard deviation to obtain the skewness value. A skewness value greater than 0 indicates that the profit and loss distribution is right-skewed, with more profitable trades than losing trades, but there may be extreme profits; a skewness value less than 0 indicates that the profit and loss distribution is left-skewed, with more losing trades than profitable trades or there may be extreme losses; a skewness value close to 0 indicates that the profit and loss distribution is approximately symmetrical.

[0134] The fourth dimension is kurtosis. Kurtosis reflects the thickness of the tails in the profit and loss distribution. It is calculated as follows: take the difference between each profit / loss value and the mean in the profit / loss sequence, calculate the fourth power of this difference, sum the fourth power deviations of all profit / loss values, and divide by the length of the profit / loss sequence to obtain the fourth central moment.

[0135] Take the fourth power of the sample standard deviation of the profit and loss sequence; divide the fourth central moment by the fourth power of the sample standard deviation to obtain the kurtosis value. A kurtosis value greater than 3 (relative to the normal distribution) indicates that the profit and loss distribution has a heavy tail (there are more extreme profit and loss values), while a kurtosis value less than 3 indicates that the profit and loss distribution has a thin tail (fewer extreme profit and loss values).

[0136] The features of the above four dimensions, including drawdown depth (containing maximum drawdown rate and average drawdown rate), recovery time (containing maximum recovery time and average recovery time), skewness, and kurtosis, are concatenated into a vector in sequence. This vector has inconsistencies in the dimensions and numerical ranges of each dimension, and requires subsequent normalization processing to obtain a multidimensional performance feature vector.

[0137] Calculate the overall strategy score. First, construct a market adaptability weight matrix. For each obtained market slice, extract its volatility label and corresponding trading profit / loss sequence. For each volatility range (low, medium, high), summarize the trading profit / loss sequences of all market slices within that range, and calculate the strategy return decay rate under that volatility range. The return decay rate is calculated as follows: The total profit or loss for all trades within the volatility range is the sum of all trade profits and losses within that range. The maximum total profit or loss across all volatility ranges is taken as the benchmark return. The return decay rate for that range is obtained by subtracting the ratio of the total profit or loss to the benchmark return from 1. The return decay rate ranges from 0 to 1. A decay rate closer to 0 indicates that the strategy's return is closer to its optimal range within that volatility range, while a decay rate closer to 1 indicates a significant decrease in the strategy's return within that volatility range.

[0138] A market-adaptive weight matrix is ​​constructed based on the return decay rate of each volatility range. The matrix has T rows and 3 columns, where T is the number of performance feature dimensions (6 in this example), and the 3 columns correspond to the three volatility ranges. The weight of each cell is determined by two parts: a benchmark weight, determined according to common quantitative trading evaluation practices. For example, the benchmark weights for drawdown depth and recovery time in low volatility ranges are set to higher values ​​(e.g., 0.3 to 0.4), and the benchmark weights for drawdown depth and kurtosis in high volatility ranges are set to higher values ​​(e.g., 0.3 to 0.4). The sum of the benchmark weights for each dimension in each range is 1. The adaptive retention factor is 1 minus the return decay rate of that range. The final weight is the product of the benchmark weight and the retention factor.

[0139] The multidimensional performance feature vector is normalized by the maximum and minimum values: each dimension is mapped to the [0,1] interval by subtracting the minimum value from the original value and dividing by the difference between the maximum and minimum values; cost indicators (drawback rate, recovery time) are then normalized by subtracting the normalized value from 1 to unify the direction, so that the closer the normalized value is to 1, the better.

[0140] The normalized multidimensional performance feature vector is weighted and fused with the market adaptability weight matrix. Specifically, for each volatility interval, each element of the normalized multidimensional performance feature vector is multiplied element-wise with the weight column corresponding to that interval in the market adaptability weight matrix, and then summed to obtain the interval performance score for that volatility interval. The proportion of the total number of trading days in each volatility interval to the total number of backtesting days is calculated as the weighting coefficient for that interval. The performance scores of each interval are weighted and summed according to the corresponding weighting coefficients to obtain the comprehensive strategy score, which takes a value between 0 and 1.

[0141] If the overall strategy score is greater than the preset passing threshold, the quantitative trading strategy is deemed qualified. The passing threshold is determined by collecting scores from multiple publicly available, mature quantitative trading strategies, calculating their overall scores using the same process, and then using the lower quartile of all mature strategy scores. This ensures that only strategies with performance at or above the average level of mature strategies pass, typically ranging from 0.4 to 0.6. If the overall strategy score is not greater than the passing threshold, the strategy is deemed unqualified, a "strategy unqualified" message is output, and the process returns to step 1, allowing the user to adjust the natural language trading description text and re-parse it.

[0142] Step 6: Based on the qualified quantitative trading strategy, obtain the live trading execution instructions, and control the live trading account to execute automated trading according to the live trading execution instructions.

[0143] The output of qualified quantitative trading strategies is analyzed to extract core trading factors and risk control thresholds. The core trading factors include: The trading instrument identifier, such as stock code, futures contract code, etc., the trading direction (long only, short only, or two-way trading), the quantity of a single order (or the position ratio), the order price type (market order or limit order), and the trading trigger condition expression.

[0144] The risk control thresholds include: stop-loss ratio, which is the maximum allowed loss in a single transaction as a percentage of the invested capital, typically between 2% and 5%; take-profit ratio, which is the automatic closing of positions to lock in profits when a single transaction reaches this profit percentage, typically between 5% and 10%; maximum daily loss limit, which is the suspension of subsequent trading when the cumulative loss in a single trading day reaches this limit; and maximum number of positions held, which is the upper limit for holding different trading instruments simultaneously.

[0145] Simultaneously, the current funding status of the live trading account is obtained, including fields such as total account assets, available funds, used margin, and current open positions. The extracted core trading factors and risk control thresholds are combined with the current funding status to calculate the initial trading parameter set. The specific calculation rules are as follows: The actual order quantity for a single transaction is the smaller of the single order quantity in the core trading factors and the maximum order quantity calculated according to the risk control rules (position limit); the stop-loss price is the product of the entry price and 1 minus the stop-loss ratio (for long positions) or the product of the entry price and 1 plus the stop-loss ratio (for short positions); the take-profit price is the product of the entry price and 1 plus the take-profit ratio (for long positions) or the product of the entry price and 1 minus the take-profit ratio (for short positions).

[0146] Calculate the market state distribution offset. Obtain the real-time market data stream from the live trading account. This data stream is obtained through the trading platform's market data push interface, pushing real-time market snapshots of the current trading instrument at fixed time intervals, such as every 1 second or no more than every 500 milliseconds. Each snapshot includes fields such as timestamp, latest price, best bid price, best ask price, and trading volume. Map the real-time market data stream to a real-time market state vector. The mapping method is as follows: for each preset market state dimension, extract the corresponding statistics from the real-time market data stream. Market state dimensions include: The real-time market state vector comprises four dimensions: recent volatility, which is the sample standard deviation of the logarithmic return series within the most recent preset window; trend strength, which is the proportion of price-rising candlesticks within the window; trading volume activity, which is the ratio of the current trading volume to the average volume within the window; and buy / sell order depth ratio, which is the ratio of the sum of buy orders from the top five to the top five to the sum of sell orders from the top five to the top five.

[0147] Extract the expected market state vectors corresponding to the qualified quantitative trading strategy in historical backtesting. This is the set of market state vectors calculated using the same mapping method at each historical time point where the strategy generates trading signals during the second deep backtesting step described above. Calculate the mean vector and covariance matrix for each vector in the expected market state vector set, using these as the expected market state distribution parameters of the strategy.

[0148] Calculate the distribution offset between the real-time market state vector and the expected market state distribution. The calculation method is as follows: Take the difference vector between the real-time market state vector and the expected mean vector; take the inverse of the covariance matrix; multiply the difference vector by the inverse of the covariance matrix to obtain the intermediate vector; then take the dot product of the intermediate vector and the difference vector to obtain the Mahalanobis distance value. This Mahalanobis distance value is the distribution offset. The larger the distribution offset, the greater the difference between the current real-time market state and the market environment during strategy backtesting; a distribution offset of 0 indicates that the two are completely consistent.

[0149] Based on the obtained initial trading parameter set and the obtained real-time market state vector, a basic trading instruction is generated. The basic trading instruction is a data structure containing a trading quantity field and a trigger price field, wherein the trading quantity field takes the actual order quantity of a single transaction from the initial trading parameter set, and the trigger price field takes the latest price from the real-time market state vector.

[0150] Determine whether the distribution offset is greater than the preset offset threshold. The offset threshold is the 95th percentile of the distribution offset sequence of all time points when trading signals are generated in the strategy's historical backtesting. If it exceeds this value, it means that the market has entered an unfamiliar area that the strategy has not experienced for 95% of the time in the backtesting, and the trading parameters need to be adjusted conservatively.

[0151] If the distribution offset is greater than the offset threshold, then the attenuation factor is calculated, specifically: The attenuation factor is obtained by exponentially calculating the ratio of the distribution offset to the offset threshold, with base e and the negative of the ratio as the exponent. The larger the offset, the closer the attenuation factor is to 0. The attenuation factor is multiplied by the trading quantity in the basic trading instruction and rounded to obtain the correction amount. This correction shifts the trigger price in a conservative direction, determined by the trading direction: downward shifting to lower the trigger buy price when buying long, and upward shifting to raise the trigger sell price when selling long; the opposite applies to short selling. The basic adjustment amount is the product of the trigger price and a preset adjustment ratio, determined based on the average intraday volatility of the trading instrument in historical backtesting, typically ranging from 0.01 to 0.03. The offset magnitude is the product of the basic adjustment amount and 1 minus the attenuation factor, yielding the live trading execution instruction.

[0152] If the distribution offset is not greater than the preset offset threshold, the basic trading instruction will be directly used as the live trading execution instruction, and no attenuation correction will be applied to the trading parameters.

[0153] The generated live trading execution instructions are sent to the live trading account through a pre-defined order routing interface. This order routing interface is a standard application programming interface (API) connecting this system to the trading counters of brokerages or futures companies. It is responsible for converting the system's unified internal trading instructions into the order request format corresponding to each trading counter and sending them through an encrypted network channel. The order routing interface supports two types of orders: market orders and limit orders. The orders include fields such as the trading instrument code, buy / sell direction, order quantity, order price (limit order) or price type identifier (market order), and order validity period.

[0154] After the instruction is issued, the system asynchronously receives transaction reports from the live trading account via the order routing interface. These transaction reports include fields such as order number, transaction number, transaction price, transaction quantity, transaction time, transaction amount, and transaction fee. Based on the received transaction reports, the following update operations are performed: Update the current holdings list. If a buy order was executed, increase the holding quantity of the corresponding asset and update the holding cost price based on the transaction price. If a sell order was executed, decrease the holding quantity of the corresponding asset. Calculate and record the realized profit or loss for this transaction. Update the account balance status, adding the realized profit or loss and transaction fees to the account's total assets and available funds. After the update, the account balance status reflects the latest automated trade execution result. Subsequent strategy signals will continue to generate new trading instructions based on the updated balance status, forming a closed-loop control for automated trading.

[0155] If no transaction confirmation is received within the preset time, an order status query will be automatically initiated and the following actions will be taken based on the results: if the order is partially completed, it will be recorded and the user will continue to wait or cancel the order; if the order is rejected, the reason will be recorded and an alert will be issued.

[0156] like Figure 2 As shown, embodiments of the present invention also provide a user transaction intent intelligent parsing system based on natural language processing, comprising: The intent parsing module is used to acquire natural language transaction description text, and to perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain standardized transaction strategy logic; The code compilation module is used to compile and convert code according to the standardized trading strategy logic to obtain the initial quantitative trading code. The topology review module is used to construct a control logic flow graph based on the initial quantitative trading code and map it to a three-dimensional topology mesh. It performs manifold mesh detection through a pre-trained execution flow-control flow bi-graph comparison model to obtain candidate quantitative trading codes. The backtesting repair module is used to perform preliminary backtesting based on the candidate quantitative trading code to obtain preliminary backtesting results. If the preliminary backtesting results are abnormal, non-manifold mesh repair is performed based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code. The in-depth evaluation module is used to perform a second in-depth backtest based on the target quantitative trading code to obtain the second in-depth backtest results, and to perform a quantitative performance evaluation based on the second in-depth backtest results to obtain a qualified quantitative trading strategy. The live trading control module is used to obtain live trading execution instructions based on qualified quantitative trading strategies, and to control the live trading account to execute automated trading based on the live trading execution instructions.

[0157] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.

[0158] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for intelligently parsing user transaction intent based on natural language processing, characterized in that, The method includes: Obtain natural language transaction description text; based on the natural language transaction description text, perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain standardized transaction strategy logic; The code is compiled and converted according to the standardized trading strategy logic to obtain the initial quantitative trading code; The initial quantitative trading code is parsed to extract basic code blocks, control flow jump instructions, and variable definition-usage chains. A control logic flow graph is constructed using basic code blocks as logical nodes, control flow jump instructions as directed control flow edges, and variable definition-usage chains as directed data dependency edges. The execution timing characteristics, nesting depth characteristics, and variable scope hierarchy characteristics of each logical node in the control logic flow graph are extracted. These characteristics are then mapped to x, y, and y coordinates in three-dimensional space, simultaneously determining the target space coordinates of each logical node. Based on the directed control flow edges and data dependency edges in the control logic flow graph, logical nodes with target space coordinates are connected to generate grid edges. Triangular patches are constructed based on adjacent grid edges and logical nodes to form a three-dimensional topological grid. The three-dimensional topological grid is parsed to extract data dependency edges and control dependency edges. Based on these data dependency edges and control dependency edges, a data execution flow subgraph and a control logic flow subgraph are constructed. The system constructs a logic flow subgraph; inputs the data execution flow subgraph and the control logic flow subgraph into a pre-trained execution flow-control flow bi-graph comparison model; through the manifold convolutional layer built into the execution flow-control flow bi-graph comparison model, it extracts local topological invariants of the data execution flow subgraph and the control logic flow subgraph respectively, calculates the feature distance between the local topological invariants, and obtains the temporal topological consistency score; counts the number of adjacent triangular faces of each grid edge in the 3D topological mesh, and obtains the adjacent face statistical features; based on the temporal topological consistency score and the adjacent face statistical features, it performs non-manifold defect judgment; if the temporal topological consistency score is lower than the preset consistency threshold, or if the number of adjacent triangular faces of the target grid edge is greater than the preset face threshold, it is determined that there is a logical conflict in the 3D topological mesh, and a logical conflict interception instruction is generated; if no logical conflict interception instruction is generated, the initial quantitative trading code is used as a candidate quantitative trading code; if a logical conflict interception instruction is generated, the initial quantitative trading code is associated with the logical conflict interception instruction and used as a candidate quantitative trading code. Preliminary backtesting is performed on the candidate quantitative trading codes to obtain preliminary backtesting results; if the preliminary backtesting results are abnormal, non-manifold mesh repair is performed based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code; A second in-depth backtest is conducted based on the target quantitative trading code to obtain the results; a performance quantitative evaluation is then performed based on the results to obtain a qualified quantitative trading strategy. Based on the qualified quantitative trading strategy, live trading execution instructions are obtained, and the live trading account is controlled to execute automated trading according to the live trading execution instructions.

2. The method for intelligently parsing user transaction intent based on natural language processing according to claim 1, characterized in that, Based on the natural language transaction description text, a pre-trained semantic-logical dual-space mapping model is used to perform feature fusion to obtain the standardized transaction strategy logic, including: The natural language transaction description text is input into the temporal semantic encoding branch of the pre-trained semantic-logic dual-space mapping model, and multi-dimensional temporal semantic features are extracted by the temporal semantic encoding branch. The natural language transaction description text is input into the logical rule constraint branch of the pre-trained semantic-logical dual-space mapping model. The transaction state transition directed acyclic graph is constructed from the logical rule constraint branch. The causal reachability path of the text entity in the transaction state transition directed acyclic graph is calculated to obtain the logical rule constraint features. Construct logical mutual exclusion masks and causal sequence masks based on logical rule constraint features; Based on logical mutual exclusion masks and causal temporal masks, multi-dimensional temporal semantic features and logical rule constraint features are fused together in two spaces to form standardized trading strategy logic.

3. The method for intelligently parsing user transaction intent based on natural language processing according to claim 2, characterized in that, Based on logical mutual exclusion masks and causal temporal masks, multi-dimensional temporal semantic features and logical rule constraint features are fused through dual-space alignment to form standardized trading strategy logic, including: An orthogonal projection matrix is ​​constructed based on the logical rule constraint characteristics to define the quantization rule constraint space; After dimension adaptation, the multidimensional temporal semantic features are mapped to an orthogonal projection matrix to obtain compliant semantic projection features. Based on the logical mutual exclusion mask, conflict dimension suppression is applied to the compliant semantic projection features to obtain mutually exclusive suppression features; Temporal rearrangement of mutual exclusion suppression features based on causal temporal masks yields temporal alignment features. The time-series alignment features and logical rule constraint features are residually fused to form a standardized trading strategy logic; wherein, the standardized trading strategy logic retains the causal reachability path in the form of structured attributes.

4. The method for intelligently parsing user transaction intent based on natural language processing according to claim 3, characterized in that, The code is compiled and transformed according to the standardized trading strategy logic to obtain the initial quantitative trading code, including: The logic of standardized trading strategies is analyzed to extract the logic execution nodes and data flow edges. Based on the logic execution nodes and data flow edges, a directed graph of strategy logic is constructed. Map the logic execution nodes in the strategy logic directed graph to pre-defined code abstract syntax tree template nodes to obtain an initial code skeleton containing variable declaration nodes and assignment nodes. Based on the data flow transition edge, scope binding is performed on the variable declaration nodes and assignment nodes in the initial code skeleton to obtain scope-bound code containing control flow nodes; Based on the causal reachability path in the standardized trading strategy logic, conditional branch verification and unreachable branch pruning are performed on the control flow nodes in the scope-bound code to obtain the verified code structure. The verified code structure is instantiated with the underlying trading interface and its syntax expanded to generate the initial quantitative trading code.

5. The method for intelligently parsing user transaction intent based on natural language processing according to claim 4, characterized in that, If the preliminary backtesting results are abnormal, then non-manifold mesh repair is performed based on the preliminary backtesting results and the 3D topological mesh, including: If the candidate quantitative trading code is associated with a logical conflict interception instruction, the non-manifold defect area is located in the three-dimensional topological grid according to the conflict position in the interception instruction; otherwise, the candidate quantitative trading code is connected to the preset historical market database for preliminary backtesting to obtain preliminary backtesting results containing abnormal trading signals and running error logs. If the candidate quantitative trading code is not associated with a logical conflict interception instruction, the preliminary backtesting results are judged as abnormal. If it is judged as abnormal, the timestamp and variable identifier of the abnormal trading signal are extracted and mapped to the corresponding logical nodes in the three-dimensional topological grid to locate the non-manifold defect area. Identify the topological defect type of the non-manifold defect region, and perform edge folding or face splitting operations according to the topological defect type to eliminate mesh self-intersection and reconstruct the triangular patch connection relationship to obtain the target topological mesh. Record the node merging mapping corresponding to the edge folding operation or the node splitting mapping corresponding to the face splitting operation. Based on the node merging mapping or node splitting mapping, calculate the node topological isomorphism mapping relationship between the target topological mesh and the 3D topological mesh; Based on the node topology isomorphic mapping relationship, the control flow jump logic and variable scope in the candidate quantitative trading code are reversed and reconstructed to obtain the target quantitative trading code.

6. The method for intelligently parsing user transaction intent based on natural language processing according to claim 5, characterized in that, A second deep backtest was conducted based on the target quantitative trading code to obtain the results of the second deep backtest. Performance is quantitatively evaluated based on the results of the second deep backtest, including: The target quantitative trading code is connected to a preset historical market database. The historical market data is sliced ​​into multiple volatility ranges according to preset volatility clustering rules to obtain multiple market slices. The target quantitative trading code is run in each of the multiple market slices to obtain secondary deep backtesting results containing the trading records of each market slice. The results of the second deep backtest are analyzed to extract the net capital value curve and trading profit and loss sequence corresponding to each market slice; the drawdown depth and recovery time features of the net capital value curve are calculated, and the skewness and kurtosis features of the trading profit and loss sequence are calculated. Based on the drawdown depth features, recovery time features, skewness features and kurtosis features, a multi-dimensional performance feature vector is constructed. Extract volatility labels from each market segment, combine them with the corresponding trading profit and loss sequences, calculate the return decay rate of the target quantitative trading code under different volatility ranges, construct a market adaptability weight matrix based on the return decay rate, normalize the multi-dimensional performance feature vector, and then weight and fuse the normalized multi-dimensional performance feature vector with the market adaptability weight matrix to calculate the comprehensive strategy score. If the overall strategy score is greater than the preset qualified threshold, the strategy corresponding to the target quantitative trading code is determined to be a qualified quantitative trading strategy.

7. The method for intelligently parsing user transaction intent based on natural language processing according to claim 6, characterized in that, Based on the aforementioned qualified quantitative trading strategy, live trading execution instructions are obtained. These instructions are then used to control the live trading account to execute automated trading, including: The qualified quantitative trading strategy is analyzed to extract the core trading factors and risk control thresholds; the current capital status of the live trading account is obtained, and the initial trading parameter set is obtained by combining the core trading factors and risk control thresholds. Acquire the real-time market data stream from the live trading account and map the real-time market data stream to a real-time market state vector; extract the expected market state vector corresponding to the qualified quantitative trading strategy in historical backtesting, and calculate the distribution offset between the real-time market state vector and the expected market state vector. Based on the initial trading parameter set and the real-time market state vector, a basic trading instruction containing the trading quantity and trigger price is generated; it is determined whether the distribution offset is greater than a preset offset threshold; if it is greater than the preset offset threshold, an attenuation factor is calculated based on the distribution offset, and the trading quantity and trigger price in the basic trading instruction are dynamically attenuated and corrected based on the attenuation factor to obtain the live trading execution instruction. The system sends live trading execution instructions to the live trading account through a pre-configured order routing interface; it receives transaction reports from the live trading account and updates the current fund status based on the transaction reports to control the live trading account to execute automated trading.

8. A user transaction intent intelligent analysis system based on natural language processing, wherein the system implements the method as described in any one of claims 1 to 7, characterized in that, include: The intent parsing module is used to acquire natural language transaction description text, and to perform feature fusion through a pre-trained semantic-logical dual-space mapping model to obtain standardized transaction strategy logic; The code compilation module is used to compile and convert code according to the standardized trading strategy logic to obtain the initial quantitative trading code. The topology review module is used to construct a control logic flow graph based on the initial quantitative trading code and map it to a three-dimensional topology mesh. It performs manifold mesh detection through a pre-trained execution flow-control flow bi-graph comparison model to obtain candidate quantitative trading codes. The backtesting repair module is used to perform preliminary backtesting based on the candidate quantitative trading code to obtain preliminary backtesting results. If the preliminary backtesting results are abnormal, non-manifold mesh repair is performed based on the preliminary backtesting results and the three-dimensional topological mesh to obtain the target quantitative trading code. The in-depth evaluation module is used to perform a second in-depth backtest based on the target quantitative trading code to obtain the second in-depth backtest results, and to perform a quantitative performance evaluation based on the second in-depth backtest results to obtain a qualified quantitative trading strategy. The live trading control module is used to obtain live trading execution instructions based on qualified quantitative trading strategies, and to control the live trading account to execute automated trading based on the live trading execution instructions.

Citation Information

Patent Citations

  • Quantitative strategy natural language construction and interpretability auxiliary system based on multi-agent collaborative architecture

    CN120524938A

  • Intelligent system conflict point review system based on knowledge graph and large language model

    CN121501985A