A method and system for dynamic position optimization in quantitative trading based on causal inference

CN122573601APending Publication Date: 2026-08-14HANGZHOU ZENITH FINANCIAL NETWORK MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

然而,金融市场的非线性、高噪声与伪相关特性使得单纯依赖统计相关性容易产生虚假关联,导致仓位调整滞后或过度反应

Benefits of technology

[0008]与现有技术相比,本发明提供的一种基于因果推断的量化交易动态仓位优化方法,能够提升仓位优化模型的因果可解释性与市场状态突变下的鲁棒稳定性,实现更精确、平稳的动态仓位调整。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122573601A_ABST
    Figure CN122573601A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for dynamic position optimization in quantitative trading based on causal inference. The method includes: collecting multi-source market time-series data and performing standardization and feature engineering to generate a state feature sequence; constructing a directed acyclic causal graph based on the state feature sequence using a causal discovery algorithm, and extracting root and mediating variables driving market state changes through the directed acyclic causal graph; using the Lyapunov stability criterion to screen a stable causal feature set that maintains bounded convergence; inputting the stable causal feature set into a reinforcement learning position optimization model, outputting position adjustment coefficients based on the current causal state, and performing real-time asset allocation rebalancing operations according to the position adjustment coefficients to generate a dynamically optimized position distribution vector. Using this invention, the causal interpretability and robust stability under sudden market state changes of the position optimization model can be improved, achieving more accurate and stable dynamic position adjustments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantitative trading technology, and in particular to a method and system for dynamic position optimization in quantitative trading based on causal inference. Background Technology

[0002] Quantitative trading executes investment decisions through mathematical models and computational techniques, with position management being a core element for controlling risk and enhancing returns. Traditional position optimization methods often rely on statistical correlation analysis, such as setting fixed position ratios based on historical price volatility or using mean-variance models to allocate assets under preset risk constraints. However, the nonlinearity, high noise, and spurious correlation characteristics of financial markets make it easy to generate false associations by simply relying on statistical correlation, leading to lagging or overreacting position adjustments. In recent years, some methods have introduced reinforcement learning for adaptive position control, but existing reinforcement learning models typically map market characteristics directly to action outputs, lacking a causal explanation of the market state formation mechanism, making it difficult to distinguish between true driving variables and passive response variables, and lacking robustness in the face of sudden market structural changes. Furthermore, existing methods rarely assess the persistence of causal relationships from a dynamic stability perspective, making position optimization strategies prone to oscillations or divergence risks during time-series evolution. Summary of the Invention

[0003] The purpose of this invention is to provide a method and system for dynamic position optimization in quantitative trading based on causal inference, in order to overcome the shortcomings of the prior art, improve the causal interpretability of the position optimization model and the robust stability under sudden changes in market conditions, and achieve more accurate and stable dynamic position adjustment.

[0004] One embodiment of this application provides a quantitative trading dynamic position optimization method based on causal inference, the method comprising: Collect multi-source market time-series data and perform standardization and feature engineering to generate a state feature sequence that includes price fluctuations, trading volume and volatility indicators; Based on the state feature sequence, a causal discovery algorithm is used to construct a directed acyclic causal graph to identify direct causal driving relationships between variables and eliminate spurious correlations. The root variables and mediating variables that drive changes in market state are extracted through the directed acyclic causal graph. Using the Lyapunov stability criterion, the stability of the causal path formed by the root variable and the mediating variable is determined, and a stable causal feature set that maintains bounded convergence during the temporal evolution of market states is selected. The stable causal feature set is input into a pre-constructed reinforcement learning position optimization model, and the position adjustment coefficient is output in combination with the current causal state. The asset allocation rebalancing operation is performed in real time according to the position adjustment coefficient to generate a dynamically optimized position distribution vector.

[0005] Another embodiment of this application provides a dynamic position optimization system for quantitative trading based on causal inference, the system comprising: The data acquisition module is used to collect multi-source market time-series data and perform standardization and feature engineering processing to generate a state feature sequence that includes price fluctuations, trading volume and volatility indicators. The module is used to construct a directed acyclic causal graph based on the state feature sequence and using a causal discovery algorithm to identify direct causal driving relationships between variables and eliminate spurious correlations. The root variables and mediating variables that drive changes in market state are extracted through the directed acyclic causal graph. The screening module is used to use the Lyapunov stability criterion to determine the stability of the causal path formed by the root variable and the mediating variable, and to screen the stable causal feature set that maintains bounded convergence during the time-series evolution of the market state. The optimization module is used to input the stable causal feature set into a pre-built reinforcement learning position optimization model, output position adjustment coefficients in combination with the current causal state, and perform asset allocation rebalancing operations in real time according to the position adjustment coefficients to generate a dynamically optimized position distribution vector.

[0006] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.

[0007] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.

[0008] Compared with existing technologies, the present invention provides a dynamic position optimization method for quantitative trading based on causal inference, which can improve the causal interpretability of the position optimization model and the robust stability under sudden changes in market conditions, and achieve more accurate and stable dynamic position adjustment. Attached Figure Description

[0009] Figure 1 A hardware structure block diagram of a computer terminal for a quantitative trading dynamic position optimization method based on causal inference provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a quantitative trading dynamic position optimization method based on causal inference, provided for an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a dynamic position optimization system for quantitative trading based on causal inference, provided in an embodiment of the present invention. Detailed Implementation

[0010] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0011] This invention first provides a dynamic position optimization method for quantitative trading based on causal inference. This method can be applied to electronic devices, such as computer terminals, specifically ordinary computers.

[0012] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware structure block diagram of a computer terminal for a quantitative trading dynamic position optimization method based on causal inference, provided as an embodiment of the present invention. Figure 1 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.

[0013] See Figure 2 The present invention provides a method for dynamic position optimization in quantitative trading based on causal inference, which may include the following steps: S201 collects multi-source market time-series data and performs standardization and feature engineering processing to generate a state feature sequence that includes price fluctuations, trading volume and volatility indicators. Specifically, it can collect multi-source market time-series data from the financial market to generate raw multi-source datasets; The core of this step is to collect comprehensive market data required for quantitative trading, integrating dynamic time-series information across categories and time periods into a standardized raw dataset. This provides complete data source support for subsequent data preprocessing and feature construction. The specific implementation method is as follows: Multi-source market time-series data in the financial market covers all dimensions of information required for quantitative trading decisions, including four core data categories. All data types are aligned with a unified timestamp to ensure time-series consistency. The first category is target trading time-series data, including minute-level and daily candlestick chart data for stocks, futures, funds, and other trading targets. Specifically, it covers core indicators such as opening price, closing price, highest price, lowest price, total trading volume, total turnover, and bid-ask spread. This data directly reflects the real-time trading status of the target and serves as the basis for position optimization. The second category is overall market data, including real-time fluctuation data for the overall market index, industry sector indices, and sub-theme indices, reflecting overall market and sub-sector trend changes and avoiding local biases in single-target data. The third category is market capital flow data, including northbound capital flows, margin trading balances, net capital inflows into sectors, and the proportion of large-order transactions, reflecting market capital preferences and trends. The fourth category is basic macroeconomic correlation data, including low-frequency time-series data such as risk-free interest rates, market volatility indices, and short-term treasury bond yields, used to capture the long-term impact of the macroeconomic environment on market conditions.

[0014] Data acquisition employs a combination of real-time streaming and historical data completion. Real-time acquisition covers both minute-level high-frequency data and daily-level low-frequency data to meet the needs of different trading strategies across various timeframes. Historical data completion covers the entire time series information of the past three years, ensuring the completeness and representativeness of the data sample. During acquisition, the continuity of timestamps is rigorously verified to ensure no time misalignment in the multi-source data at each time step. All data is stored as floating-point numbers, retaining four decimal places of precision to avoid precision loss affecting subsequent calculations. After acquisition, all data is sorted in ascending chronological order and integrated to form a structured original multi-source dataset. This dataset includes timestamp fields and multi-dimensional feature fields, with no data duplication or missing field issues, laying the foundation for subsequent missing value processing and outlier removal.

[0015] Missing values ​​were imputed and outliers were removed from the original multi-source dataset. The Z-score method was used to standardize the data to unify the dimensions of each indicator and generate a standardized market data sequence. The core of this step is to clean and normalize the raw data, eliminate calculation biases caused by missing and outlier values, unify the units and numerical ranges of different indicators, and generate a stable and standardized market data sequence. The specific implementation method is as follows: Original multi-source datasets are prone to data loss and abnormal fluctuations during the acquisition process, necessitating imputation of missing values. Considering the continuous nature of time-series data, a combination of linear interpolation and rolling mean imputation is used to handle missing values. For short intervals with no more than three consecutive time steps of missing data, linear interpolation is employed, constructing a linear relationship using adjacent valid data points to fill in the missing values. For long intervals with more than three consecutive time steps of missing data, rolling mean imputation is used, selecting the rolling average of the previous 10 valid time steps as the imputation value. This ensures that the imputed data conforms to the changing patterns of time-series data and does not disrupt the trend characteristics of the original data.

[0016] Outlier removal employs the 3σ principle, which removes extreme outliers based on the normal distribution of the data. First, the mean μ and standard deviation σ of each indicator are calculated. Then, the deviation of each data point is calculated, and extreme outliers deviating from the mean by more than three times the standard deviation are removed. These outliers are often caused by market gaps or data transmission errors, and can interfere with the accuracy of feature calculations. After outlier removal, all data retains a normal fluctuation range, free from extreme value interference.

[0017] Z-score standardization is the core step in unifying the dimensions of indicators. The calculation formula is Z = (x - μ) / σ, where x is the original data value, μ is the global mean of the indicator, σ is the global standard deviation of the indicator, and Z is the standardized value. This method can map indicators with different dimensions and numerical ranges, such as price indicators, volume indicators, and volatility indicators, to a standard normal distribution interval with a mean of 0 and a standard deviation of 1. This eliminates the influence of differences in dimensions and numerical magnitudes, ensuring fairness in subsequent feature calculations and model inputs. After processing, all indicator values ​​are well-distributed and sequentially continuous, forming a standardized market data sequence. This sequence has no missing values, no anomalies, and no dimensional differences, and can be directly used for the calculation of basic feature indicators.

[0018] Based on standardized market data sequences, the logarithmic return within a sliding window is calculated as a price volatility indicator, the volume change rate is calculated as a volume indicator, and the historical volatility is calculated as a volatility indicator, generating a set of basic feature indicators. The core of this step is to extract three fundamental characteristics reflecting the core state of the market from standardized data, transform the raw transaction data into quantitative indicators that can characterize price, transaction volume, and risk, and construct a set of basic characteristic indicators to provide a core carrier for the construction of higher-order features. The specific implementation method is as follows: The price volatility indicator uses the logarithmic return within a sliding window. The logarithmic return is a core indicator of price volatility in quantitative finance, eliminating the impact of price base differences on volatility amplitude. The calculation formula is r_t = ln(P_t / P_t-1), where r_t is the logarithmic return at the current time step, P_t is the closing price at the current time step, P_t-1 is the closing price at the previous time step, and ln is the natural logarithm. The sliding window is set to 20 time steps, covering a complete short-term trading cycle. The logarithmic return sequence within the window for each time step is calculated, reflecting the short-term price volatility and trend of the underlying asset. Positive values ​​represent price increases, negative values ​​represent price decreases, and larger absolute values ​​indicate more volatile price movements.

[0019] The trading volume indicator uses the rate of change in trading volume to reflect the dynamic changes in market trading activity. The calculation formula is VolRate_t = (Vol_t - Vol_t-1) / Vol_t-1, where VolRate_t is the rate of change in trading volume at the current time step, Vol_t is the trading volume at the current time step, and Vol_t-1 is the trading volume at the previous time step. This indicator uses a relative rate of change to represent the trend of increasing or decreasing trading volume, avoiding the influence of differences in the absolute magnitude of trading volume. A positive value indicates an increase in trading volume, while a negative value indicates a decrease in trading volume. It is a core basis for judging the market's trading activity.

[0020] The volatility indicator uses historical volatility to reflect the market's risk and volatility level. It is calculated based on the logarithmic returns within a sliding window. First, the standard deviation of the logarithmic returns within the 20-day sliding window is calculated, then annualized to obtain the historical volatility. The formula is HV = std(r_t) × sqrt(252), where HV is the historical volatility, std(r_t) is the standard deviation of the logarithmic returns within the sliding window, and sqrt(252) is the annualized coefficient, corresponding to the number of trading days in a year. A higher historical volatility value indicates higher market risk, while a lower value indicates a more stable market trend. It is a core risk reference indicator for quantitative trading position control.

[0021] The calculated price volatility, trading volume, and volatility indicators are aligned and integrated according to timestamps. Each time step corresponds to a set of three basic characteristic values, forming a structured set of basic characteristic indicators. This set of indicators accurately represents the three core states of the market: price changes, trading activity, and risk level, without redundant information or feature misalignment issues.

[0022] Lag features are constructed and rolling statistics are extracted from the basic feature indicator set to generate a state feature sequence that includes price fluctuation, trading volume and volatility indicators.

[0023] The core of this step is to capture the temporal dependencies and dynamic changes in market states through temporal feature expansion and statistical feature mining. This expands single basic features into multi-dimensional temporal features, generating state feature sequences that are suitable for causal inference and reinforcement learning inputs. The specific implementation method is as follows: Constructing lag features is a crucial operation for capturing the evolutionary patterns of market time series. Based on a set of basic feature indicators, lag features with 1-period, 3-period, and 5-period lags are constructed for three main indicators: price volatility, trading volume, and volatility. A lag feature replaces the feature value of the current time step with the feature value of the corresponding past time step. For example, the 1-period price volatility feature is the logarithmic return of the previous time step, and the 3-period trading volume feature is the rate of change of trading volume over the previous three time steps. Lag features can effectively capture the short-term dependencies of market states, reflect the continuous impact of past market states on the current state, and avoid the loss of time series information caused by using only current features.

[0024] Rolling statistics extraction is a core method for uncovering the dynamic distribution patterns of features. Based on basic and lagged features, rolling statistics are calculated for three sliding windows: 10-day, 20-day, and 60-day. These statistics include four core statistical features: rolling mean, rolling variance, rolling extreme values, and rolling quantiles. The rolling mean reflects the short-term average level of the feature; the rolling variance reflects the degree of volatility and dispersion of the feature; the rolling extreme values ​​reflect the level of extreme volatility of the feature; and the rolling quantiles reflect the relative distribution position of the feature. Statistics from different windows can simultaneously capture short-term, medium-term, and long-term market trend changes, enriching the dimensions and representational capabilities of the features.

[0025] The original basic features, constructed lagged features, and extracted rolling statistics are concatenated and fused according to time steps. Each time step corresponds to a set of multi-dimensional feature vectors containing three dimensions: price fluctuation, trading volume, and volatility. The feature vectors of all time steps are arranged in ascending order of time, forming a continuous and regular state feature sequence. This sequence is dimensionally unified, temporally continuous, and information-complete, containing not only current market state information but also past time-series dependencies and dynamic statistical patterns. It can be directly input into subsequent causal discovery algorithms, providing high-quality feature input for root variable identification, stability assessment, and position optimization.

[0026] S202, Based on the state feature sequence, a causal discovery algorithm is used to construct a directed acyclic causal graph for identifying direct causal driving relationships between variables and eliminating false correlations. The root variables and mediating variables that drive changes in market state are extracted through the directed acyclic causal graph. Specifically, the state feature sequence can be input into a constraint-based causal discovery algorithm, and the conditional dependency relationship between each feature variable can be determined through conditional independence test to generate an initial causal skeleton diagram; The core of this step is to use a constrained causal mining method to examine the statistical dependencies between variables in the time series data of market state characteristics, eliminate unrelated variable combinations, and build an initial causal framework that retains only undirected connections. This lays the structural foundation for subsequent causal direction determination. The specific implementation method is as follows: The constraint-based causal discovery algorithm employs the classic PC algorithm, which is well-suited for feature mining scenarios involving financial time-series data. Its core logic involves progressively testing the conditional independence between variables, removing connections between variables lacking causal relationships, and ultimately retaining undirected edges with statistical dependencies to form a causal framework. The state feature sequence includes 12 feature variables covering three dimensions: price, trading volume, and volatility. These variables include logarithmic return, trading volume change rate, 30-day historical volatility, 1-period lag logarithmic return, 2-period lag trading volume change rate, and the rolling 5-day average volatility. These variables are indexed by time steps to form continuous time-series samples, with a sample length covering 240 trading days to ensure the statistical power of the test.

[0027] Conditional independence testing is a core method for determining the association between variables. In this study, the Fisher-Z transform test, which is applicable to continuous financial data, was selected. The significance level of the test was set at 0.05. When the p-value obtained from the test is greater than 0.05, it is determined that the two variables are independent under the given third set of variables, and there is no direct causal relationship between them. The corresponding variable link is then deleted. When the p-value is less than or equal to 0.05, it is determined that there is a conditional dependency between the variables, and the undirected link is retained.

[0028] The testing process begins with a fully connected initial graph and gradually increases the dimension of the condition variable set. First, it tests the marginal independence between variables, then the first-order and second-order conditional independence, successively removing connections corresponding to independent variables. In the example, given a 1-period lag in the logarithmic return and the lagged 2-period change in trading volume, the p-value is 0.12, which is greater than the significance level, indicating conditional independence, and the connection between them is deleted. The p-value for the conditional test between the logarithmic return and the 30-day historical volatility is 0.02, which is less than the significance level, indicating a dependency relationship, and the undirected edge is retained.

[0029] After the conditional independence test of all variables, all variables with conditional dependencies are connected by undirected edges, and variables without correlations are independent of each other. The resulting undirected graph structure is the initial causal skeleton graph. This skeleton only retains the dependencies between variables, does not define the causal direction, has no closed-loop structure, and fully presents the basic correlation structure between market state characteristics.

[0030] The initial causal skeleton graph is oriented using a scoring search method, and the causal direction of each edge is determined by a greedy equivalence search algorithm to generate a directed acyclic causal graph. The core of this step is to assign reasonable causal directions to the undirected edges of the initial causal framework by combining scoring and search. This generates a directed acyclic causal graph that conforms to the logic of the financial market, accurately depicting the causal driving relationships between variables, while avoiding the formation of closed loops. The specific implementation method is as follows: The scoring search method uses the Bayesian information criterion score as the core evaluation standard. This score comprehensively considers the model's fitting effect and complexity, balancing the fitting accuracy and overfitting risk of financial data. A higher score indicates that the structure of the causal graph closely resembles the real market causal relationships. The greedy equivalence search algorithm is the core search method for achieving direction orientation. The algorithm consists of two stages: initialization and search optimization. It starts with an initial causal skeleton graph and then searches for the optimal causal structure by gradually adding, removing, and reversing edges. After each operation, the Bayesian information criterion score is calculated, and structural adjustments that improve the score are retained until the score can no longer be improved.

[0031] The direction orientation process strictly adheres to the principle of directed acyclicity, prohibiting the formation of closed-loop causal structures between variables, ensuring the unidirectional driving force of causal relationships, and conforming to the objective laws of variable transmission in the financial market. For undirected edges in the initial skeleton, the algorithm determines the final direction by examining the score differences under different direction settings. In the example, for the undirected edges of historical volatility and logarithmic return in the initial skeleton, after search and testing, the score of historical volatility pointing to logarithmic return is higher than that of the reverse setting, and historical volatility is determined to be the cause of logarithmic return, with the orientation being historical volatility → logarithmic return; the score of the rate of change in trading volume pointing to the logarithmic return with a lag of 1 period is optimal, and the orientation is trading volume change rate → logarithmic return with a lag of 1 period.

[0032] During the search process, the algorithm automatically eliminates directions that would form closed loops. After all edges are oriented, the resulting structure has no directed loops, and the causal driving relationship between variables is clear and explicit. This structure is a directed acyclic causal graph, which can intuitively present the direct causal driving path between market state characteristics and effectively eliminate false connections that only have statistical correlation rather than causal relationship.

[0033] Based on the directed acyclic causal graph, the in-degree and out-degree of each variable are calculated, variables without parent nodes are identified as root variables, and variables with both parent and child nodes are identified as mediator variables, generating a list of root variables and mediator variables. The core of this step is to use degree feature analysis in graph theory to hierarchically divide the variables in the directed acyclic causal graph, locate the source variables and transmission variables that drive market changes, and identify the core nodes of causal transmission. The specific implementation method is as follows: In-degree refers to the number of directed edges pointing to the current variable, representing the number of times the variable is driven by other variables; out-degree refers to the number of directed edges originating from the current variable and pointing to other variables, representing the number of times the variable drives other variables. These two are core indicators for classifying variable types. The process iterates through all 12 feature variables in the directed acyclic causal graph, calculating the in-degree and out-degree values ​​for each variable, recording and statistically analyzing the connectivity characteristics of each variable.

[0034] Root variables are the primary factors driving changes in market conditions. In a causal graph, they are represented by having no parent node (i.e., an in-degree of 0, only an out-degree), and are not driven by other characteristic variables. They are the initial triggers for market fluctuations. In the example, the 30-day historical volatility variable has an in-degree of 0 and an out-degree of 3, driving the logarithmic return, the rolling 5-day mean volatility, and the 1-period lagged logarithmic return, thus it is identified as a root variable. Similarly, the original volume change rate variable has an in-degree of 0 and an out-degree of 2, driving the 1-period lagged volume change rate and the logarithmic return, also thus it is identified as a root variable.

[0035] Mediating variables are intermediate nodes in causal transmission. In a causal graph, they are represented by having both parent and child nodes, i.e., an in-degree greater than 0 and an out-degree greater than 0. They inherit the driving force of the root variable and then transmit the causal effect to the downstream target variable, making them a key link in market signal transmission. In the example, the 1-period logarithmic return has an in-degree of 2, driven by historical volatility and the rate of change in trading volume, and an out-degree of 1, driving the 2-period logarithmic return, thus it is identified as a mediating variable. Similarly, the rolling 5-day volatility mean has an in-degree of 1, driven by historical volatility, and an out-degree of 1, driving the logarithmic return, also thus it is identified as a mediating variable.

[0036] The identified root and mediating variables are organized by name, in-degree, out-degree, and driving relationship to form a structured list of root and mediating variables. The list clearly marks the hierarchical position and driving role of each variable, providing a node basis for subsequent causal path extraction.

[0037] The causal path from root variable to mediator variable to target variable is extracted from the directed acyclic causal graph, spurious correlation paths are eliminated, and finally the root variable and mediator variable and their causal path structure driving changes in market state are generated.

[0038] The core of this step is to trace the complete transmission path along the causal driving direction, eliminate spurious correlation paths caused by common factors, and form a causal structure that truly reflects the market driving logic. This provides accurate causal characteristics for subsequent stability assessment and position optimization. The specific implementation method is as follows: The target variable is a core market state indicator focused on in quantitative trading. In this study, the logarithmic return of the next period is selected as the target variable, representing the short-term fluctuation trend of the market. The causal path extraction follows the unidirectional principle of starting from the root variable, passing through the mediating variables, and finally pointing to the target variable. It traverses all out-degree connections of the root variables, tracks downstream mediating variables, and finally connects to the target variable to form a complete causal transmission chain.

[0039] In the example, the first causal path is 30-day historical volatility → 1-period lagged logarithmic return → 1-period future logarithmic return, where 30-day historical volatility is the root variable and 1-period lagged logarithmic return is the mediating variable; the second causal path is the rate of change in trading volume → 5-day rolling average volatility → 1-period future logarithmic return, where the rate of change in trading volume is the root variable and 5-day rolling average volatility is the mediating variable. All paths are unidirectional and acyclic, which aligns with the signal transmission logic of the financial market.

[0040] Spurious correlation paths refer to paths where variables are only statistically correlated but lack genuine causal drivers. These are primarily characterized by paths without a root cause node, bidirectional connections, or paths driven by third-party variables. Such paths interfere with causal determination and must be eliminated entirely. In the example, the logarithmic return and the lagged 2-period change in trading volume are only statistically correlated, lacking unidirectional causal drivers, thus constituting a spurious correlation path and being removed. Similarly, variable connections driven by unobserved external variables are also identified as spurious paths and deleted.

[0041] After completing path extraction and spurious path removal, the remaining valid causal paths, corresponding root variables, mediating variables, transmission directions, and driving relationships are integrated to form a complete causal path structure that drives changes in market state. This structure clarifies the source factors, transmission nodes, and transmission directions of market fluctuations, eliminates all meaningless spurious associations, and becomes the core input basis for subsequent stability judgment and position optimization models.

[0042] S203, using the Lyapunov stability criterion, the stability of the causal path formed by the root variable and the mediating variable is determined, and a stable causal feature set that maintains bounded convergence during the temporal evolution of the market state is selected. Specifically, for each causal path composed of root variables and mediating variables, a difference equation or differential equation model describing its dynamic evolution can be constructed to generate a causal path state transition model. The core of this step is to establish a mathematical evolutionary model for each causal path from the root dependent variable to the mediating variable, using dynamic equations to characterize the transmission law of variable changes over time, transforming abstract causal relationships into computable and analyzable state transition models, and providing a mathematical foundation for subsequent stability determination. The specific implementation method is as follows: A causal path is a directed transmission link in a directed acyclic causal graph where the root variable drives the mediator variable, thereby influencing the market state. Each path represents a clear market-driving mechanism. The root variable is the source driving factor of market fluctuations, and the mediator variable is the intermediate carrier that transmits causal influences. Both exhibit continuous dynamic evolution characteristics in time series data. Given the discrete sampling characteristics of financial market time series data, linear difference equations are preferentially used to construct dynamic evolution models. If high-frequency continuous market states are involved, ordinary differential equations are used. Both models can accurately characterize the strength of causal transmission and the time lag effect between variables.

[0043] Before constructing the model, we first extract the time-series observations of the root dependent variable and the mediating variable on each causal path, and clarify the lag order between the variables. In financial markets, lag orders of 1 to 5 are usually selected. In the example, a typical causal path is selected, with the root dependent variable being the historical market volatility V_t and the mediating variable being the logarithmic return of assets R_t. The lag order is set to 2, which can cover the transmission cycle of short-term market fluctuations.

[0044] The construction of the difference equation model follows the rules of linear dynamic systems. It represents the current value of the intermediate variable as a linear combination of the current and lagged values ​​of the root dependent variable and the lagged values ​​of the intermediate variable. At the same time, a random disturbance term is added to characterize market noise. The difference equation constructed in the example is R_t=a_1×V_t+a_2×V_t_1+a_3×R_t_1+b×ε_t, where a_1 and a_2 are the causal transmission coefficients of the root dependent variable, representing the direct driving strength of volatility on returns, a_3 is the autoregressive coefficient of the intermediate variable, representing the continuity of returns themselves, b is the disturbance term coefficient, and ε_t is Gaussian white noise with a mean of 0, representing random market fluctuations.

[0045] For continuous high-frequency market scenarios, a differential equation model uses time as a continuous variable to describe the instantaneous driving effect of the root variable on the mediating variable. The model form is dR(t) / dt=k×V(t)+c×R(t), where k is the instantaneous causal transmission coefficient and c is the decay coefficient, characterizing the dynamic decay rate of the mediating variable. After all causal paths are modeled, a standardized causal path state transition model is formed, including transmission coefficients, lag orders, and disturbance terms. The model parameters are obtained by fitting time-series data using the least squares method, with a goodness of fit controlled above 0.85 to ensure that the model can truly reflect the dynamic evolution of the causal path.

[0046] For each causal path state transition model, construct a Lyapunov candidate function, calculate the time derivative of the function along the dynamic evolution trajectory of the causal path, and generate a Lyapunov derivative sequence. The core of this step is to construct a Lyapunov candidate function specifically for stability determination. By calculating the time derivative of the function as it evolves along the causal path, the stability problem of the dynamic system is transformed into a numerical sign determination problem, generating a derivative sequence that can be quantified and analyzed. The specific implementation method is as follows: Lyapunov candidate functions are core mathematical tools for determining the stability of dynamic systems. For the linear dynamic characteristics of causal paths in financial markets, quadratic functions are uniformly selected as candidate functions. These functions are concise in form, computationally efficient, and suitable for the stability analysis of linear dynamic systems. They meet the basic requirements of boundedness and positive definiteness, and their function values ​​are always non-negative, taking a value of 0 only when the variables are in equilibrium.

[0047] For the causal path state transition model of discrete difference equations, the constructed Lyapunov candidate function is in the form V(x_t) = x_t^T × P × x_t, where x_t is the state vector consisting of the root dependent variable and the mediating variable at time t, x_t^T is the transpose of the state vector, and P is a positive definite symmetric matrix. The matrix elements are determined by eigenvalue decomposition to ensure that all eigenvalues ​​are positive, satisfying the positive definiteness requirement of the function. In the example, the state vector x_t consists of volatility V_t and return R_t. The positive definite matrix P is set as a two-dimensional diagonal matrix with diagonal elements of 1.2 and 0.9, respectively, to ensure the weight fit of the function with respect to the two variables.

[0048] For continuous differential equation models, the candidate function forms remain consistent, only the discrete time t is replaced with continuous time t. After the function is constructed, the time derivative of the function's dynamic evolution trajectory along the causal path is calculated. The derivative of the discrete model is calculated using the forward difference approximation, with the formula ΔV(x_t)=V(x_t_1)-V(x_t). The derivative of the continuous model is directly derived with respect to the function, with the formula dV(x) / dt=(dV / dx)×(dx / dt).

[0049] During the calculation, the variable values ​​of the causal path state transition model are substituted into the model at each time step to obtain the derivative value at each time step. The derivative values ​​at all time steps are arranged in chronological order to form the Lyapunov derivative sequence. In the example, the derivative sequence of the causal path contains derivative values ​​at 100 consecutive time steps, with values ​​ranging from -0.35 to -0.08. The sequence completely records the trend of function value changes over time, providing complete quantitative data for subsequent stability assessment.

[0050] Based on the Lyapunov derivative sequence, determine whether each causal path satisfies the bounded convergence condition, that is, the derivative is negative definite and the function value is bounded, and generate stability discrimination results; The core of this step is to determine the dynamic stability of a causal path based on the Lyapunov stability criterion, using the sign of the derivative sequence and the range of function values, and to screen out effective causal paths that remain convergent during market fluctuations. The specific implementation method is as follows: The Lyapunov stability criterion is the core theory for determining whether a dynamic system is stable. For causal paths in financial markets, stability is defined as the bounded convergence of variables during the time-series evolution. That is, market fluctuations do not lead to the loss of control over causal relationships, and the values ​​of variables are always maintained within a reasonable range without infinite divergence. The corresponding criteria are that the Lyapunov derivative is negative definite and the Lyapunov function value is bounded.

[0051] Negative definite derivative means that the derivative value at all times in the Lyapunov derivative sequence is strictly less than 0, indicating that the function value continuously decreases over time, and the dynamic evolution of the causal path gradually tends towards an equilibrium state without divergent fluctuations. Bounded function value means that the value of the Lyapunov candidate function at all times is less than a preset upper bound value. The upper bound value is set according to the normal fluctuation range of financial market variables. In the example, the upper bound value is set to 2.5, which means that the fluctuation of the variable is within the acceptable range of the market and there will be no extreme outliers.

[0052] During the discrimination process, all values ​​of the Lyapunov derivative sequence are iterated one by one to confirm that all derivative values ​​are negative, satisfying the negative definiteness requirement. At the same time, the function values ​​at all time points are calculated to confirm that the maximum value is less than a preset upper bound, satisfying the boundedness requirement. If both conditions are met, the causal path is determined to be a stable causal path. If either condition is not met, such as the appearance of a positive derivative or the function value exceeding the bound, it is determined to be an unstable causal path.

[0053] In the example, all values ​​in the derivative sequence of the target causal path are less than 0, and the maximum function value is 1.8, which is less than the upper bound of 2.5, therefore the result is stable. The derivative sequence of another causal path shows a positive value of 0.05, indicating instability. After all causal paths are identified, a standardized stability assessment result is generated, including path number, root dependent variable, mediating variable, and assessment conclusion. The result clearly distinguishes between stable and unstable paths, providing a clear basis for subsequent feature selection.

[0054] We select the root cause variables and mediator variables corresponding to the causal paths that satisfy the stability criteria, and combine them into a stable causal feature set that maintains bounded convergence in the market time series evolution.

[0055] The core of this step is to eliminate unstable causal paths and variables based on the stability assessment results, retain stable and effective driving features, and combine them into a stable causal feature set that is suitable for reinforcement learning models. This ensures that subsequent position optimization is based on reliable market driving factors. The specific implementation method is as follows: The screening rules strictly follow the stability assessment results, retaining only causal paths with stable outcomes. Root and mediating variables are extracted for each path, while all variables corresponding to unstable paths are eliminated to prevent unreliable driving factors from interfering with position optimization decisions. During the screening process, the original meaning and temporal attributes of the variables are preserved without altering their numerical characteristics, ensuring the authenticity and usability of the features.

[0056] After screening, the example retained three stable causal paths, with the root variables being historical market volatility, rate of change in trading volume, and macro capital flow velocity, and the mediating variables being logarithmic asset return, bid-ask spread, and position concentration. These variables all maintain bounded convergence in the market time series evolution, can stably drive changes in market state, and have no spurious correlations or divergence risks.

[0057] During the combination process, the selected root and mediating variables are arranged according to the transmission order of the causal path, forming a structured feature set. The feature set includes variable names, time-series indices, numerical sequences, and causal transmission coefficients. All variables are standardized to ensure uniformity of dimensions, allowing direct input into the reinforcement learning position optimization model. The dimensionality of the feature set is determined by the number of stable paths. In the example, the stable causal feature set contains six feature variables, a moderate dimensionality that preserves complete causal driving information while avoiding overfitting due to excessive dimensionality.

[0058] The final stable causal feature set is an effective feature set that has been verified by both causal discovery and stability. It fully conforms to the dynamic evolution law of the financial market, accurately reflects the stable driving mechanism of the market state, provides high-quality input features for subsequent reinforcement learning models, and ensures the reliability and stability of dynamic position optimization.

[0059] S204, the stable causal feature set is input into the pre-constructed reinforcement learning position optimization model, the position adjustment coefficient is output in combination with the current causal state, and the asset allocation rebalancing operation is performed in real time according to the position adjustment coefficient to generate a dynamically optimized position distribution vector.

[0060] Specifically, a stable causal feature set can be input into the state encoder of a pre-trained reinforcement learning position optimization model. This encoder maps the features to the current causal state vector and generates a causal state representation. The core of this step is to use a state encoder to perform vectorization mapping of stable causal features, transforming discrete causal features into continuous state vectors that can be recognized by the reinforcement learning model. This establishes a precise correspondence between causal features and market trading states, providing standardized input for subsequent position decisions. The specific implementation method is as follows: The stable causal feature set is an effective feature set after causal discovery and Lyapunov stability screening. It contains the root and mediating variables that drive changes in market state and covers the stable causal dimensions of price fluctuations, trading volume, and volatility. In the example, the stable causal feature set includes five features: logarithmic return, rate of change of trading volume, 30-day historical volatility, first-order lag volatility feature, and rolling mean of return. Each feature satisfies the stability condition of bounded convergence of time series evolution and is free from spurious correlations and unstable disturbances.

[0061] The pre-trained reinforcement learning position optimization model employs a near-end strategy optimization architecture, which is suitable for continuous decision-making scenarios in quantitative trading. The training process aims to maximize cumulative returns and minimize risk. It was trained offline using historical market data, and the model weights have converged to their optimal state, making it ready for direct real-time inference. The state encoder is the core unit for feature preprocessing in the model, employing a multi-layer fully connected encoding structure. The first layer is a feature normalization layer, mapping the values ​​of stable causal features to a unified range of 0 to 1, eliminating decision bias caused by differences in feature values. The second layer is a non-linear mapping layer, using the ReLU activation function to extract higher-order correlation information of features. The third layer is a dimensionality reduction output layer, compressing high-dimensional features into a continuous vector of fixed dimensions.

[0062] During the encoding and mapping process, the time-series slices of the stable causal feature set are used as the input at the current moment. The encoder extracts causal correlation information feature by feature and completes nonlinear transformation through weight matrix operations. Finally, a 128-dimensional continuous causal state vector is output. Each element in the vector corresponds to the encoded value of a causal feature, which fully preserves the driving relationship and time-series information of the stable causal features. This vector is the causal state representation at the current moment, which can accurately characterize the causal driving state of the market and provide a basis for the position decision of the strategy network.

[0063] Based on causal state representation, the reinforcement learning model outputs position adjustment coefficients through the policy network. These coefficients represent the weight adjustment ratios of each asset, thus yielding the original position adjustment coefficients. The core of this step is to rely on a reinforcement learning strategy network to infer the position adjustment ratio of each asset based on the causal state representation, and output the original adjustment coefficients without risk constraints, thus realizing a direct mapping from causal state to position decision. The specific implementation method is as follows: The policy network is the decision-making core of the reinforcement learning position optimization model. It adopts a multilayer perceptron structure that matches the state encoder. The input layer receives a 128-dimensional causal state representation. The hidden layer mines the association rules between the state and the optimal position through fully connected operations. The output layer uses the Softmax activation function to ensure the continuity and non-negativity of the output coefficients. The output dimension is consistent with the number of assets in quantitative trading. In the example, the trading assets include four types of assets: stocks, stock index futures, treasury bond futures, and money market funds. Therefore, the output layer dimension is 4.

[0064] During the decision-making process, after receiving the current causal state representation, the strategy network, based on the causal decision logic learned through offline training, outputs position adjustment coefficients combined with the causal driving direction of the market state. These coefficients represent the adjustment ratio of the weighting of each asset class; positive numbers represent increasing positions, negative numbers represent decreasing positions, and the magnitude of the value represents the adjustment range. In the example, the current causal state representation shows that the market is in a stable causal state of converging volatility and rising returns. The original position adjustment coefficients output by the strategy network are 0.15 for stocks, 0.08 for stock index futures, -0.12 for treasury bond futures, and -0.11 for money market funds, representing a suggested increase in stock holdings by 15%, an increase in stock index futures holdings by 8%, a decrease in treasury bond futures holdings by 12%, and a decrease in money market funds holdings by 11%.

[0065] The original position adjustment coefficient directly reflects the optimal adjustment direction under causal conditions. It does not take into account the risk control rules of actual trading and belongs to the pure strategy level decision output. It needs to be calibrated for risk before it can be used for actual trading. The numerical precision of the coefficient is controlled to two decimal places to ensure the accuracy of the adjustment ratio.

[0066] The original position adjustment coefficient is calibrated with risk constraints to ensure that the adjusted position does not exceed the maximum holding limit and leverage limit, thereby generating a compliant position adjustment coefficient; The core of this step is to modify the original position adjustment coefficient through risk constraint rules, combining strategy decisions with quantitative trading risk control requirements to avoid exceeding position limits and excessive leverage, and generating a compliant adjustment coefficient that conforms to trading rules. The specific implementation method is as follows: Risk constraint calibration is a key step in ensuring the safety of quantitative trading. The calibration rules include two core constraints: maximum position limit and leverage limit. The maximum position limit is used to control the concentration risk of a single asset, setting the maximum weight of a single asset class at 30%, meaning that the adjusted weight of any asset cannot exceed 30% of the total position. The leverage limit is used to control the leverage risk of the overall trading, setting the total leverage ratio to not exceed 2 times, meaning that the sum of the weighted leverage of all risky assets cannot exceed the upper limit of 2 times.

[0067] The calibration process employs a combination of segmented truncation and proportional scaling. First, the original position adjustment coefficients are initially superimposed to calculate the expected weights of various assets after adjustment. If the expected weight of a certain asset exceeds the maximum holding limit of 30%, the adjustment coefficient of that asset is truncated to the upper limit threshold. In the example, the original adjusted weight of stocks is 35%, which exceeds the 30% upper limit, so its adjustment coefficient is corrected to 0.10, reducing the expected weight to 30%. Subsequently, the overall leverage ratio is calculated. If the total leverage exceeds the upper limit of 2 times, the adjustment coefficients of all risky assets are proportionally reduced while maintaining the adjustment ratio between assets unchanged until the leverage is compliant.

[0068] Simultaneously, coefficient smoothing constraints are set to avoid excessively large single adjustments leading to high transaction impact costs. The absolute value of a single asset adjustment coefficient is set to not exceed 0.20, and coefficients exceeding the smoothing constraints are subject to secondary correction. After multi-layer calibration, all adjustment coefficients meet risk control rules, with no issues of exceeding limits, leverage, or magnitude. These coefficients are then the compliant position adjustment coefficients. In the example, the calibrated compliant coefficients are 0.10 for stocks, 0.06 for stock index futures, -0.09 for treasury bond futures, and -0.07 for money market funds, preserving the strategy decision-making direction while fully complying with transaction risk control requirements.

[0069] Based on the compliant position adjustment coefficient, the asset allocation rebalancing operation is performed in real time, the holding weight of each asset is updated, and finally a dynamically optimized position distribution vector is generated.

[0070] The core of this step is to rebalance positions in real time based on compliant position adjustment coefficients, update the holding weights of various assets, form the optimal position distribution that adapts to the current cause-and-effect market conditions, and realize the closed-loop execution of dynamic position optimization. The specific implementation method is as follows: Asset rebalancing is a real-time execution step in the quantitative trading system, with execution latency controlled within 50 milliseconds to ensure that position adjustments are synchronized with market conditions. The operation logic is to use the current holding weights as a benchmark, add a compliant position adjustment coefficient to obtain the updated target holding weights, and then automatically complete the addition and reduction operations through the trading interface. Before execution, the real-time holding weights of each asset are read. In the example, the initial position distribution is 25% stocks, 22% stock index futures, 28% treasury bond futures, and 25% money market funds. After adding the compliant adjustment coefficient, the target weights are updated to 30% stocks (corrected from 35%), 28% stock index futures, 19% treasury bond futures, and 18% money market funds.

[0071] During the rebalancing process, strict adherence to trading priority rules is maintained. Position reduction operations are executed first to release funds, followed by position addition operations to allocate assets. This avoids trading failures due to insufficient funds and controls slippage by employing batch order placement to reduce market impact. After the weights are updated, the final holding weights of various assets are integrated in a fixed order to form a one-dimensional continuous position distribution vector. The vector dimension is consistent with the number of assets, and each element corresponds to the real-time holding weight of a class of assets, with numerical precision controlled to two decimal places.

[0072] In the example, the dynamically optimized position distribution vector is 30% stocks, 28% stock index futures, 19% treasury bond futures, and 18% money market funds. This vector perfectly matches the current causal driving state of the market, both mitigating market risks based on stable causal features and maximizing returns through reinforcement learning decision-making, while simultaneously satisfying all risk control constraints. After the position distribution vector is generated, it is synchronized to the trading monitoring system to track weight changes and return performance in real time, providing basic data for the next round of causal feature extraction and position optimization for time-series slices, forming a continuously iterative dynamic position optimization closed loop.

[0073] Another embodiment of the present invention provides a dynamic position optimization system for quantitative trading based on causal inference, see [link to relevant documentation]. Figure 3 The system may include: The acquisition module 301 is used to collect multi-source market time-series data and perform standardization and feature engineering processing to generate a state feature sequence containing price fluctuations, trading volume and volatility indicators. The construction module 302 is used to construct a directed acyclic causal graph based on the state feature sequence using a causal discovery algorithm to identify direct causal driving relationships between variables and eliminate false correlations, and to extract root variables and mediator variables that drive changes in market state through the directed acyclic causal graph. The screening module 303 is used to use the Lyapunov stability criterion to determine the stability of the causal path formed by the root variable and the mediating variable, and to screen the stable causal feature set that maintains bounded convergence during the time-series evolution of the market state. The optimization module 304 is used to input the stable causal feature set into a pre-constructed reinforcement learning position optimization model, output position adjustment coefficients in combination with the current causal state, and perform asset allocation rebalancing operations in real time according to the position adjustment coefficients to generate a dynamically optimized position distribution vector.

[0074] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0075] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0076] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.

[0077] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A dynamic position optimization method for quantitative trading based on causal inference, characterized in that, The method includes: Collect multi-source market time-series data and perform standardization and feature engineering to generate a state feature sequence that includes price fluctuations, trading volume and volatility indicators; Based on the state feature sequence, a causal discovery algorithm is used to construct a directed acyclic causal graph to identify direct causal driving relationships between variables and eliminate spurious correlations. The root variables and mediating variables that drive changes in market state are extracted through the directed acyclic causal graph. Using the Lyapunov stability criterion, the stability of the causal path formed by the root variable and the mediating variable is determined, and a stable causal feature set that maintains bounded convergence during the temporal evolution of market states is selected. The stable causal feature set is input into a pre-constructed reinforcement learning position optimization model, and the position adjustment coefficient is output in combination with the current causal state. The asset allocation rebalancing operation is performed in real time according to the position adjustment coefficient to generate a dynamically optimized position distribution vector.

2. The method according to claim 1, characterized in that, The process involves collecting multi-source market time-series data, standardizing and performing feature engineering to generate a state feature sequence containing price fluctuations, trading volume, and volatility indicators, including: Collect multi-source market time-series data from the financial market to generate a raw multi-source dataset; Missing values ​​were imputed and outliers were removed from the original multi-source dataset. The Z-score method was used to standardize the data to unify the dimensions of each indicator and generate a standardized market data sequence. Based on standardized market data sequences, the logarithmic return within a sliding window is calculated as a price volatility indicator, the volume change rate is calculated as a volume indicator, and the historical volatility is calculated as a volatility indicator, generating a set of basic feature indicators. Lag features are constructed and rolling statistics are extracted from the basic feature indicator set to generate a state feature sequence that includes price fluctuation, trading volume and volatility indicators.

3. The method according to claim 2, characterized in that, Based on the state feature sequence, a causal discovery algorithm is used to construct a directed acyclic causal graph to identify direct causal driving relationships between variables and eliminate spurious correlations. The root cause variables and mediating variables driving changes in market state are extracted through the directed acyclic causal graph, including: The state feature sequence is input into a constraint-based causal discovery algorithm. The conditional dependency relationship between each feature variable is determined by the conditional independence test, and an initial causal skeleton graph is generated. The initial causal skeleton graph is oriented using a scoring search method, and the causal direction of each edge is determined by a greedy equivalence search algorithm to generate a directed acyclic causal graph. Based on the directed acyclic causal graph, the in-degree and out-degree of each variable are calculated, variables without parent nodes are identified as root variables, and variables with both parent and child nodes are identified as mediator variables, generating a list of root variables and mediator variables. The causal path from root variable to mediator variable to target variable is extracted from the directed acyclic causal graph, spurious correlation paths are eliminated, and finally the root variable and mediator variable and their causal path structure driving changes in market state are generated.

4. The method according to claim 3, characterized in that, The method of using the Lyapunov stability criterion to determine the stability of the causal path formed by the root variable and the mediating variable, and screening for a stable causal feature set that maintains bounded convergence during the temporal evolution of market states, includes: For each causal path consisting of the root dependent variable and the mediating variable, construct a difference equation or differential equation model to describe its dynamic evolution, and generate a causal path state transition model. For each causal path state transition model, construct a Lyapunov candidate function, calculate the time derivative of the function along the dynamic evolution trajectory of the causal path, and generate a Lyapunov derivative sequence. Based on the Lyapunov derivative sequence, determine whether each causal path satisfies the bounded convergence condition, that is, the derivative is negative definite and the function value is bounded, and generate stability discrimination results; We select the root cause variables and mediator variables corresponding to the causal paths that satisfy the stability criteria, and combine them into a stable causal feature set that maintains bounded convergence in the market time series evolution.

5. The method according to claim 4, characterized in that, The process of inputting the stable causal feature set into a pre-constructed reinforcement learning position optimization model, outputting position adjustment coefficients based on the current causal state, and performing real-time asset allocation rebalancing based on the position adjustment coefficients to generate a dynamically optimized position distribution vector includes: The stable causal feature set is input into the state encoder of the pre-trained reinforcement learning position optimization model. The encoder maps the features to the current causal state vector and generates a causal state representation. Based on causal state representation, the reinforcement learning model outputs position adjustment coefficients through the policy network. These coefficients represent the weight adjustment ratios of each asset, thus yielding the original position adjustment coefficients. The original position adjustment coefficient is calibrated with risk constraints to ensure that the adjusted position does not exceed the maximum holding limit and leverage limit, thereby generating a compliant position adjustment coefficient; Based on the compliant position adjustment coefficient, the asset allocation rebalancing operation is performed in real time, the holding weight of each asset is updated, and finally a dynamically optimized position distribution vector is generated.

6. A dynamic position optimization system for quantitative trading based on causal inference, characterized in that, The system includes: The data acquisition module is used to collect multi-source market time-series data and perform standardization and feature engineering processing to generate a state feature sequence that includes price fluctuations, trading volume and volatility indicators. The module is used to construct a directed acyclic causal graph based on the state feature sequence and using a causal discovery algorithm to identify direct causal driving relationships between variables and eliminate spurious correlations. The root variables and mediating variables that drive changes in market state are extracted through the directed acyclic causal graph. The screening module is used to use the Lyapunov stability criterion to determine the stability of the causal path formed by the root variable and the mediating variable, and to screen the stable causal feature set that maintains bounded convergence during the time-series evolution of the market state. The optimization module is used to input the stable causal feature set into a pre-built reinforcement learning position optimization model, output position adjustment coefficients in combination with the current causal state, and perform asset allocation rebalancing operations in real time according to the position adjustment coefficients to generate a dynamically optimized position distribution vector.

7. The system according to claim 6, characterized in that, The acquisition module is specifically used for: Collect multi-source market time-series data from the financial market to generate a raw multi-source dataset; Missing values ​​were imputed and outliers were removed from the original multi-source dataset. The Z-score method was used to standardize the data to unify the dimensions of each indicator and generate a standardized market data sequence. Based on standardized market data sequences, the logarithmic return within a sliding window is calculated as a price volatility indicator, the volume change rate is calculated as a volume indicator, and the historical volatility is calculated as a volatility indicator, generating a set of basic feature indicators. Lag features are constructed and rolling statistics are extracted from the basic feature indicator set to generate a state feature sequence that includes price fluctuation, trading volume and volatility indicators.

8. The system according to claim 7, characterized in that, The building module is specifically used for: The state feature sequence is input into a constraint-based causal discovery algorithm. The conditional dependency relationship between each feature variable is determined by the conditional independence test, and an initial causal skeleton graph is generated. The initial causal skeleton graph is oriented using a scoring search method, and the causal direction of each edge is determined by a greedy equivalence search algorithm to generate a directed acyclic causal graph. Based on the directed acyclic causal graph, the in-degree and out-degree of each variable are calculated, variables without parent nodes are identified as root variables, and variables with both parent and child nodes are identified as mediator variables, generating a list of root variables and mediator variables. The causal path from root variable to mediator variable to target variable is extracted from the directed acyclic causal graph, spurious correlation paths are eliminated, and finally the root variable and mediator variable and their causal path structure driving changes in market state are generated.

9. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method of any one of claims 1-5 when it is run.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method of any one of claims 1-5.