Stock combination anti-fluctuation optimization method and system
By optimizing stock portfolio weights through Monte Carlo simulation and dynamic factor models, and combining them with a visual interface to display the risk-return ratio, we can solve the problem of poor performance of traditional methods under extreme market conditions, achieve a better risk-return balance and assist in investment decision-making.
Patent Information
- Application Number
- CN202511096175.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-09-12
AI Technical Summary
Traditional stock portfolio optimization methods perform poorly under extreme market conditions, have difficulty coping with complex market environments, cannot effectively balance risk and return, and are highly sensitive to parameter estimation, making investment decisions difficult.
Monte Carlo simulation is combined with macroeconomic indicators, and the stock portfolio weights are adjusted through the mean-variance model and dynamic factor model. A visual interface is used to display the dynamic changes in the risk-return ratio to assist investment decisions.
It enhances the flexibility and foresight of investment decisions, improves the risk resistance of stock portfolios, balances risks and returns, and provides more scientific decision-making support tools.
Smart Images

Figure CN120634730A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology, and in particular to a method and system for optimizing a stock portfolio against volatility. Background Art
[0002] In the field of modern financial investment, how to build a stock portfolio that can withstand fluctuations and have good returns in an uncertain market environment has been a core issue that investors and financial analysts have long paid attention to.
[0003] With the development of financial markets and the improvement of data acquisition capabilities, traditional stock portfolio optimization methods have gradually exposed their limitations. Although traditional stock portfolios (such as the Markowitz mean-variance model) provide a quantitative framework for risk and return in theory, in actual applications, their ability to predict market fluctuations is limited and they are highly sensitive to parameter estimation, resulting in poor performance under extreme market conditions. They find it difficult to cope with the increasingly complex market environment and achieve a better balance between risk and return, and are therefore unable to effectively assist investors in making investment decisions. Summary of the Invention
[0004] Based on this, it is necessary to provide a stock portfolio anti-volatility optimization method and system that can cope with the increasingly complex market environment and balance risks and returns in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for optimizing a stock portfolio against volatility, the method comprising: Obtaining macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; Based on the macroeconomic indicators, predict the stock portfolio under different market environments through Monte Carlo simulation; Obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the stock portfolio after the adjustment; Calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The historical risk-return ratio of the stock portfolio is obtained, and the risk-return ratio of the stock portfolio and the historical risk-return ratio are displayed through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
[0006] In one embodiment, obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model in combination with a dynamic factor model, and evaluating the expected return and risk of the adjusted stock portfolio includes: Obtain historical stock characteristic data, and predict the rate of return and risk of each stock through the dynamic factor model FactorVAE based on the historical stock characteristic data; According to the rate of return and risk of each stock, the weight of the stock portfolio is adjusted through the mean-variance model, and the expected return and risk of the stock portfolio after adjustment are evaluated.
[0007] In one embodiment, obtaining historical stock characteristic data and predicting the rate of return and risk of each stock using a dynamic factor model FactorVAE based on the historical stock characteristic data includes: Obtain historical price data for each stock, and predict the price fluctuations of each stock based on the historical price data of each stock through a two-layer LSTM network; Obtain future returns of each stock based on the price fluctuations of each stock; Obtain historical stock characteristic data, and predict the rate of return and risk of each stock through the dynamic factor model FactorVAE based on the historical stock characteristic data and the future returns of each stock.
[0008] In one embodiment, obtaining historical price data of each stock and predicting price fluctuations of each stock using a two-layer LSTM network based on the historical price data of each stock includes: Obtaining historical price data for each stock, and cleaning and standardizing the historical price data; The processed historical price data is input into a two-layer LSTM network to capture the long-term dependencies of stock prices; Based on the long-term dependency of the stock prices, the price fluctuations of the stocks are predicted.
[0009] In one embodiment, obtaining historical stock characteristic data and predicting the rate of return and risk of each stock using a dynamic factor model FactorVAE based on the historical stock characteristic data and the future returns of each stock includes: Obtain historical stock feature data, and extract potential features of each stock from the historical stock feature data using a dynamic factor model, FactorVAE; extracting posterior factors from the latent characteristics and the future returns of each stock; The rate of return and risk of each stock are predicted based on the posterior factors and the potential characteristics.
[0010] In one embodiment, adjusting the weight of the stock portfolio based on the rate of return and risk of each stock using a mean-variance model, and evaluating the expected return and risk of the stock portfolio after adjustment includes: Obtaining the expected rate of return set, and solving the optimal weight configuration of stocks using the mean-variance model based on the expected rate of return and the rate of return and risk of each stock; Adjusting the weight of the stock portfolio according to the optimal weight configuration of the stocks; Evaluate the expected returns and risks of the adjusted stock portfolio.
[0011] In one embodiment, calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio includes: Obtain risk-free interest rates; The risk-return ratio of the stock portfolio is calculated based on the risk-free interest rate, the expected return and the risk of the stock portfolio.
[0012] In a second aspect, the present application also provides a stock portfolio anti-volatility optimization device. The device comprises: An economic indicator acquisition module, used to acquire macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; a stock portfolio simulation module, for predicting stock portfolios under different market environments through Monte Carlo simulation based on the macroeconomic indicators; A return and risk assessment module is used to obtain historical stock characteristic data, adjust the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluate the expected return and risk of the stock portfolio after the adjustment; a risk-return ratio calculation module, configured to calculate the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The risk-return ratio display module is used to obtain the historical risk-return ratio of the stock portfolio and display the risk-return ratio of the stock portfolio and the historical risk-return ratio through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
[0013] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed: Obtaining macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; Based on the macroeconomic indicators, predict the stock portfolio under different market environments through Monte Carlo simulation; Obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the stock portfolio after the adjustment; Calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The historical risk-return ratio of the stock portfolio is obtained, and the risk-return ratio of the stock portfolio and the historical risk-return ratio are displayed through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps: Obtaining macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; Based on the macroeconomic indicators, predict the stock portfolio under different market environments through Monte Carlo simulation; Obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the stock portfolio after the adjustment; Calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The historical risk-return ratio of the stock portfolio is obtained, and the risk-return ratio of the stock portfolio and the historical risk-return ratio are displayed through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
[0015] In summary, this application has the following beneficial technical effects: Through Monte Carlo simulation, multiple scenarios of the future market are simulated based on macroeconomic indicators, so as to predict stock portfolios under different market environments to cope with the increasingly complex market environment and enhance the flexibility and foresight of investment decisions; combined with historical stock characteristic data, the mean-variance model is adopted and the dynamic factor model is introduced to dynamically adjust the weights of the stock portfolio, thereby improving the risk resistance of the stock portfolio and maximizing the expected return while controlling the risk, thus achieving a good balance between risk and return; in addition, the historical and current risk-return ratios are displayed through a visual interface, so that investors can intuitively understand the dynamic changes of the stock portfolio, thereby assisting them in making more scientific decisions. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a flow chart of a method for optimizing a stock portfolio against volatility in one embodiment; Figure 2 This is a structural block diagram of a stock portfolio anti-volatility optimization device in one embodiment; Figure 3 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0017] The embodiments of the present invention provide a method and system for optimizing a stock portfolio against fluctuations.
[0018] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0019] In the description of the embodiments disclosed herein, the term "including" and similar terms should be understood as open inclusion, i.e., "including but not limited to." The term "based on" should be understood as "based, at least in part, on." The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment." The terms "first," "second," etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0020] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 An embodiment of the stock portfolio anti-volatility optimization method in an embodiment of the present invention includes: S100, obtain macroeconomic indicators.
[0021] Among them, macroeconomic indicators include key variables in the economic system.
[0022] Specifically, macroeconomic indicators are a way to reflect economic conditions. Key indicators include GDP growth, interest rate changes, GDP, consumer price index, investment indicators, and fiscal indicators. Macroeconomic indicators play an important role in analyzing and providing reference for macroeconomic regulation.
[0023] S200, based on macroeconomic indicators, predicts stock portfolios under different market environments through Monte Carlo simulation.
[0024] Monte Carlo simulation is a numerical method based on probability and random sampling that simulates the possible outcomes of a system by generating a large number of random variables. It primarily assesses the returns and risks of an investment portfolio by simulating changes in asset prices under different market conditions.
[0025] Specifically, using macroeconomic indicators as variables, Monte Carlo simulations are used to predict stock portfolios under different market environments. Specifically, historical data on stocks and macroeconomic indicators is first collected and standardized. Then, the mean, volatility, and correlation of asset returns are estimated based on this historical data. A random variable is generated using a normal, lognormal, or other appropriate distribution. This random variable represents the potential return on stock investments under different market environments (such as high interest rates, low inflation, or economic recession). By generating combinations of multiple random variables, the returns and risks of various stock portfolios can be simulated. Finally, based on the mean, volatility, and correlation of asset returns, the weights of different stocks are selected to construct the stock portfolio.
[0026] In this embodiment, using macroeconomic indicators as variables in the Monte Carlo simulation can more accurately reflect changes in the market environment, thereby improving the reliability of the forecast.
[0027] S300, obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data through a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the adjusted stock portfolio.
[0028] Among them, historical stock feature data includes multiple dimensions, such as opening price, closing price, highest price, lowest price, trading volume, etc.
[0029] Specifically, the mean-variance model optimizes the weights of an investment portfolio under certain constraints to achieve maximum return at a given risk level, or to minimize risk at a given return level. The dynamic factor model is a statistical model used to capture common changes between assets and is typically used to construct risk factors or market factors for assets. In portfolio optimization, the dynamic factor model can be used to predict the future returns and risks of assets, thereby providing more accurate input parameters for the mean-variance model. Specifically, different stock portfolios are first predicted through Monte Carlo simulation. Then, based on historical stock characteristic data, the dynamic factor model is used to predict the future returns and risks of stocks under a given expected rate of return. Finally, based on the future returns and risks of stocks, the mean-variance model is used to optimize and adjust the weights of the stock portfolio, and the expected returns and risks of the adjusted stock portfolio are evaluated.
[0030] In this example, the mean-variance model quantifies the expected returns and risks of stocks, providing investors with a systematic framework for maximizing returns while controlling risk. Combined with a dynamic factor model, it can further capture the systematic and non-systematic risks across stocks, allowing for more accurate identification of assets with high risk-adjusted returns. Combining the mean-variance model with a dynamic factor model can effectively reduce the volatility of a stock portfolio, thereby increasing returns at the same risk level or reducing risk at the same return level.
[0031] S400, calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio.
[0032] Among them, the risk-return ratio (Sharpe ratio) measures the excess return of a stock portfolio under unit risk.
[0033] Specifically, after estimating the expected return and risk of the stock portfolio, the risk-return ratio can be calculated using the expected return and risk.
[0034] S500 obtains the historical risk-return ratio of a stock portfolio and displays the risk-return ratio and historical risk-return ratio of the stock portfolio through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
[0035] Specifically, visualization tools are used to construct and analyze investment portfolio performance. The historical risk-return ratio of a stock portfolio is obtained and displayed on a visual interface alongside the historical risk-return ratio. Users can intuitively see how the risk-return ratio of a stock portfolio changes over different time periods, thereby determining whether its performance meets expectations. Furthermore, by comparing the risk-return ratio of a stock portfolio with its historical risk-return ratio, users can evaluate the long-term performance of different investment portfolios and select the optimal strategy.
[0036] In one embodiment, obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the adjusted stock portfolio include: Obtain historical stock characteristic data, and based on the historical stock characteristic data, use the dynamic factor model FactorVAE to predict the return and risk of each stock; based on the return and risk of each stock, use the mean-variance model to adjust the weight of the stock portfolio, and evaluate the expected return and risk of the adjusted stock portfolio.
[0037] Specifically, the dynamic factor model uses the FactorVAE model, a deep learning method that combines a variational autoencoder (VAE) and a probabilistic dynamic factor model (DFM) to predict stock returns and risks. This model uses components such as a feature extractor and a factor encoder to extract latent features from historical data and use these features for prediction. Specifically, the FactorVAE model extracts the latent features of each stock and predicts its return and risk. A mean-variance model is then used to adjust the weights of the stock portfolio based on the return and risk predicted by the FactorVAE model. This step requires that the stock portfolio's constraints be met, such as the weights summing to 1 and being non-negative. After adjusting the weights of the stock portfolio, the expected return and risk of the portfolio are calculated.
[0038] In this example, the FactorVAE model effectively captures the complex structure of stock returns and extracts effective factors from noisy data. The mean-variance model can then use the returns and risks predicted by the FactorVAE model to optimize the weights of the stock portfolio. By combining the predictive power of the FactorVAE model with the optimization capabilities of the mean-variance model, dynamic adjustments of stock weights can be achieved to adapt to market changes and investor needs.
[0039] In one embodiment, obtaining historical stock feature data and predicting the rate of return and risk of each stock using a dynamic factor model FactorVAE based on the historical stock feature data includes: Obtain the historical price data of each stock, and based on the historical price data of each stock, use a two-layer LSTM network to predict the price fluctuations of each stock; based on the price fluctuations of each stock, obtain the future returns of each stock; obtain historical stock feature data, and based on the historical stock feature data and the future returns of each stock, use the dynamic factor model FactorVAE to predict the rate of return and risk of each stock.
[0040] Specifically, by analyzing the historical price data of each stock, LSTM can identify patterns in price fluctuations and predict future prices. The present invention uses a two-layer LSTM network to predict stock prices. The two-layer LSTM network consists of two layers of LSTM. LSTM is a special recurrent neural network (RNN). By introducing gate mechanisms (such as forget gates, input gates, and output gates), it addresses the common gradient vanishing or gradient exploding problems in traditional RNNs. This allows it to better capture long-term dependencies in sequence data and significantly improve prediction accuracy. First, the historical price data of each stock is obtained and preprocessed. The preprocessed data is input into the two-layer LSTM network to predict the price fluctuations of each stock and calculate the future returns of each stock. Then, the dynamic factor model FactorVAE is used to extract the potential characteristics of each stock from the historical stock feature data. Based on the potential characteristics and the future returns of each stock, the rate of return and risk of each stock are predicted.
[0041] In one embodiment, obtaining historical price data of each stock and predicting the price fluctuation of each stock through a two-layer LSTM network based on the historical price data of each stock includes: Obtain historical price data for each stock, cleanse and standardize the data, input the processed data into a two-layer LSTM network to capture the long-term dependencies of stock prices, and predict the price fluctuations of each stock based on the long-term dependencies of stock prices.
[0042] Specifically, historical price data undergoes preprocessing, including cleaning and standardization. This preprocessed data is then serialized into a format suitable for LSTM network input. Specifically, a time window (e.g., 60 days) is defined, with 60 consecutive days of data used as input and the price on the 61st day as output. The data for each time window is converted into a two-dimensional matrix, where each row represents the feature vector for a time step. A two-layer LSTM network is then constructed and fed into the processed data to capture long-term dependencies in stock prices. Finally, based on these captured long-term dependencies, price fluctuations of individual stocks are predicted.
[0043] In one embodiment, historical stock characteristic data is obtained, and based on the historical stock characteristic data and the future returns of each stock, the dynamic factor model FactorVAE is used to predict the rate of return and risk of each stock, including: Obtain historical stock characteristic data, and use the dynamic factor model FactorVAE to extract the potential characteristics of each stock from the historical stock characteristic data; extract posterior factors from the potential characteristics and the future returns of each stock; and predict the rate of return and risk of each stock based on the posterior factors and potential characteristics.
[0044] Specifically, the structure of FactorVAE includes three core modules: feature extractor, factor encoder, and factor decoder. These modules work together to extract latent features from historical stock feature data and reconstruct or predict the future returns of stocks through factor modeling. Specifically, the feature extractor is the first part of FactorVAE, and its main task is to extract the latent features of each stock from historical stock feature data. These latent features capture the dynamic changes of stocks in time series. The factor encoder is the core part of FactorVAE, and its main task is to extract posterior factors from future stock returns and latent features. These factors can be regarded as potential drivers of stock returns and are used to reconstruct the future returns of stocks. The factor decoder is the third part of FactorVAE, and its task is to use factors and latent features to calculate stock returns and calculate the rate of return and risk of each stock.
[0045] In one embodiment, based on the return rate and risk of each stock, the weight of the stock portfolio is adjusted using a mean-variance model, and the expected return and risk of the adjusted stock portfolio are evaluated, including: Obtain the set expected rate of return, and based on the expected rate of return and the rate of return and risk of each stock, use the mean-variance model to solve the optimal stock weight configuration; adjust the weight of the stock portfolio based on the optimal stock weight configuration; and evaluate the expected return and risk of the adjusted stock portfolio.
[0046] Specifically, the dynamic factor model FactorVAE is used to predict the return and risk of each stock. After the return and risk of each stock are predicted, the mean-variance model is used to solve for the optimal weight configuration. The mean-variance model assumes that the return of a stock portfolio is the weighted average of the returns of each stock, while the risk is determined by the variance and covariance of each stock. The expected return and risk of the stock portfolio can be calculated using the predicted return and risk (variance) of each stock. In the mean-variance model, the weights of the stock portfolio are adjusted based on a given expected return target to maximize the expected return at a given risk level, or minimize the risk at a given expected return. This is usually achieved through the Lagrange multiplier method or quadratic programming solution.
[0047] In one embodiment, calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio includes: Obtain the risk-free interest rate; calculate the risk-return ratio of the stock portfolio based on the risk-free interest rate, the expected return of the stock portfolio, and the risk.
[0048] Specifically, the risk-return ratio (Sharpe ratio) measures the excess return of a stock portfolio under unit risk, and its calculation formula is: in, is the expected return on the stock portfolio, is the risk-free rate (such as the Treasury bond yield), is the standard deviation (risk) of the stock portfolio.
[0049] In one embodiment, Figure 2 As shown, a stock portfolio anti-fluctuation optimization device is provided, comprising: an economic indicator acquisition module 10, a stock portfolio simulation module 20, a return and risk assessment module 30, a risk-return ratio calculation module 40, and a risk-return ratio display module 50, wherein: An economic indicator acquisition module 10 is used to acquire macroeconomic indicators, which include key variables in the economic system; The stock portfolio simulation module 20 is used to predict the stock portfolio under different market environments through Monte Carlo simulation based on macroeconomic indicators; Return and risk assessment module 30 is used to obtain historical stock characteristic data, adjust the weight of the stock portfolio based on the historical stock characteristic data through the mean-variance model combined with the dynamic factor model, and evaluate the expected return and risk of the adjusted stock portfolio; The risk-return ratio calculation module 40 is used to calculate the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The risk-return ratio display module 50 is used to obtain the historical risk-return ratio of the stock portfolio and display the risk-return ratio and historical risk-return ratio of the stock portfolio through a visual interface to show the dynamic changes of the risk-return ratio and assist users in decision-making.
[0050] In one embodiment, the return and risk assessment module 30 is also used to obtain historical stock characteristic data, and based on the historical stock characteristic data, predict the return and risk of each stock through the dynamic factor model FactorVAE; based on the return and risk of each stock, adjust the weight of the stock portfolio through the mean-variance model, and evaluate the expected return and risk of the adjusted stock portfolio.
[0051] In one embodiment, the return and risk assessment module 30 is also used to obtain historical price data of each stock, and based on the historical price data of each stock, predict the price fluctuation of each stock through a double-layer LSTM network; obtain the future return of each stock based on the price fluctuation of each stock; obtain historical stock feature data, and based on the historical stock feature data and the future return of each stock, predict the rate of return and risk of each stock through a dynamic factor model FactorVAE.
[0052] In one embodiment, the return and risk assessment module 30 is also used to obtain historical price data of each stock, and clean and standardize the historical price data; input the processed historical price data into a two-layer LSTM network to capture the long-term dependency of stock prices; and predict the price fluctuations of each stock based on the long-term dependency of stock prices.
[0053] In one embodiment, the return and risk assessment module 30 is also used to obtain historical stock feature data, and extract the potential characteristics of each stock from the historical stock feature data through the dynamic factor model FactorVAE; extract posterior factors from the potential characteristics and the future returns of each stock; and predict the return and risk of each stock based on the posterior factors and the potential characteristics.
[0054] In one embodiment, the return and risk assessment module 30 is also used to obtain the set expected rate of return, and solve the optimal weight configuration of stocks through the mean-variance model based on the expected rate of return and the rate of return and risk of each stock; adjust the weight of the stock portfolio based on the optimal weight configuration of the stocks; and evaluate the expected return and risk of the adjusted stock portfolio.
[0055] In one embodiment, the risk-return ratio calculation module 40 is further configured to obtain a risk-free interest rate; and calculate the risk-return ratio of the stock portfolio based on the risk-free interest rate, the expected return and the risk of the stock portfolio.
[0056] Each module in the aforementioned device for optimizing stock portfolios against volatility can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0057] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store infrared image data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a stock portfolio anti-volatility optimization method is implemented.
[0058] Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0059] The above are all preferred embodiments of the present application, and are not intended to limit the scope of protection of the present application. Therefore, any equivalent changes made based on the structure, shape, and principle of the present application should be included in the scope of protection of the present application.
Claims
1. A method for optimizing stock portfolio against volatility, characterized in that: include: Obtaining macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; Based on the macroeconomic indicators, predict the stock portfolio under different market environments through Monte Carlo simulation; Obtaining historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluating the expected return and risk of the stock portfolio after the adjustment; Calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The historical risk-return ratio of the stock portfolio is obtained, and the risk-return ratio of the stock portfolio and the historical risk-return ratio are displayed through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
2. A stock portfolio anti-volatility optimization method according to claim 1, characterized in that: The obtaining of historical stock characteristic data, adjusting the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model in combination with a dynamic factor model, and evaluating the expected return and risk of the adjusted stock portfolio includes: Obtain historical stock characteristic data, and predict the rate of return and risk of each stock through the dynamic factor model FactorVAE based on the historical stock characteristic data; According to the rate of return and risk of each stock, the weight of the stock portfolio is adjusted through the mean-variance model, and the expected return and risk of the stock portfolio after adjustment are evaluated.
3. A stock portfolio anti-volatility optimization method according to claim 2, characterized in that: The acquiring of historical stock characteristic data and, based on the historical stock characteristic data, using the dynamic factor model FactorVAE to predict the rate of return and risk of each stock includes: Obtain historical price data for each stock, and predict price fluctuations of each stock using a two-layer LSTM network based on the historical price data of each stock; Obtain future returns of each stock based on the price fluctuations of each stock; Historical stock characteristic data is obtained, and based on the historical stock characteristic data and the future returns of each stock, the dynamic factor model FactorVAE is used to predict the rate of return and risk of each stock.
4. A stock portfolio anti-volatility optimization method according to claim 3, characterized in that: The acquiring of historical price data of each stock and predicting the price fluctuation of each stock through a double-layer LSTM network based on the historical price data of each stock includes: Obtaining historical price data for each stock, and cleaning and standardizing the historical price data; The processed historical price data is input into a two-layer LSTM network to capture the long-term dependencies of stock prices; Based on the long-term dependency of the stock prices, the price fluctuations of the respective stocks are predicted.
5. The method for optimizing stock portfolio against volatility according to claim 3, characterized in that: The acquisition of historical stock characteristic data and prediction of the rate of return and risk of each stock using the dynamic factor model FactorVAE based on the historical stock characteristic data and the future returns of each stock include: Obtain historical stock feature data, and extract potential features of each stock from the historical stock feature data using a dynamic factor model, FactorVAE; extracting posterior factors from the latent characteristics and the future returns of each stock; The rate of return and risk of each stock are predicted based on the posterior factors and the potential characteristics.
6. A stock portfolio anti-volatility optimization method according to claim 2, characterized in that: The method of adjusting the weight of the stock portfolio based on the rate of return and risk of each stock through a mean-variance model and evaluating the expected return and risk of the stock portfolio after adjustment includes: Obtaining the expected rate of return set, and solving the optimal weight configuration of stocks using the mean-variance model based on the expected rate of return and the rate of return and risk of each stock; Adjusting the weight of the stock portfolio according to the optimal weight configuration of the stocks; Evaluate the expected returns and risks of the adjusted stock portfolio.
7. The method for optimizing stock portfolio against volatility according to claim 1, characterized in that: Calculating the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio includes: Obtain risk-free interest rates; The risk-return ratio of the stock portfolio is calculated based on the risk-free interest rate, the expected return and the risk of the stock portfolio.
8. A stock portfolio anti-fluctuation optimization device, characterized in that: include: An economic indicator acquisition module, used to acquire macroeconomic indicators, wherein the macroeconomic indicators include key variables in the economic system; a stock portfolio simulation module, for predicting stock portfolios under different market environments through Monte Carlo simulation based on the macroeconomic indicators; A return and risk assessment module is used to obtain historical stock characteristic data, adjust the weight of the stock portfolio based on the historical stock characteristic data using a mean-variance model combined with a dynamic factor model, and evaluate the expected return and risk of the stock portfolio after the adjustment; a risk-return ratio calculation module, configured to calculate the risk-return ratio of the stock portfolio based on the expected return and risk of the stock portfolio; The risk-return ratio display module is used to obtain the historical risk-return ratio of the stock portfolio and display the risk-return ratio of the stock portfolio and the historical risk-return ratio through a visual interface to show the dynamic changes of the risk-return ratio and assist users in making decisions.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.