Financial time sequence stock price prediction method and system based on deep learning

Through the improved GAN model combined with LSTM and CNN, the prediction problem of high noise and non-stationary data in the stock market is solved, and stock price prediction with higher accuracy and lower risk is achieved, enhancing the generalization ability and prediction effect of the model.

CN120298062APending Publication Date: 2025-07-11SOUTHWEAT UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510358813.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

When facing complex stock markets, existing stock prediction methods are difficult to deal with high noise and non-stable financial time series data, and there are problems such as low prediction accuracy, high risk of overfitting and insufficient generalization ability.

Method used

The improved generative adversarial network (GAN) model is used to generate stock price sequences in combination with long and short-term memory network (LSTM) and attention mechanism, and the real data is discriminated using convolutional neural network (CNN) and LeakyReLU activation function. It is trained through the Wasserstein distance and Adam optimizer, and the trend characteristics are captured by the simple moving average and exponential moving average enhancement model.

Benefits of technology

It improves the accuracy and generalization ability of stock price predictions, reduces the risk of overfitting, provides a more reliable prediction reference, helping investors reasonably grasp market trends and reduce risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120298062A_ABST
    Figure CN120298062A_ABST
Patent Text Reader

Abstract

The invention discloses a financial time sequence stock price prediction method and system based on deep learning. The method comprises the following steps: data preprocessing; constructing an improved generative adversarial network (GAN) model; training and optimizing the model; and outputting a prediction result. According to the financial time sequence stock price prediction method and system based on deep learning, the CNN, the LSTM, the attention mechanism and the improved GAN model are combined, the long-term dependence problem of stock data can be effectively solved, complex modes and trends in the data are captured, the prediction accuracy is improved, and the prediction accuracy is improved from experimental data. The improved GAN-LSTM-CNN-Attention model is excellent in performance on indexes such as MAPE, RMSE, MAE and R2, compared with models such as LSTM, CNN and LSTM-CNN, the error is lower, the fitting effect is better, more reliable price prediction reference can be provided for investors, and the generalization ability of the model is enhanced by adopting multiple strategies to reduce model overfitting such as data packet training, network structure simplification and use of proper activation functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technologies, and particularly to a method and system for predicting stock prices of financial time series based on deep learning. Background Technique

[0002] In the financial market, stock price prediction has always been the focus of academic and financial industries. With the development of the global economy and the increasing activity of the stock market, accurately predicting the trend of stock prices is of great significance for investors to obtain returns, enterprises to formulate strategies, and financial regulatory authorities to maintain market stability.

[0003] In the early stage, stock market analysis mainly relied on fundamental analysis and technical analysis. Fundamental analysis predicted the trend of stock prices by evaluating factors such as the intrinsic value of listed companies, the economic and political environment, financial conditions, management capabilities, and market prospects. This method is suitable for long-term investors but requires a large amount of professional knowledge and comprehensive information collection. Technical analysis is based on the historical trends and trading volume data of stock prices and uses means such as charts and indicators to predict future trends, which is more suitable for short-term investors. However, both of these traditional analysis methods have certain limitations and are difficult to accurately capture the complex changes in stock prices.

[0004] With the development of mathematical statistics and finance, statistics-based stock prediction methods have gradually emerged. Among them, the autoregressive integrated moving average model (such as ARIMA) is one of the classic statistical models. It processes time series data through differencing to make it a stationary series before prediction, and it has a certain effect in short-term stock price prediction. However, the stock market is dynamic and complex, which is a typical non-stationary time series, and it is difficult for linear statistical models to comprehensively describe its characteristics, resulting in limited prediction accuracy.

[0005] The emergence of machine learning technologies has brought new ideas to stock prediction. Common machine learning algorithms such as support vector machines (SVM), random forests (RF), and XGBoost have been widely applied to stock time series prediction. These methods can handle non-linear and high-dimensional data and have certain advantages compared to traditional statistical methods. However, traditional machine learning methods assume that the distributions of the training set and the test set in the feature space are consistent. In practical applications, the data distribution in the stock market is complex and changeable, and this assumption is often difficult to meet, affecting the accuracy of prediction.

[0006] In recent years, due to its powerful non - linear fitting ability and feature extraction ability, deep learning technology has achieved remarkable results in fields such as image recognition, speech recognition, and natural language processing, and has gradually been applied in the field of stock prediction. Deep learning models represented by convolutional neural networks (CNNs), recurrent neural networks (RNNs), and their variants (such as long short - term memory networks LSTM, bidirectional long short - term memory networks BiLSTM) are used for stock prediction. Among them, LSTM performs well in processing time - series data, can effectively capture long - term dependencies, and shows better prediction performance than traditional models in many studies.

[0007] However, at present, deep learning still faces many challenges in stock prediction. On the one hand, high - frequency stock sequences are characterized by high noise and non - stationarity. Most existing deep learning models are designed for low - frequency stock sequences, and the insufficient data volume makes it difficult for the model to learn enough features. On the other hand, a single deep learning model is difficult to cope with the complex and changing stock market, and its generalization ability is insufficient. At the same time, deep learning models also have problems such as being prone to overfitting, difficult to handle long - term dependencies, and unclear feature importance, which all limit their accuracy and reliability in stock prediction.

[0008] In summary, existing stock prediction methods all have certain limitations when facing the complex stock market and cannot meet the needs of investors for high - precision stock price prediction. Therefore, it is of great practical significance to study a stock price prediction method and system that can effectively process high - noise, non - stationary financial time - series data, improve the prediction accuracy, and reduce the risk of overfitting. Summary of the Invention

[0009] (1) Technical problems to be solved

[0010] Aiming at the deficiencies of the existing technology, the present invention provides a financial time - series stock price prediction method and system based on deep learning, which has the advantages of accurate and efficient prediction models and practical and comprehensive system functions, and solves the problem of low prediction accuracy of traditional methods.

[0011] (2) Technical solutions

[0012] To achieve the above object, the present invention provides the following technical solutions: A financial time - series stock price prediction method and system based on deep learning, including the following steps:

[0013] S100. Data pre - processing: Obtain the historical high - frequency trading data of the target stock, including price, trading volume, and technical indicators, perform standardized processing on the data, and divide it into a training set and a test set;

[0014] S200. Construct an improved generative adversarial network (GAN) model:

[0015] S210. The generator adopts a structure combining a long short - term memory network (LSTM) and an attention mechanism, and is used to generate sequence data simulating real stock prices;

[0016] S220. The discriminator adopts a structure combining a convolutional neural network (CNN) and a LeakyReLU activation function, and is used to distinguish between generated data and real data;

[0017] S230. Optimize the parameters of the generator and the discriminator through adversarial training, and the generator outputs the predicted stock price sequence;

[0018] S300. Model training and optimization: Use the Wasserstein distance as the objective function, combine with the Adam optimizer for training, and adjust the hyperparameters by regularly evaluating the loss functions of the generator and the discriminator;

[0019] S400. Prediction result output: Input the pre - processed input data into the trained model, and output the predicted values of the stock prices in the future time period.

[0020] Preferably, the combination of the LSTM and the attention mechanism of the generator specifically includes:

[0021] a. Extract the long - term dependence features of the time series through the LSTM layer;

[0022] b. Introduce the attention mechanism to dynamically allocate the weights of each time step, and generate a context vector to enhance the focusing ability on key time steps;

[0023] c. After fusing the context vector with the output of the LSTM, generate a prediction sequence.

[0024] Preferably, the CNN structure of the discriminator includes:

[0025] a. A multi - layer one - dimensional convolutional layer, which is used to extract the local features of the time series;

[0026] b. The LeakyReLU activation function, which avoids neuron "death" and improves the robustness of the model;

[0027] c. The fully - connected layer outputs the discrimination result to judge whether the input data is real data or generated data.

[0028] Preferably, the technical indicators include the simple moving average (SMA) and the exponential moving average (EMA), which are used to enhance the model's ability to capture trend features.

[0029] Preferably, the standardization process of the data pre - processing adopts the Z - score standardization method with a mean of 0 and a variance of 1.

[0030] A stock price prediction system based on the method described in any one of claims 1-5, comprising the following modules:

[0031] User interaction module: Supports user registration, login, viewing of historical stock data, and model prediction results;

[0032] Model management module: Allows administrators to adjust model hyperparameters, add or delete models, and save the optimal model configuration;

[0033] Data processing module: Cleans, extracts features, and normalizes the input stock data;

[0034] Prediction execution module: Invokes the trained improved GAN model for real-time or batch stock price prediction and visually displays the prediction results;

[0035] Simulation trading module: Provides a simulation trading function for users based on the prediction results to assist investment decisions.

[0036] Preferably, the user interaction module further includes a permission management function to distinguish the operation permissions of administrators, registered users, and visitors.

[0037] Preferably, the prediction execution module supports multi-model comparison, including CNN, LSTM, CNN-LSTM, and the improved GAN model, and evaluates the prediction performance through MAE, RMSE, R 2 and MAPE metrics.

[0038] (III) Beneficial effects

[0039] Compared with the prior art, the present invention provides a financial time series stock price prediction method and system based on deep learning, having the following beneficial effects:

[0040] 1. The financial time series stock price prediction method and system based on deep learning can effectively handle the long-term dependence problem of stock data, capture complex patterns and trends in the data, and improve prediction accuracy by combining CNN, LSTM, attention mechanism, and the improved GAN model. From the experimental data, the improved GAN-LSTM-CNN-Attention model performs excellently in metrics such as MAPE, RMSE, MAE, and R2. Compared with models such as LSTM, CNN, and LSTM-CNN, it has lower errors and better fitting effects, and can provide more reliable price prediction references for investors.

[0041] 2. The financial time series stock price prediction method and system based on deep learning adopts various strategies to alleviate model overfitting, such as grouped data training, streamlining the network structure, using appropriate activation functions and optimizers, and regularly evaluating the model, etc., enhancing the generalization ability of the model, enabling it to maintain good prediction effects under different data and market conditions. At the same time, by using LSTM to automatically learn feature weights, the attention mechanism to focus on key features, and CNN to extract local features, the problem of unclear feature importance is effectively solved, enabling the model to more accurately grasp the features that have an important impact on stock price prediction.

[0042] 3. The financial time series stock price prediction method and system based on deep learning has a rich set of functions in the realized stock price prediction system. Administrators can conduct refined management of the model, including operations such as adding, modifying, viewing, resetting, and deleting the model, facilitating the optimization of the model according to market changes and demands. Users can manage their profiles in the personal center, view stock trends, and conduct simulated trading, accumulating experience and verifying strategies before actual investment, which provides a scientific decision-making basis for investors, helps investors more reasonably grasp the changing trends of the financial market, reduces investment risks, and increases investment returns. For the country, it also helps to better control financial market risks and promote the stable and healthy development of the financial market. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 Improved GAN model diagram of a financial time series stock price prediction method and system based on deep learning proposed by the present invention;

[0044] Figure 2 Login flowchart of a financial time series stock price prediction method and system based on deep learning proposed by the present invention;

[0045] Figure 3 LSTM working flowchart of a financial time series stock price prediction method and system based on deep learning proposed by the present invention;

[0046] Figure 4 One-dimensional convolution diagram of a financial time series stock price prediction method and system based on deep learning proposed by the present invention;

[0047] Figure 5 Generator structure diagram of a financial time series stock price prediction method and system based on deep learning proposed by the present invention;

[0048] Figure 6 Discriminator structure diagram of a financial time series stock price prediction method and system based on deep learning proposed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0050] Please refer to Figures 1 to 6 , the present invention provides a technical solution: a financial time series stock price prediction method and system based on deep learning, including the following steps:

[0051] S100. Data preprocessing:

[0052] Data acquisition: Use web crawler technology or obtain historical high-frequency trading data of the target stock from professional financial data platforms, covering stock prices, trading volumes, and technical indicator data such as simple moving average (SMA) and exponential moving average (EMA). For example, obtain data from authoritative financial data websites such as Eastmoney.com at regular time intervals (such as minute-level).

[0053] Data cleaning: Clean the obtained data, check the integrity and accuracy of the data, and eliminate data records with missing values and outliers. For missing values, if the missing ratio is small, the mean or median filling method can be used; if the missing ratio is large, the corresponding data records are deleted. For outliers, they are identified and processed by setting a reasonable threshold range. For example, if the stock price fluctuation exceeds a certain standard deviation of historical data, it is regarded as an outlier.

[0054] Standardization processing: Use the Z-score standardization method with a mean of 0 and a variance of 1 to process the data. Taking the stock price data as an example, the standardization formula is where X is the original stock price data, μ is the mean of the stock price data, and σ is the standard deviation of the stock price data. The same standardization processing is also performed on data such as trading volumes and technical indicators to ensure that different feature data have the same scale for convenient model learning.

[0055] Dividing the training set and the test set: Divide the preprocessed data according to a certain ratio (such as 70% training set and 30% test set). When dividing, use the time series division method to ensure that the training set is in the front and the test set is in the back to simulate a real prediction scenario. For example, if there are nearly 5 years of historical data, the first 3.5 years of data is used as the training set, and the last 1.5 years of data is used as the test set.

[0056] S200. Build an improved generative adversarial network (GAN) model:

[0057] S210. Generator construction:

[0058] LSTM layer feature extraction: Build an LSTM layer containing multiple LSTM units, and input the preprocessed time series data. Through the collaborative work of the input gate, forget gate, and output gate, the LSTM unit effectively extracts the long-term dependence features in the time series. For example, set the number of hidden units in the LSTM layer to 128 so that the LSTM layer can fully learn the long-term trend information in the stock price series.

[0059] The formal equations of the three gates are as follows:

[0060] Forget gate: ft = σ(Wf · [ht-1, xt] + bf);

[0061] Input gate: it = σ(Wi · [ht-1, xt] + bi)

[0062] Ct~ = tanh(WC · [ht-1, xt] + bC)

[0063] Ct = ft · Ct-1 + it · Ct~;

[0064] Output gate: ot = σ(Wo · [ht-1, xt] + bo)

[0065] ht = ot · tanh(Ct).

[0066] Attention mechanism weight allocation: Introduce the attention mechanism based on the output of the LSTM layer. First, calculate the attention weights for each time step, and normalize the weights through the Softmax function so that important time steps obtain higher weights. Then, generate a context vector according to the weights to enhance the focusing ability on key time steps. For example, for time steps with large stock price fluctuations, the attention mechanism assigns higher weights to make the model pay more attention to the information at these key time points.

[0067] Fusion output prediction sequence: Fuse the context vector with the output of the LSTM, and generate sequence data simulating the real stock price through processing by a fully connected layer. The fused information contains long-term dependence features and key information at key time steps, and can better reflect the changing trend of the stock price.

[0068] S220. Discriminator construction:

[0069] Multi-layer one-dimensional convolutional layer feature extraction: Build a discriminator structure containing multi-layer one-dimensional convolutional layers. The convolutional kernels of the one-dimensional convolutional layers slide on the time series data to extract local features. For example, set 3 one-dimensional convolutional layers with convolutional kernel sizes of 3, 5, and 7 respectively, and a stride of 1. Capture local features at different scales through convolutional kernels of different sizes, such as short-term price fluctuation patterns.

[0070] Application of the LeakyReLU activation function: The LeakyReLU activation function is used after each convolutional layer. When the input of the LeakyReLU function is less than 0, the output is γx, where γ is a very small number. In this way, the LeakyReLU function will retain the features of some data less than zero. Therefore, this model selects the LeakyReLU activation function as the activation function for the convolutional layer. The formula of the LeakyReLU activation function is as follows: Avoid neurons from "dying" during training, improve the robustness of the model, and enable the model to learn a wider range of features.

[0071] The fully connected layer outputs the discrimination result: After being processed by the convolutional layer and the activation function, the data is converted into a one-dimensional vector through the flattening layer and then input into the fully connected layer. The fully connected layer outputs a probability value indicating whether the input data is real data or generated data based on the extracted features, realizing the discrimination of the data.

[0072] CNN in the discriminator:

[0073] Convolutional layer calculation: y t = ReLU(W * x t + b);

[0074] Pooling layer calculation: y t ' = max(x t , 1, x t , 2,..., x t , n);

[0075] Flattening layer calculation: x flat = Flatten(y);

[0076] Fully connected layer calculation: h1 = Leaky ReLU(W1 · x flat + b1), output = W2 · h1 + b2;

[0077] Attention in the generator:

[0078] Attention weight calculation: score t = w att · h t ;

[0079] Context vector calculation:

[0080] Normalized attention weight:

[0081] S230. Adversarial Training Optimization: The parameters of the generator and discriminator are optimized using an adversarial training approach. The goal of the generator is to generate simulated stock price sequences that are difficult for the discriminator to distinguish. The goal of the discriminator is to accurately distinguish between real data and generated data. During training, the generator and discriminator are alternately trained. For example, first fix the discriminator and train the generator so that the data generated by the generator can deceive the discriminator. Then fix the generator and train the discriminator to improve its discrimination ability. Through continuous iteration, the generator outputs the predicted stock price sequence.

[0082] S300. Model Training and Optimization:

[0083] Objective Function and Optimizer Selection: The Wasserstein distance is used as the objective function, which can better measure the difference between the generated data distribution and the real data distribution, and avoid problems such as vanishing gradients in traditional GAN training. Training is combined with the Adam optimizer, which can adaptively adjust the learning rate and accelerate the model convergence speed. For example, set the learning rate of the Adam optimizer to 0.0002, beta1 to 0.5, and beta2 to 0.999.

[0084] Hyperparameter Tuning: During training, regularly (such as every 10 epochs) evaluate the loss functions of the generator and discriminator, and adjust hyperparameters according to the change trend of the loss functions, such as the number of network layers, the number of hidden units, the learning rate, etc. of the generator and discriminator. If the loss of the generator decreases slowly, the number of hidden units of the generator can be appropriately increased or the learning rate can be decreased; if the loss of the discriminator fluctuates greatly, the size of the convolutional kernel or the optimizer parameters of the discriminator can be tried to be adjusted.

[0085] S400. Prediction Result Output:

[0086] The preprocessed input data (such as the stock price, trading volume, and technical indicator data for the latest period of time) is input into the trained model. The model outputs the predicted stock price values for the future time period (such as the next 1 day, 1 week, etc.) according to the learned patterns and features. For example, if predicting the stock price for the next 1 day, the model will output a predicted stock price value or the trend of stock price change (rising, falling, or remaining flat).

[0087] Implementation of the Stock Price Prediction System for Financial Time Series Based on Deep Learning:

[0088] User Interaction Module:

[0089] User Registration and Login: Provide user registration and login interfaces. When users register, they need to fill in information such as username and password. The system encrypts and stores the user information. When logging in, the system verifies the username and password entered by the user, and if correct, allows the user to enter the system.

[0090] Data viewing: After registered users and administrators log in, they can view historical stock data, including stock price trends, trading volume changes, technical indicator values, etc., which are presented in the form of charts (such as line charts, bar charts) and tables. Visitors can browse some public historical data but cannot conduct detailed queries and operations.

[0091] Prediction result viewing: Users can view the prediction results of the model on stock prices, and the prediction results are also presented in the form of charts and text, intuitively showing information such as the predicted stock price values, change trends, and confidence intervals.

[0092] Permission management: Differentiate the operation permissions of administrators, registered users, and visitors. Administrators have the highest permissions and can perform operations such as model management and system settings; registered users can view personal information, conduct simulated trading, view prediction results, etc.; visitors can only view limited public information.

[0093] Model management module:

[0094] Hyperparameter adjustment: After the administrator logs in, they can enter the model management interface to adjust the hyperparameters of the improved GAN model and other comparison models (such as CNN, LSTM, CNN-LSTM). After adjustment, the system automatically saves the new hyperparameter configuration and retrains the model.

[0095] Model addition and deletion: Administrators can add new models to the system and upload model codes and related configuration files. For models that are no longer in use or have poor performance, administrators can perform deletion operations to ensure the effectiveness and efficiency of the models in the system.

[0096] Optimal model saving: During the training process, the system automatically identifies the optimal model according to preset evaluation metrics (such as MAE, RMSE, R 2 and MAPE), and saves the configuration and parameters of the optimal model. Administrators can view and use the optimal model for prediction at any time.

[0097] Data processing module:

[0098] Data cleaning and feature extraction: Receive the stock data uploaded by users or obtained from data sources, and perform data cleaning and feature extraction. The data cleaning process is the same as the data cleaning steps in the prediction method, and feature extraction calculates new technical indicators or combines existing features as needed.

[0099] Standardization processing: Perform standardization processing on the cleaned and extracted stock data, using the same Z-score standardization method as in the prediction method to ensure that the data meets the model input requirements.

[0100] Prediction execution module:

[0101] Model Call and Prediction: According to user requirements, call the trained improved GAN model for real-time or batch stock price prediction. For real-time prediction, the prediction results can be updated in a timely manner based on the latest market data. For batch prediction, centralized prediction can be performed on data of multiple stocks or different time periods.

[0102] Multi-Model Comparison and Evaluation: Support multi-model comparison. Run CNN, LSTM, CNN-LSTM, and the improved GAN model simultaneously for prediction, and evaluate the prediction performance through MAE, RMSE, R 2 and MAPE metrics. Display the prediction results and evaluation metrics of each model in tabular form for easy user comparison and analysis to select the optimal model.

[0103] Visualization Display: Display the prediction results in a visual way, such as plotting a comparison chart of the predicted stock price trend and the actual stock price trend, a histogram of the prediction error distribution, etc., to enable users to more intuitively understand the model prediction effect.

[0104] Simulation Trading Module:

[0105] Trading Simulation: Provide a simulation trading function for users based on the prediction results. After users set the initial funds and trading rules (such as trading fees, trading time intervals), the system simulates stock buying and selling operations according to the predicted stock price trend. During the simulation trading process, record information such as users' trading records and asset changes.

[0106] Investment Decision Assistance: Provide investment decision-making suggestions for users based on the simulation trading results. For example, analyze whether the user's trading strategy is profitable. If there is a loss, point out the possible problems and provide directions for improvement to help users optimize their investment strategies.

[0107] In summary, the overall process of the financial time series stock price prediction method and system based on deep learning is as follows:

[0108] 1. Data Preprocessing: First, obtain the historical high-frequency trading data of the target stock, covering information such as price, trading volume, and technical indicators. Then clean the data, remove missing values and outliers, and use the Z-score normalization method to process it so that the data mean is 0 and the variance is 1. Finally, divide the data according to the ratio of 70% training set and 30% test set to prepare for subsequent model training;

[0109] 2. Improvement of GAN model construction: The generator adopts a structure that combines LSTM and the attention mechanism. LSTM extracts long-term dependence features, and the attention mechanism dynamically assigns time-step weights to generate context vectors. After the two are fused, a simulated stock price sequence is generated. The discriminator consists of a CNN and the LeakyReLU activation function. The multi-layer one-dimensional convolutional layers of the CNN extract local features, and LeakyReLU avoids neuron "death". The fully connected layer outputs the discrimination result, and the parameters of both are optimized through adversarial training.

[0110] 3. Model training and optimization: Using the Wasserstein distance as the objective function, the model is trained with the Adam optimizer, and the learning rate is set to 0.0002, etc. During training, the losses of the generator and the discriminator are evaluated every 10 epochs, and hyperparameters such as the number of network layers and the number of hidden units are adjusted accordingly to improve the model performance.

[0111] 4. Prediction and result output: The preprocessed new data is input into the trained model to obtain the predicted values of future stock prices, and the prediction accuracy can be evaluated through indicators such as MAE and RMSE.

[0112] 5. Implementation of the stock price prediction system: The system includes multiple functional modules. The user interaction module supports user registration and login, viewing data and prediction results, and has permission management. The model management module facilitates administrators to adjust model hyperparameters, add or delete models. The data processing module cleans, extracts, and standardizes stock data. The prediction execution module calls the model for prediction, supports multi-model comparison and evaluation, and visualizes the results. The simulated trading module provides a simulated trading function for users based on the prediction results to assist investment decisions.

[0113] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0114] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A financial time series stock price prediction method based on deep learning, characterized in that, It includes the following steps: S100. Data preprocessing: Obtain the historical high-frequency trading data of the target stock, including price, trading volume and technical indicators, perform standardized processing on the data and divide it into a training set and a test set; S200. Build an improved Generative Adversarial Network (GAN) model: S210. The generator adopts a structure that combines a Long Short-Term Memory network (LSTM) and an attention mechanism, and is used to generate sequence data simulating real stock prices; S220. The discriminator adopts a structure that combines a Convolutional Neural Network (CNN) and a LeakyReLU activation function, and is used to distinguish between generated data and real data; S230. Optimize the parameters of the generator and the discriminator through adversarial training, and the generator outputs the predicted stock price sequence; S300. Model training and optimization: Use the Wasserstein distance as the objective function, combine with the Adam optimizer for training, and adjust the hyperparameters by regularly evaluating the loss functions of the generator and the discriminator; S400. Prediction result output: Input the preprocessed input data into the trained model, and output the predicted values of the stock price for the future time period.

2. The method for predicting stock prices of financial time series based on deep learning according to claim 1, wherein: The combination of the LSTM and the attention mechanism of the generator specifically includes: a. Extract the long-term dependence features of the time series through the LSTM layer; b. Introduce the attention mechanism to dynamically allocate the weights of each time step, generate a context vector to enhance the focusing ability of the key time steps; c. Fuse the context vector with the output of the LSTM to generate the prediction sequence.

3. A financial time series stock price prediction method based on deep learning according to claim 1, characterized in that: The CNN structure of the discriminator includes: a. Multiple one-dimensional convolutional layers, which are used to extract the local features of the time series; b. The LeakyReLU activation function, which avoids neuron "death" and improves the robustness of the model; c. The fully connected layer outputs the discrimination result to judge whether the input data is real data or generated data.

4. A financial time series stock price prediction method based on deep learning according to claim 1, characterized in that: The technical indicators include the Simple Moving Average (SMA) and the Exponential Moving Average (EMA), which are used to enhance the model's ability to capture trend features.

5. A method for predicting stock prices of financial time series based on deep learning according to claim 1, characterized in that: The standardized processing of the data preprocessing adopts the Z-score standardization method with a mean of 0 and a variance of 1.

6. A stock price prediction system based on the method according to any one of claims 1-5, characterized in that, It includes the following modules: User interaction module: Support user registration, login, view historical stock data and model prediction results; Model management module: Allow the administrator to adjust the model hyperparameters, add or delete models, and save the optimal model configuration; Data processing module: Clean, extract features and perform standardized processing on the input stock data; Prediction execution module: Call the trained improved GAN model to perform real-time or batch stock price prediction, and visually display the prediction results; Simulation trading module: Provide a simulation trading function for users based on the prediction results to assist investment decisions.

7. A financial time series stock price prediction system based on deep learning according to claim 6, characterized in that: The user interaction module also includes a permission management function to distinguish the operation permissions of administrators, registered users and visitors.

8. The financial time series stock price prediction system based on deep learning according to claim 6, characterized in that: The prediction execution module supports multi-model comparison, including CNN, LSTM, CNN-LSTM, and improved GAN models, and evaluates the prediction performance through MAE, RMSE, R 2 and MAPE metrics.

Citation Information

Cited By

  • Power dynamic data processing method and device, equipment and storage medium

    CN121278319A