计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (4): 358-367.DOI: 10.3778/j.issn.1002-8331.2405-0064

• 工程与应用 • 上一篇    下一篇

基于情绪词典和BERT-BiLSTM的股指预测研究

张少军,苏长利   

  1. 浙江工商大学 金融学院(浙商资产管理学院),杭州 310018
  • 出版日期:2025-02-15 发布日期:2025-02-14

Research on Stock Index Prediction Based on Sentiment Lexicon and BERT-BiLSTM

ZHANG Shaojun, SU Changli   

  1. School of Finance (School of Zheshang Asset Management), Zhejiang Gongshang University, Hangzhou 310018, China
  • Online:2025-02-15 Published:2025-02-14

摘要: 股票市场的不确定性和复杂性使得股票预测成为一项具有挑战性的任务。鉴于金融文本在股票预测中的潜在价值,采用词典法和BERT双向长短期记忆模型(bidirectional encoder representations from transformers-bidirectional long short-term memory,BERT-BiLSTM)对在线财经新闻提取情感特征,构建了融合情感特征和股票交易特征的股指预测模型。实验对比了融合情感特征前后模型的预测能力,并探讨了不同模型、不同时间周期下预测能力的差异。实验结果表明,融合词典法和深度学习技术提取的情感特征均能提升各模型股指预测的准确率。LSTM模型相较其他实验模型在融合情感特征前后的股指预测上均表现较好。进一步的时间跨度分析表明,股指预测模型在较短的时间跨度上对股票指数涨跌的预测能力更强。为验证股指预测模型的实际价值,对沪深300指数的牛熊市和震荡市进行回测分析,结合LSTM模型和深度Q网络(deep Q-network,DQN)原理,对比了传统均线策略以及结合DQN强化学习算法后股指回测差异。回测结果表明,相比于单一的传统交易策略,结合传统交易策略和深度学习方法的股票指数预测模型在牛熊市及震荡市中均保证了正的夏普比例和累积收益率,并有效控制了最大回撤,显示出更强的市场适应性和盈利能力。

关键词: 财经新闻情感特征, 股指预测, BiLSTM模型, DQN强化学习

Abstract: The uncertainty and complexity of the stock market make stock prediction as a challenging task. Given the potential value of financial texts in stock prediction, this paper adopts the lexicon-based method and BERT-BiLSTM (bidirectional encoder representations from transformers-bidirectional long short-term memory) model to extract emotional features from online financial news, and constructs a stock index prediction model that integrates emotional features and stock trading features. The experiment compares the predictive ability of the model before and after integrating these emotional features, and explores the differences in predictive ability between different models and different time periods. The experimental results indicate that sentiment features extracted by using the lexicon-based method and deep learning techniques can enhance the accuracy of stock index predictions for various models. Moreover, the LSTM model performs better than other experimental models in stock index prediction both before and after integrating sentiment features. Further analysis of different time spans shows that the stock index prediction model is more effective in forecasting stock index movements over shorter time spans. To validate the practical value of the stock index prediction model, backtesting is conducted on the HS300 index under bull, bear, and volatile market conditions. This combines the LSTM model with the deep Q-network (DQN) principle and compares the backtesting results with traditional moving average strategies and those incorporating the DQN reinforcement learning algorithm. The backtesting results demonstrate that compared to a single traditional trading strategy, the stock index prediction model that integrates traditional trading strategies and deep learning methods ensures positive Sharpe ratios and cumulative returns in both bull and bear markets, as well as in volatile markets, and effectively controls maximum drawdown, demonstrating stronger market adaptability and profitability.

Key words: financial news sentiment features, stock index prediction, BiLSTM model, DQN reinforcement learning