Abstract
This study addresses the predictive challenges in China’s A-share market, characterized by high retail investor participation and significant policy impacts. We introduce a novel predictive model that leverages both machine learning algorithms and sentiment analysis to forecast market trends. The research utilizes comprehensive datasets, including real-time A-share market data and sentiment-derived data from stock-related news, processed via advanced machine learning techniques like Random Forest and sentiment analysis tools. Our approach innovatively combines traditional technical indicators with sentiment scores to enhance the predictive accuracy of the model. The findings suggest that integrating sentiment analysis significantly improves the model’s performance, evidenced by enhanced prediction metrics such as Mean Absolute Error (MAE) and R-squared values, which compare favorably before and after incorporating sentiment data.
Introduction
Predicting stock market trends is notoriously difficult, but China’s A-share market presents a unique challenge. Unlike institutional-heavy Western markets, the A-share market is characterized by high retail investor participation and extreme sensitivity to policy shifts. This makes the market highly susceptible to "noise"—irrational exuberance or panic that traditional technical indicators often fail to capture. This research tackles the gap between quantitative market data and qualitative investor psychology, determining if deep-learning-derived sentiment scores can act as a leading indicator to enhance the robustness of machine learning models in a retail-driven environment.
Methodology
Data Acquisition and Preprocessing
The study utilized two primary data sources: TuShare, a specialized interface for real-time Chinese stock market data, and Guba (East Money), one of China’s largest online investor communities. Web crawling was employed to scrape posts and comments to gauge public sentiment. Data preprocessing included filling missing values using the "previous day" method, detecting outliers via Interquartile Range (IQR) box plots, and applying Min-Max normalization to ensure all features were on a comparable scale.
Hybrid Predictive Pipeline
The research workflow is divided into two distinct pipelines:
- Sentiment Analysis: Utilizing BERT (Bidirectional Encoder Representations from Transformers) to process unstructured Chinese text data. BERT was selected for its ability to understand context in financial discourse, producing sentiment categories (positive/negative).
- Trend Prediction: A Random Forest algorithm was employed for price trend prediction. This choice was strategic, as Random Forests are excellent at handling high-dimensional datasets and are resistant to the noise and overfitting common in volatile financial time series.
Feature Engineering
The model integrates six key features: Relative Strength Index (RSI), Exponential Moving Average (EMA), Volume Change, Moving Average, Bollinger Bands, and the novel Sentiment Score. A Chi-square test was conducted to evaluate the statistical importance of these features.
As shown in Figure 5, while traditional indicators like RSI and Volume Change remain the strongest statistical predictors, the Sentiment Score holds significant weight, acting as a critical residual solver for market nuances that technical indicators miss.
Results and Discussion
The hybrid approach yielded measurable improvements in predictive power across a dataset of 500 data points using 5-fold cross-validation. The Random Forest model achieved an average accuracy of 72.2%.
Key performance metrics demonstrated the value of sentiment integration:
- Model Fit ($R^2$): The Coefficient of Determination improved from 0.818 to 0.827 after adding sentiment data.
- Error Reduction: The Mean Absolute Error (MAE) dropped significantly (in one instance from 0.0439 to 0.008) when sentiment scores were integrated.
Figure 6 illustrates the comparison between real values and predictions. The model incorporating sentiment analysis tracks the actual price trends more closely than the basic technical model, particularly during periods of high volatility where retail sentiment drives price action.
Conclusion
Integrating sentiment analysis into machine learning frameworks significantly enhances the predictability of the A-share market. While technical indicators provide a baseline, sentiment scores capture the psychological "noise" prevalent in retail-heavy markets. Future work will explore the integration of Long Short-Term Memory (LSTM) networks to better capture temporal dependencies and expand data sources to include broader social media platforms like Weibo for a more holistic sentiment map.
Summary updated