|
基于A2C算法的股票交易模型
|
Abstract:
2024年9月中国A股市场大涨,再次点燃了全民的“炒股热”。然而,牵动股民心弦的股价涨跌——却跟许多因素息息相关。对于散户来说,除了筛选信息进行股票的买进卖出以外,通过算法模型预测也能够起到事半功倍的效果。上世纪六十年代初便有了通过计算机技术进行量化交易的雏形,随着技术的迭代,通过统计学和模型构建成为量化交易的主流选择。而本论文构建了一个使用A2C (优势行动–评论家)强化学习算法的股票交易模型。利用“gym-anytrading”库创建一个股票交易环境,并使用Stable-Baselines库训练一个策略网络来学习如何在该环境中进行交易以最大化收益。该模型的数据来源于Yahoo-Finance的阿里巴巴股票信息(2022年12月至2024年9月),通过pandas-datareader库的接口获取。
In September 2024, a significant surge in China’s A-share market reignited the public’s “stock trading frenzy”. However, the fluctuating stock prices that excited stock investors were closely related to many factors. For individual investors, in addition to screening information for buying and selling stocks, using an algorithm model to predict can also have a twice-as-effective effect. In the early 1960s, the embryo of quantitative trading using computer technology had appeared, and with the advancement of technology, quantitative trading based on statistics and model building became the mainstream choice. This paper constructs a stock trading model using the A2C (Advantage Actor-Critic) reinforcement learning algorithm. By using the “gym-anytrading” library to create a stock trading environment and training a policy network using the Stable-Baselines library to learn how to trade in this environment to maximize profits. The data source for the model comes from the stock information of Alibaba (2022 December to 2024 September) obtained through the interface of the pandas-datareader library.
[1] | 牛晓健, 侯启明. 基于CNN-LSTM模型的中国股票价格预测与量化策略研究[J/OL]. 贵州省党校学报, 2024: 1-18. https://doi.org/10.16436/j.cnki.52-5023/d.20241128.005, 2024-12-19. |
[2] | Han, A. and Munan, L. (2024) Exploiting the Potential of a Directional Changes-Based Trading Algorithm in Stock Market. Finance Research Letters, 60, Article ID: 104936. |
[3] | 吴灿柳, 陈小英. 基于邻近森林的量化交易系统[J]. 软件导刊, 2024, 23(10): 82-87. |
[4] | Dumiter, F.C., Turcaș, F., Nicoară, Ș.A., Bențe, C. and Boiță, M. (2023) The Impact of Sentiment Indices on the Stock Exchange—The Connections between Quantitative Sentiment Indicators, Technical Analysis, and Stock Market. Mathematics, 11, Article No. 3128. https://doi.org/10.3390/math11143128 |
[5] | 雷鹏. 基于A2C算法考虑投资风险的股票交易策略研究[D]: [硕士学位论文]. 成都: 西南财经大学, 2024. |
[6] | 蔡云龙. 大数据驱动的湿法冶金全流程优化控制模型及实证研究[J]. 湿法冶金, 2024: 1-10. |
[7] | 何杉杉, 周雅兰, 郭宇阳. 基于LSTM和DDPG的股票交易决策算法[J]. 南京大学学报(自然科学), 2024, 60(6): 940-953. |
[8] | Wu, Y., Fu, Z., et al. (2023) A Hybrid Stock Market Prediction Model Based on GNG and Reinforcement Learning. Expert Systems with Applications, 228, Article ID: 120474. https://doi.org/10.1016/j.eswa.2023.120474 |
[9] | 陈家祥. 基于强化学习的股票交易自适应辅助决策系统的设计与实现[D]: [硕士学位论文]. 北京: 北京邮电大学, 2024. |
[10] | 徐智钊. 量化交易策略问题中的深度强化学习算法研究[D]: [硕士学位论文]. 济南: 山东师范大学, 2024. |