Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
162 tokens/sec
GPT-4o
7 tokens/sec
Gemini 2.5 Pro Pro
45 tokens/sec
o3 Pro
4 tokens/sec
GPT-4.1 Pro
38 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Stockformer: A Price-Volume Factor Stock Selection Model Based on Wavelet Transform and Multi-Task Self-Attention Networks (2401.06139v2)

Published 23 Nov 2023 in q-fin.TR and cs.LG

Abstract: As the Chinese stock market continues to evolve and its market structure grows increasingly complex, traditional quantitative trading methods are facing escalating challenges. Particularly, due to policy uncertainty and the frequent market fluctuations triggered by sudden economic events, existing models often struggle to accurately predict market dynamics. To address these challenges, this paper introduces Stockformer, a price-volume factor stock selection model that integrates wavelet transformation and a multitask self-attention network, aimed at enhancing responsiveness and predictive accuracy regarding market instabilities. Through discrete wavelet transform, Stockformer decomposes stock returns into high and low frequencies, meticulously capturing long-term market trends and short-term fluctuations, including abrupt events. Moreover, the model incorporates a Dual-Frequency Spatiotemporal Encoder and graph embedding techniques to effectively capture complex temporal and spatial relationships among stocks. Employing a multitask learning strategy, it simultaneously predicts stock returns and directional trends. Experimental results show that Stockformer outperforms existing advanced methods on multiple real stock market datasets. In strategy backtesting, Stockformer consistently demonstrates exceptional stability and reliability across market conditions-whether rising, falling, or fluctuating-particularly maintaining high performance during downturns or volatile periods, indicating a high adaptability to market fluctuations. To foster innovation and collaboration in the financial analysis sector, the Stockformer model's code has been open-sourced and is available on the GitHub repository: https://github.com/Eric991005/Multitask-Stockformer.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (49)
  1. What is the value of the cross-sectional approach to deep reinforcement learning? Quantitative Finance, 21, 1239–1256. doi:10.1080/14697688.2021.2001032.
  2. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, . doi:10.48550/arXiv.1803.01271.
  3. Singular spectrum decomposition: a new method for time series decomposition. Advances in Adaptive Data Analysis, 6, 1450011. doi:10.1142/S1793536914500113.
  4. Chan, E. P. (2021). Quantitative trading: how to build your own algorithmic trading business. John Wiley & Sons.
  5. A signal decomposition theorem with hilbert transform and its application to narrowband time series with closely spaced frequency components. Mechanical Systems and Signal Processing, 28, 258–279. doi:10.1016/J.YMSSP.2011.02.002.
  6. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining (pp. 785–794). doi:10.1145/2939672.2939785.
  7. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, . doi:10.48550/arXiv.1406.1078.
  8. Stl: A seasonal-trend decomposition procedure based on loess. Journal of Official Statistics, 6, 3.
  9. Seasonal adjustment methods and real time trend-cycle estimation. Springer. doi:10.1007/978-3-319-31822-6.
  10. De Prado, M. L. (2018). Advances in financial machine learning. John Wiley & Sons.
  11. Deep learning for event-driven stock prediction. In Twenty-fourth international joint conference on artificial intelligence. doi:10.5555/2832415.2832572.
  12. Catboost: gradient boosting with categorical features support. arXiv preprint arXiv:1810.11363, . doi:10.48550/arXiv.1810.11363.
  13. The cross-section of expected stock returns. the Journal of Finance, 47, 427–465. doi:10.2139/ssrn.2511246.
  14. A five-factor asset pricing model. Journal of financial economics, 116, 1–22. doi:10.1016/j.jfineco.2014.10.010.
  15. Spatio-temporal meets wavelet: Disentangled traffic flow forecasting via efficient spectral graph attention network. arXiv e-prints, (pp. arXiv–2112). doi:10.48550/arXiv.2112.02740.
  16. Empirical characteristics of dynamic trading strategies: The case of hedge funds. The review of financial studies, 10, 275–302. doi:10.1093/rfs/10.2.275.
  17. A modelling of s&p 500 index price based on us economic indicators: Machine learning approach. Engineering Economics, 32, 362–375. doi:10.5755/j01.ee.32.4.27985.
  18. Georgakopoulos, H. (2015). Quantitative trading with R: understanding mathematical and computational tools from a quant’s perspective. Springer.
  19. The characteristics that provide independent information about average us monthly stock returns. The Review of Financial Studies, 30, 4389–4436. doi:10.2139/ssrn.2262374.
  20. Quant 4.0: Engineering quantitative investment with automated, explainable and knowledge-driven artificial intelligence. arXiv preprint arXiv:2301.04020, . URL: http://arxiv.org/pdf/2301.04020. doi:10.48550/arXiv.2301.04020.
  21. Long short-term memory. Neural computation, 9, 1735–1780. doi:10.1162/neco.1997.9.8.1735.
  22. Quantitative trading strategy based on simplified dpg. Healthcare Bulletin of Economics and Management, 13, 8616. URL: https://drpress.org/ojs/index.php/HBEM/article/download/8616/8386. doi:10.54097/hbem.v13i.8616.
  23. The empirical mode decomposition and the hilbert spectrum for nonlinear and non-stationary time series analysis. Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences, 454, 903–995. doi:10.1098/rspa.1998.0193.
  24. Deep reinforcement learning agent for s&p 500 stock selection. Axioms, 9, 130. doi:10.3390/axioms9040130.
  25. Predicting stock movement direction with machine learning: An extensive study on s&p 500 stocks. In 2017 IEEE International Conference on Big Data (Big Data) (pp. 4705–4713). IEEE. doi:10.1109/BigData.2017.8258518.
  26. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30. doi:10.5555/3294996.3295074.
  27. Forecasting crude oil prices with major s&p 500 stock prices: Deep learning, gaussian process, and vine copula. Axioms, 11, 375. doi:10.3390/axioms11080375.
  28. Deep neural networks, gradient-boosted trees, random forests: Statistical arbitrage on the s&p 500. European Journal of Operational Research, 259, 689–702. doi:10.1016/j.ejor.2016.10.031.
  29. A deep learning approach with extensive sentiment analysis for quantitative investment. Electronics, 12. doi:10.3390/electronics12183960. [Online]. Available: https://www.mdpi.com/2079-9292/12/18/3960.
  30. Multi-task representation learning for travel time estimation. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining (pp. 1695–1704). doi:10.1145/3219819.3220033.
  31. Macchiarulo, A. (2018). Predicting and beating the stock market with machine learning and technical analysis. Journal of Internet Banking and Commerce, 23, 1–22. URL: https://api.semanticscholar.org/CorpusID:158446761.
  32. Spatial and temporal normalization for multi-variate time series prediction using machine learning algorithms. Electronics, 11, 3167. doi:10.3390/electronics111931676.
  33. Quantitative equity portfolio management: modern techniques and applications. CRC Press.
  34. Financial series prediction: Comparison between precision of time series models and machine learning methods. arXiv preprint arXiv:1706.00948, . doi:10.48550/arXiv.1706.00948.
  35. struc2vec: Learning node representations from structural identity. In Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining (pp. 385–394). doi:10.1145/3097983.3098061.
  36. Ross, S. (1977). The capital asset pricing model (capm), short‐sale restrictions and related issues. The Journal of Finance, 32, 177–183. URL: https://dx.doi.org/10.1111/J.1540-6261.1977.TB03251.X. doi:10.1111/J.1540-6261.1977.TB03251.X.
  37. Representation learning for clinical time series prediction tasks in electronic health records. BMC Medical Informatics and Decision Making, 19, 1–12. doi:10.1109/bibm.2018.8621136.
  38. Singh, P. (2018). Novel fourier quadrature transforms and analytic signal representations for nonlinear and non-stationary time-series analysis. Royal Society open science, 5, 181131. doi:10.1098/rsos.181131.
  39. Graph attention networks. stat, 1050, 10–48550. doi:10.17863/CAM.48429.
  40. Intelligent optimization based multi-factor deep learning stock selection model and quantitative trading strategy. Mathematics, 10. doi:10.3390/math10040566. [Online]. Available: https://www.mdpi.com/2227-7390/10/4/566.
  41. Alstm: An attention-based long short-term memory framework for knowledge base reasoning. Neurocomputing, 399, 342–351. doi:10.1016/j.neucom.2020.02.065.
  42. Characteristic-based clustering for time series data. Data mining and knowledge Discovery, 13, 335–364. doi:10.1007/s10618-005-0039-x.
  43. Research on quantitative investment strategies based on deep learning algorithms in the context of the need for information management. In 2022 IEEE International Conference on Industrial Management (ICIM). IEEE. doi:10.1109/ICIM56520.2022.00048 [Online]. Available: https://dx.doi.org/10.1109/ICIM56520.2022.00048.
  44. Instance-wise graph-based framework for multivariate time series forecasting. arXiv preprint arXiv:2109.06489, . doi:10.48550/arXiv.2109.06489.
  45. Effective travel time estimation: When historical trajectories over road networks matter. In Proceedings of the 2020 acm sigmod international conference on management of data (pp. 2135–2149). doi:10.1145/3318464.3389771.
  46. Applications of markov decision process model and deep learning in quantitative portfolio management during the covid-19 pandemic. Systems, 10, 146. URL: https://www.mdpi.com/2079-8954/10/5/146. doi:10.3390/systems10050146.
  47. Preserving locality in vision transformers for class incremental learning. arXiv preprint arXiv:2304.06971, . doi:10.48550/arXiv.2304.06971.
  48. Research on analysis and application of quantitative investment strategies based on deep learning. Advances in Computer Science and its Applications, . doi:10.25236/AJCIS.2023.061004.
  49. Back propagation bidirectional extreme learning machine for traffic flow time series prediction. Neural Computing and Applications, . doi:10.1007/s00521-018-3578-y.

Summary

  • The paper presents Stockformer, an advanced deep learning framework that combines STL decomposition with self-attention networks to improve swing trading predictions.
  • It employs a dual-channel spatiotemporal encoder and TopKDropout strategy to capture comprehensive market trends and cyclic fluctuations in S&P 500 returns.
  • The model demonstrates superior performance with a 62.39% precision rate and achieved a 13.19% cumulative return during backtesting, outperforming contemporary benchmarks.

Overview of "StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks"

The research introduces "Stockformer," an advanced deep learning methodology tailored for swing trading in the volatile landscape of the U.S. stock market. The Stockformer framework integrates Seasonal-Trend decomposition using Loess (STL) with self-attention networks to enhance stock return predictions, focusing on the S&P 500 index.

Key Methodological Innovations:

  • STL Decomposition: Utilized to break down stock return sequences into distinct trend, seasonal, and residual components. This allows the model to discern long-term growth patterns and short-term cyclical fluctuations, optimizing the predictive modeling inputs for stock returns.
  • Self-Attention Networks: The self-attention mechanism allows the model to weigh different periods in stock data unequally, focusing more on major swings. The inclusion of Struc2Vec enhances representation by capturing the intricate correlations and patterns between stocks in interconnected graphs.
  • Dual-Component Encoder: The developmental process involves a dual-channel spatiotemporal encoder that captures comprehensive temporal dynamics using both trend and seasonal components, combined with fusion attention mechanisms for robust data synthesis.
  • TopKDropout Strategy: This is incorporated to refine stock selection, focussing on stocks with the highest potential for returns by occasionally omitting high-attention weights, thereby diversifying the analysis to low-attention components and providing a robust selection process.

Experimental Setup and Findings:

The research rigorously tested the Stockformer model using a well-structured dataset covering the period from January 2021 to June 2023. The evaluation metrics included MAE, RMSE, and MAPE, and directly tested against ten industry models. The Stockformer demonstrated superior predictive performance with a precision rate of 62.39%, surpassing contemporary models.

Backtesting and Performance:

  • In the specified backtest phase (February to June 2023), the model's swing trading strategy achieved a cumulative return of 13.19% and an annualized equivalent of 30.80%. These results highlight the model's efficacy in forecasting stock trends and securing tangible investment returns, convincingly outperforming existing benchmarks.

Theoretical and Practical Implications:

  • Theoretical: By employing STL decomposition and self-attention frameworks, this research provides a robust approach for encapsulating the complexities in stock return data. The dual-component analysis extends the understanding of temporal and spatial dynamics in financial time series. This methodology can be a stepping stone for deeper exploration in financial modeling and AI-driven trading strategies.
  • Practical: The open-source Stockformer framework provides investors with an instrument to anticipate market patterns and make informed decisions with enhanced precision. The application proves especially valuable amidst fluctuating market scenarios, offering a strategic hedge against potential market downturns.

Future Directions:

While the Stockformer presents a compelling case with its innovative approach, future developments could focus on automating the identification of decomposition periods within STL, enhancing the adaptability of the stock pool, and integrating meta-learning techniques for continuous learning in dynamic market contexts. Such enhancements aim to foster a more resilient and adaptive trading system.

In conclusion, "Stockformer" signifies an incremental leap in the fusion of artificial intelligence and financial trading strategies, underscoring the potential of deep learning models to navigate and forecast financial markets with an increased degree of accuracy and reliability. The combination of STL decomposition and self-attention techniques provides a promising template for future research quantum improvements in quantitative trading.