Bi-LSTM Price Prediction based on Attention Mechanism

Jiashu Lou,Leyi Cui,Ye Li
2023-06-18
Abstract:With the increasing enrichment and development of the financial derivatives market, the frequency of transactions is also faster and faster. Due to human limitations, algorithms and automatic trading have recently become the focus of discussion. In this paper, we propose a bidirectional LSTM neural network based on an attention mechanism, which is based on two popular assets, gold and bitcoin. In terms of Feature Engineering, on the one hand, we add traditional technical factors, and at the same time, we combine time series models to develop factors. In the selection of model parameters, we finally chose a two-layer deep learning network. According to AUC measurement, the accuracy of bitcoin and gold is 71.94% and 73.03% respectively. Using the forecast results, we achieved a return of 1089.34% in two years. At the same time, we also compare the attention Bi-LSTM model proposed in this paper with the traditional model, and the results show that our model has the best performance in this data set. Finally, we discuss the significance of the model and the experimental results, as well as the possible improvement direction in the future.
Computational Finance,Machine Learning,Portfolio Management
What problem does this paper attempt to address?
The paper attempts to address the problem of predicting the prices of gold and Bitcoin using machine learning, specifically a Bi-directional Long Short-Term Memory (Bi-LSTM) neural network model based on the attention mechanism, in the context of increasing trading frequency in the financial derivatives market. Through this method, the paper aims to provide an effective automated trading strategy to improve trading accuracy and returns. Specifically, the paper focuses on the following aspects: 1. **Data Preprocessing**: This includes unifying the time format, handling prices on non-trading days, applying the sliding window technique, and using Lagrange interpolation for data filling to ensure the completeness and continuity of the dataset. 2. **Feature Engineering**: From both economic and mathematical perspectives, various feature attributes are extracted, such as return rate, price variance, moving average index, Bollinger Bands, psychological index, technical indicators (e.g., RSI), random disturbance terms, and conditional variance, to enrich the model input information. 3. **Model Construction and Optimization**: Based on the basic LSTM model, a Bi-directional LSTM (Bi-LSTM) structure is introduced and combined with the attention mechanism to better capture long-term dependencies and key information in the time series. Additionally, batch normalization and dropout layers are used to prevent overfitting and enhance the model's generalization ability. 4. **Model Evaluation and Comparison**: The proposed At-BiLSTM model is compared with traditional models using metrics such as AUC value and accuracy to verify its superiority in prediction accuracy. Ultimately, the paper not only demonstrates the high accuracy of the model in predicting gold and Bitcoin prices but also proves through simulated backtesting that the trading strategy based on this model can achieve a high annualized return. However, the authors also point out that the model's performance in a unilateral market may not be as good as a continuous holding strategy and emphasize the "No Free Lunch Theorem," which states that no model can perform best in all situations. Future research directions may include exploring how to formulate specific trading order quantities based on model predictions and considering issues such as liquidity matching that may arise in actual trading.