Next Article in Journal
Evaluating the Performance of Sustainable Urbanization and Its Impacts on Carbon Emissions: A Case Study of Nine Pearl River Delta Cities
Previous Article in Journal
Linking Manufacturing Smart Transformation to Regional Economic Development in China: The Crucial Mediation of Regional Innovation Capacity
Previous Article in Special Issue
Primary Determinants and Strategic Implications for Customer Loyalty in Pet-Related Vertical E-Commerce: A Machine Learning Approach
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Intraday and Post-Market Investor Sentiment for Stock Price Prediction: A Deep Learning Framework with Explainability and Quantitative Trading Strategy

1
School of Management, University of Science and Technology of China (USTC), Jinzhai Road, Hefei 230026, China
2
New Finance Research Center, International Institute of Finance, University of Science and Technology of China (USTC), Guangxi Road, Hefei 230026, China
*
Author to whom correspondence should be addressed.
Systems 2025, 13(5), 390; https://doi.org/10.3390/systems13050390
Submission received: 26 March 2025 / Revised: 11 May 2025 / Accepted: 12 May 2025 / Published: 18 May 2025

Abstract

:
The inherent uncertainty and information asymmetry in financial markets create significant challenges for accurate price forecasting. Although investor sentiment analysis has gained traction in recent research, the temporal dimension of sentiment dynamics remains underexplored. This study develops a novel framework that enhances stock price prediction by integrating time-partitioned investor sentiment, while improving model interpretability via Shapley additive explanations (SHAP) analysis. Employing the ERNIE (enhanced representation through knowledge integration) 3.0 model for sentiment extraction from China’s Eastmoney Guba stock forum, we quantitatively distinguish intraday and post-market investor sentiment then integrate these temporal components with technical indicators through neural network architecture. Our results indicate that temporal sentiment partitioning effectively reduces uncertainty. Empirical evidence demonstrates that our long short-term memory (LSTM) model integrating intraday and post-market sentiment indicators achieves better prediction accuracy, and SHAP analysis reveals the importance of intraday and post-market investor sentiment to stock price prediction models. Implementing quantitative trading strategies based on these insights generates significantly more annualized returns for representative stocks with controlled risk, outperforming sentiment-agnostic and non-temporal sentiment models. This research provides methodological innovations for processing temporal unstructured data in finance, while the SHAP framework offers regulators and investors actionable insights into sentiment-driven market dynamics.

1. Introduction

China’s A-share market has witnessed remarkable growth with China’s economic expansion and continuous capital market reforms. By the end of 2023, there were 222.94 million individual investors [1], accounting for 15.8% of the total population. With over 5181 listed companies and a total market capitalization of 77.31 trillion yuan [2], equivalent to 61.3% of China’s GDP, it has become a key player in investment, capital pricing, and asset allocation. While global stock markets like the US market have demonstrated their significant influence on global economies, China’s A-share market, characterized by its unique investor structure dominated by retail investors and wide-ranging industrial coverage, has emerged as a critical component in China’s economic development. Given the remarkable scale and significance of the A-share market, accurately predicting stock prices has become a pivotal issue for both investment practice and academic research.
Stock price prediction remains a formidable challenge in financial markets due to the inherent complexity of stock data, which is characterized by nonlinear trends, high-frequency fluctuations, and significant noise. In recent years, machine learning techniques have become powerful tools to address these challenges by uncovering hidden patterns and dependencies in financial time series. An increasing number of studies have emphasized the integration of diverse data sources, such as investor sentiment from social media and news articles and technical indicators like candlestick charts, to enhance predictive accuracy. Sentiment analysis of textual data, including tweets and financial reports, has proven valuable in capturing market psychology and its impact on price movements. In parallel, deep learning architectures, particularly LSTM networks and their bidirectional variants, have demonstrated exceptional capability in modeling temporal dependencies and mitigating noise in stock price sequences [3,4,5].
However, the existing research exhibits notable limitations across three crucial dimensions. First, the majority of sentiment indicators operate by aggregating daily comments, disregarding the temporal dynamics between intraday and post-market periods [6,7,8]. Recent breakthroughs in behavioral finance [9,10,11,12,13,14,15] have emphasized that intraday sentiment serves as a transient yet vital predictor of short-term returns. This is because the market is influenced by different mechanisms during trading hours and after the market closes. Regrettably, this significant temporal aspect has received scant attention in previous studies. Second, although deep learning models such as LSTM, convolutional neural network (CNN), and temporal convolutional network (TCN) have demonstrated superior performance over classical machine learning methods in capturing nonlinear patterns [3,4,5,7], their “black-box” characteristics pose challenges for practical implementation in regulated financial settings. In regulated financial environments, transparency and interpretability are of utmost importance, and the opaqueness of these models restricts their wide-scale adoption. Third, prevailing studies primarily rely on statistical accuracy metrics for model validation while mainly ignoring real-world trading strategy simulations with transaction cost constraints. In particular, there is a lack of back-testing in China’s T+1 stock market. As a result, it remains uncertain whether algorithmic trading can generate profits in this specific market context. Given the unique trading rules and market structure of China’s T+1 stock market, the applicability and profitability of existing models need to be further investigated.
To address these gaps, this study proposes three innovations.
Temporally segmented sentiment construction: Leveraging the ERNIE 3.0 model [11], we develop separate intraday and post-market sentiment indices from 3,923,492 Eastmoney Guba stock forum comments. This approach captures the temporal sentiment asymmetry that has been neglected in previous studies. The ERNIE 3.0 model, with its advanced natural language processing capabilities, enables us to analyze the sentiment of comments during different time periods more accurately. By constructing distinct sentiment indices for intraday and post-market periods, we can better understand how investor sentiment evolves over time and its impact on stock prices.
Explanability analysis: Our interpretable hybrid architecture utilizes the SHAP tool to analyze the model’s interpretability. In contrast to traditional deep learning models, which are often regarded as “black-boxes”, our approach provides insights into how the model makes predictions. The SHAP tool allows us to quantify the contribution of each input feature to the model’s output, enabling investors and regulators to understand the underlying factors driving stock price predictions.
Quantitative trading backtesting under the T+1 trading mechanism: We present a cost-aware strategy validation framework tailored to the Chinese market. Most academic studies neglect real-world trading constraints, and our framework aims to bridge this gap. The T+1 trading mechanism, a fundamental characteristic of the Chinese stock market, restricts investors from selling stocks on the same day they are bought, adding a significant layer of complexity to trading strategies. By integrating this rule into our backtesting framework, we can more accurately simulate real-world trading scenarios and evaluate the profitability of trading strategies under practical conditions.
The remainder of this paper is organized as follows: Section 2 conducts a systematic literature review, critically analyzing existing research on market efficiency, sentiment analysis methodologies, and temporal dynamics in investor behavior while identifying key research gaps. Section 3 details our methodological framework, including (1) temporal segmentation of investor sentiment using ERNIE 3.0, (2) LSTM-based prediction model architecture, (3) SHAP interpretability analysis, and (4) T+1 compliant trading strategy design. Section 4 presents empirical results across three dimensions: predictive accuracy validation through RMSE and R2 metrics, temporal sentiment contribution analysis via SHAP values, and backtesting outcomes of quantitative strategies under Chinese market constraints. Section 5 concludes with contributions to stock price prediction and future research directions (see Appendix A Table A1 for technical indicator formulas).

2. Literature Review

The enduring debate surrounding market efficiency continues to shape scholarly inquiry into price predictability within emerging equity markets. While the efficient market hypothesis (EMH) posits that asset prices instantaneously incorporate all available information [1], empirical evidence from China’s stock market persistently challenges this theoretical paradigm. Initial linear analyses tentatively supported weak-form efficiency in Shanghai/Shenzhen indices via unit root tests, yet subsequent cointegration analyses revealed bidirectional predictability between daily returns, directly contradicting joint weak-form efficiency assumptions [2]. This paradox intensifies when nonlinear approaches are applied: multifractal detrended fluctuation analysis (MF-DFA) has identified persistent long-range correlations in Chinese equities during crisis periods [3], while liquidity–technical hybrid strategies have generated statistically significant excess returns over two decades, even after accounting for transaction costs and regulatory reforms [4].
These empirical observations align with behavioral finance frameworks demonstrating how noise trader dynamics [5] and systematic overreaction to news distort price discovery—mechanisms particularly pronounced in retail investor-dominated markets like China. Barberis et al. [6] modeled investor cognitive biases through conservatism (slow belief updating) and representativeness (overweighting salient/extreme information), explaining short-term underreaction (momentum effects) and long-term overreaction (reversal effects). Kariofyllas et al. [7] extended this framework under market stress, revealing that stress conditions exacerbate conservative bias-induced momentum effects, particularly post-Quantitative Easing interventions. Yu et al. [8] identified diverging momentum-reversal patterns in Chinese markets: low-turnover-ratio firms exhibit winner-minus-loser momentum, while high-turnover-ratio firms demonstrate return reversals—a dichotomy resonant with our hypothesis of distinct intraday (noise-driven) versus post-market (value-biased) sentiment mechanisms. Complementing this, Mugerman et al. [9] empirically demonstrated retail investors’ heightened sensitivity to attention-grabbing signals (e.g., exclamation marks in financial product names), establishing direct neurocognitive linkages between sentiment indicators and trading behavior. Gao and Zhang [10] advanced predictive methodologies through a composite investor sentiment index integrating five objective and one subjective indicator, with VMD-LSTM analysis confirming strong bidirectional interactions between sentiment and stock returns, thereby formalizing theoretical foundations for sentiment-driven price prediction.
Recent advancements in sentiment quantification have transformed our capacity to operationalize these behavioral insights. Conventional proxies, including survey-based indices [11,12], and composite metrics derived from the market, such as closed-end fund discounts [13,14] and IPO volumes [10], exhibit temporal latency in signal transmission but also suffer from systematic conflation with macroeconomic confounders. Natural language processing (NLP) breakthroughs address these limitations through real-time analysis of unstructured textual data. Early lexicon-based approaches [15,16,17], though interpretable, failed to capture contextual semantics and evolving financial vernacular. Machine learning classifiers, such as support vector machines (SVM) [18,19] and naïve Bayes classifiers [20,21], improved accuracy but required extensive labeled datasets [22].
Several deep-learning models have advanced sentiment analysis. Word2Vec [23] captures semantic relationships through distributed vector representations, while ELMo [24] addresses polysemy via context-aware embeddings. BERT [25], with its bidirectional transformers and masked language modeling, significantly enhances contextual understanding. In Chinese NLP tasks, the ERNIE model [26] stands out by integrating external knowledge and phrase-level masking strategies, achieving superior performance in sentiment classification and named entity recognition. The integration of such advanced sentiment quantification techniques with sequential models like long short-term memory (LSTM) and temporal convolutional networks (TCN) presents novel opportunities. For instance, real-time sentiment signals extracted from unstructured textual data could be processed through LSTM networks to model temporal dependencies in investor sentiment-driven price movements, potentially enhancing short-term forecasting accuracy—a persistent challenge in emerging markets.
Architectural innovations in sequential modeling further complicate the prediction landscape, while recurrent neural networks (RNNs) and their variants have become central to modeling sequential financial data. Traditional RNNs capture temporal dependencies through recurrent connections but face gradient vanishing or explosion issues in long sequences [27]. LSTM networks overcome these limitations via gating mechanisms (forget/input/output gates), enabling effective long-term dependency capture [28]. Recent empirical studies [29] have highlighted the superior performance of LSTMs in short-term stock price forecasting, achieving an average prediction accuracy of 89.7% in financial market predictions, outperforming baseline models significantly across heterogeneous datasets (technology/pharmaceutical sectors). However, model efficacy exhibits significant dependence on market dynamics and sector characteristics: convolutional neural networks (CNNs) excel at capturing localized volatility patterns in emerging markets like the National Stock Exchange (NSE) in India [30], while temporal convolutional networks (TCN) dominate U.S. equity prediction through dilated causal convolutions, reducing errors across technology (INTC), finance (JPM), and retail (AMZN) sectors [31]. Notably, LSTMs maintained competitive advantages in consumer goods (e.g., KO), suggesting sector-specific volatility regimes influence architectural suitability.
Contemporary research has established intraday sentiment as a transient predictor of short-term returns through distinct behavioral mechanisms. Renault [32] shows that intraday sentiment derived from high-frequency social media data (StockTwits) can predict short-term returns, especially during market close intervals, with price pressures reversing after trading hours—highlighting divergent mechanisms between intraday noise trading (liquidity constraints) and post-market sentiment absorption. By constructing transparent and replicable investor sentiment indicators, the research provides direct empirical evidence of sentiment-driven intraday trading activities, particularly emphasizing the impact of sentiment fluctuations among novice traders on market dynamics. Broadstock and Zhang [33] corroborate this using U.S. high-frequency data, showing that social media sentiment significantly influences intraday returns. Gillet and Renault [34] corroborate these findings, emphasizing that algorithmic traders incorporate public information quickly during trading hours, while post-market periods experience delayed reactions due to reduced arbitrage. Seok et al. [35] identify 30-minute persistence of sentiment-driven mispricing before correction, while subsequent work [36] reveals asymmetric intraday sentiment responses to macroeconomic announcements (e.g., temporary sentiment suppression following GDP growth disclosures). Gao et al. [37] emphasize the critical role of overnight information in driving intraday momentum, particularly following negative shocks, whereas Wang [38] observes stronger trading-hour correlations between negative sentiment and returns, suggesting heightened behavioral biases among intraday traders. Yang [39] extends this by showing that social media sentiment can induce persistent intraday mispricing, requiring several days for correction, pointing to unresolved interactions between intraday and post-market sentiment. Existing studies establish intraday sentiment as a transient predictor of short-term returns, driven by distinct behavioral mechanisms. However, no study systematically examines the potential for isolating intraday and post-market sentiment to improve price prediction accuracy. Our proposed temporally segmented sentiment construction, leveraging the ERNIE 3.0 model to develop separate intraday and post-market sentiment indices from Eastmoney Guba stock forum comments, aims to fill this gap by capturing the temporal sentiment asymmetry neglected in previous studies.
The “black-box” nature of machine learning models remains a persistent criticism in financial applications, which raises concerns about their lack of transparency in decision-making. Model-agnostic post hoc explanation methods—particularly local interpretable model-agnostic explanations (LIME) and Shapley additive explanations (SHAP)—have emerged as vital transparency tools. While LIME approximates complex models locally via linear surrogates, SHAP employs game-theoretic principles to quantify feature contributions through Shapley values. In financial contexts, SHAP has proven instrumental in demystifying deep learning frameworks: Deng et al. [40] proposed an integrated XGBoost–NSGAII–SHAP framework to predict and explain stock price crashes in the Chinese market, revealing through SHAP analysis that critical financial indicators vary significantly across market capitalizations. For small-cap firms, total assets growth rate emerged as the most influential predictor, whereas large-cap companies exhibited greater dependence on long-term debt-to-asset ratios and liquidity exceeding total assets ratios. Tran et al. [41] utilized SHAP to isolate long-term debt ratios as key predictors of Vietnamese financial distress, while Kumar et al. [42] applied SHAP to interpret deep Q-network (DQN) allocation logic in Sensex/Dow Jones trading strategies. Our hybrid architecture integrates SHAP analysis to illuminate prediction logic, directly addressing the opacity critique prevalent in existing literature.
In conclusion, the literature review has identified several gaps in the existing research on price predictability in emerging equity markets. Our proposed method’s innovations directly address these gaps. The temporally segmented sentiment construction captures the previously neglected temporal sentiment asymmetry, providing a more accurate understanding of investor sentiment’s impact on stock prices. The explainability analysis using the SHAP tool demystifies the “black-box” nature of deep learning models, allowing investors and regulators to understand the underlying factors driving stock price predictions. The quantitative trading backtesting under the T+1 trading mechanism accounts for real-world trading constraints in the Chinese market, enabling more practical evaluation of trading strategies. These innovations have the potential to advance the field of stock price prediction in emerging markets.

3. Materials and Methods

The proposed predictive framework comprises four integrated components: (1) construction of technical factor indicators from historical market data, (2) development of intraday and post-market sentiment indicators, (3) deep learning-based price modeling, and (4) comprehensive prediction analysis. The architectural workflow is shown in Figure 1.
Initially, historical trading data were acquired through the BaoStock system and processed to generate technical indicators. Subsequently, investor commentary data underwent rigorous text preprocessing followed by sentiment classification using ERNIE 3.0 to construct time-partitioned sentiment indices. Following this integrated feature engineering process, multiple deep learning architectures (LSTM, CNN, CNN-LSTM, and two-layer LSTM) were implemented to predict stock price. The final comparative analysis evaluated prediction accuracy through evaluation metrics, model interpretability via SHAP, and practical viability using a backtesting framework with a quantitative trading strategy.

3.1. Textual Data Collection and Preprocessing

Our stratified sampling methodology selected the largest market capitalization stock from each of the 11 CSI industry classifications (China Securities Index Co., Ltd., 2021) meeting dual criteria: (1) IPO date before 2015 ensuring decade-long data continuity; (2) liquidity threshold of CNY 500 million average daily trading volume (2015–2024). This approach achieved cross-sector representativeness while capturing natural cross-sectional volatility differences.
As detailed in Table 1, the final sample encompasses market leaders ranging from financial behemoths (ICBC: CNY 2.47 trillion market cap) to mid-cap innovators (ZTE: CNY 193.3 billion), exhibiting annualized volatility spanning 19.7% (Yangtze Power) to 46.0% (ZTE). The selected constituents collectively represent 22.5% of CSI 300’s total market capitalization, ensuring statistical significance.
This study utilized web scraping techniques to collect all Eastmoney Guba forum discussions for the eleven selected A-share stocks spanning the research period (1 January 2015–31 December 2024). The raw dataset underwent cleaning protocols to eliminate noise and enhance analytical validity. Non-textual elements, duplicate reposts, and semantically irrelevant content (such as ‘repost’) were systematically removed through regular expression matching and semantic filtering. This purification process reduced the dataset by 2.10% while preserving linguistically meaningful investor expressions. A total of 3,923,492 posts were obtained, with metadata including timestamps, titles, view counts, and reply counts. As illustrated in Table 2, these discussions predominantly reflect retail investor sentiment, characterized by emotionally charged language (e.g., speculative claims like “Fear Nothing! Institutions Keep Buying…” or pessimistic remarks such as “Run! Run Now!”). This feature makes the data highly suitable for assessing investor sentiment dynamics.
These sector-leading stocks have high liquidity and strong investor engagement, with their stock forums averaging over 900 monthly comments. Figure 2 shows monthly post volumes with an overall upward trend due to internet penetration and retail participation growth but significant fluctuations driven by market and stock-specific events. For example, Kweichow Moutai reached 44,864 posts in February 2021, likely associated with its stock price hitting a historical high and market capitalization exceeding CNY 3.2 trillion. ZTE Corporation recorded 19,244 posts in July 2018, coinciding with the U.S. sanction-induced stock plunge in the preceding month and the subsequent lifting of the export ban on 2 July. The relatively low comment volume for Yangtze Power may correlate with its lower volatility. ICBC’s post volumes were stable except during systemic events like the 2020 liquidity crisis. To further dissect post engagement patterns, posts were categorized by hourly intervals (Figure 3). This revealed that 62.92% of the posts occurred during trading hours (09:30–15:00), with 35.49% of posts being made during the morning session (09:30–11:30) and 23.26% during the afternoon session (13:00–15:00). Despite the concentration of activity during market hours, a significant proportion—25.26%—of posts were recorded after market close (15:00–22:00), indicating that investor sentiment continues to evolve beyond trading hours.
This temporal segmentation reveals critical differences in market dynamics. Intraday sentiment is closely linked to real-time market movements, with investors reacting immediately to stock price fluctuations and intraday developments. For instance, reactive comments like “High-Position Selling: The Peak Has Arrived” and panic-driven “Run! Run Now!” emerging during market volatility. Conversely, post-market dialogue transitions to fundamental analysis, exemplified by analyst assessments (“ZTE’s Valuation Gap Will Narrow in 2025”) and corporate announcements, which shape expectations for subsequent trading days. This dichotomy is exemplified by the contrast between intraday panic selling and post-market skepticism toward ubiquitous “buy” recommendations.
This temporal segmentation enhances predictive modeling through two distinct mechanisms: intraday sentiment correlates strongly with same-day price movements through immediate feedback loops, while post-market sentiment exhibits leading-indicator properties for next-day price loops by incorporating overnight information. The proposed segmentation of sentiment increases predictive resolution by isolating transient reactions from considered positioning, thereby enabling traders to differentiate between noise-driven volatility and expectation-driven trends. Such temporal granularity in sentiment analysis directly addresses the challenge of frequency mismatch in financial time series, offering methodological advantages for high-frequency market prediction.

3.2. Investor Sentiment Indicator Construction

While pretrained models like BERT and ERNIE 3.0 excel at capturing general linguistic patterns, their generic features lack alignment with the specialized lexicon and contextual nuances of investor sentiment analysis. To address domain adaptation challenges in financial sentiment analysis, we implemented a systematic fine-tuning protocol for the ERNIE 3.0-medium-zh model and curated a labeled financial corpus through stratified random sampling: 5000 posts were manually annotated from a raw dataset of 3,923,492 investor comments, yielding 1410 positive, 1830 neutral, and 1760 negative samples. Annotation criteria followed a three-tiered schema:
Positive (1): Explicit bullish signals (e.g., “bullish”, “buy”, and “rally”);
Negative (−1): Bearish expressions (e.g., “sell”, “plummet”, and “market manipulation”);
Neutral (0): Question-based phrasing (e.g., “When will dividends be paid?”), conditional statements (e.g., “buy if it drops”), or non-investment content.
The annotated dataset was partitioned into training (70%), validation (15%), and testing (15%) subsets using stratified random sampling to fine-tune both pretrained and fine-tuned versions of ERNIE 3.0 and BERT.
By leveraging this domain-specific fine-tuning, the models demonstrate enhanced capacity to decode critical sentiment cues such as speculative jargon (e.g., “limit-up”, “hyped”), irony, and context-dependent polarity shifts prevalent in market discussions.
Performance metrics for the three-class classification task (positive, neutral, and negative) were computed using macro-averaged accuracy, precision, recall, and F1-score, defined as
A c c = i = 1 3 T P i + T N i i = 1 3 T P i + T N i + F P i + F N i
P r e c i s i o n = 1 3 i = 1 3 T P i T P i + F P i
R e c a l l = 1 3 i = 1 3 T P i T P i + F N i
F 1 = 1 3 i = 1 3 2 × P r e c i s i o n i × R e c a l l i P r e c i s i o n i + R e c a l l i
where T P i , T N i , F P i , and F N i denote true positives, true negatives, false positives, and false negatives for class i { 1,2 , 3 } (positive, neutral, and negative). Macro-averaging mitigates class imbalance by assigning equal weight to all categories in order to enhance robustness and enable equitable evaluation of models’ per-class discriminative power.
To capture distinct temporal dynamics in investor sentiment, we segmented stock forum discussions into intraday (09:30–15:00) and post-market (15:00–next day 09:30) periods. Consistent with the logarithmic transformation methodology proposed by Antweiler [43], we computed sentiment indices for each stock through the formula
e m o = l n 1 + P 1 + N
where P and N, respectively, denote the counts of positive and negative comments during either intraday or post-market periods. This nonlinear transformation achieves two critical objectives: (1) maintaining sensitivity to absolute message quantities through log-ratio computation, and (2) implementing progressive discounting on polarized sentiment ratios, thus preventing overamplification of lopsided sentiment distributions.

3.3. Stock Price Prediction Model Design

The study utilized logarithmically transformed historical market data (open, close, high, low prices) to stabilize variance and normalize distribution and technical indicators including MA, EMA, MACD, ESI, WILLR, MOM, CMO, ULTOSC, OBV, and ADOSC, as detailed in Appendix A Table A1. Input features were categorized into three distinct groups: technical indicators alone (tech), technical indicators combined with daily aggregated sentiment indicator (sent), and technical indicators integrated with intraday and post-market sentiment indicators (in-post). Data preprocessing encompassed three key procedures: (1) outlier detection and removal using interquartile range method, (2) min-max normalization for feature scaling, and (3) implementation of a rolling time window strategy where 10 consecutive trading days’ data were used to predict the subsequent day’s closing price. The dataset was temporally partitioned chronologically into training (70%), validation (20%), and test (10%) subsets.
Four deep learning architectures were implemented for comparative analysis: an LSTM network modeling temporal dependencies through gated memory cells; a CNN architecture extracting local volatility patterns via convolutional filters; a hybrid LSTM–CNN model fusing multi-scale temporal and spatial features through parallel pathways; and a stacked LSTM variant with two hidden layers to enhance nonlinear representation capacity. Optimization employed the Adam algorithm with mean squared error (MSE) as the training objective, while hyperparameter tuning relied on validation set performance, and final model evaluation was conducted on the held-out test set. Model evaluation synthesized five complementary metrics: MSE for training objective alignment, RMSE for dimensional interpretability, MAE for robustness against extreme values, MAPE for relative error quantification, and R2 for explained variance assessment. To isolate the contribution of sentiment features, ablation studies systematically compared prediction accuracy across the three input configurations. This comparative framework enabled rigorous evaluation of how temporal granularity in sentiment indicators—from daily aggregates to intraday/post-market signals—affected model performance when combined with traditional technical indicators.

3.4. Model Interpretability Analysis

To improve model interpretability, we utilized SHAP (Shapley additive explanations), a game theory-based framework for explaining machine learning outputs, to quantify feature-specific contributions. Global feature importance was evaluated by aggregating mean absolute SHAP values over all test samples for the 11 stocks, with results normalized to percentage contributions to facilitate cross-stock comparisons. This approach not only identified dominant predictors (e.g., WILLR and closing prices) but also revealed sector-specific heterogeneity. To capture directional impacts, SHAP summary plots were generated to visualize the polarity (positive/negative) and magnitude of feature influences on predicted values, enabling the detection of nonlinear relationships.

3.5. Empirical Validation Framework

The trading strategy’s economic viability was rigorously evaluated through a multi-dimensional backtesting protocol designed to replicate A-share market trading constraints. To ensure ecological validity, the analysis spanned a full market cycle (January 2015–December 2024), partitioned chronologically into three phases: 70% training set (2015–2021) with expanding window retraining, 20% validation set (2022–2023) for hyperparameter optimization, and 10% testing set (2024) for out-of-sample evaluation. Eleven representative A-share stocks stratified by sector and volatility profile were selected).
Transaction costs were meticulously modeled to reflect real-world execution friction, incorporating both explicit and implicit components. Explicit costs totaled 0.07% per round trip, including brokerage commissions (0.018%), settlement fees (0.002%), and stamp duty (0.05%). Implicit costs accounted for market impact, with 0.045% slippage calibrated. According to the Shanghai Stock Exchange Market Quality Report [44], the price impact coefficient of stocks with a market capitalization of over 10 billion was 0.09% under the condition of a CNY 100,000 trading volume. These components collectively established a total transaction cost of 0.115%, which was integrated into the trading signal generation process.
The LSTM-based prediction model generated daily trading signals through a threshold-based decision rule, constrained by China’s T+1 trading mechanism requiring positions opened at day t’s opening price to be closed at day t+1’s opening price. To ensure realistic trade execution, all orders were assumed to fill at the open price.
Given the restrictive short-selling mechanisms in China’s A-share market (requiring margin trading qualifications and limited stock availability), the strategy operates under long-only conditions. A long position was initiated if
P e > P o × ( 1 + T r a n s a c t i o n   C o s t )
while exit was completely otherwise, where P e was the predicted close, P o was the opening price. T r a n s a c t i o n   C o s t , including slippage, was set at 0.115%.
Strategy performance was benchmarked against a buy-and-hold approach, enabling direct comparison of risk-adjusted returns while controlling for market beta exposure.

3.6. Computational Environment

The ERNIE 3.0-medium-zh architecture was fine-tuned using PaddlePaddle (v2.4.1) with an AdamW optimizer (learning rate = 2 × 10−5, weight_decay = 0.01) and cross-entropy loss. The training protocol employed 32-sample batches (determined via grid search as optimal) for 3 epochs (15 s/epoch) on NVIDIA Tesla V100 GPU, Santa Clara, CA, USA, using a maximum sequence length of 128 based on financial text analysis. The setup included a linear learning rate schedule with a 10% warmup ratio and a fixed random seed (42) for reproducibility, with validation-based early stopping triggered at <0.1% loss improvement threshold. The sentiment classification of 3,923,492 comments required 45 min of computational processing.
The experimental framework was implemented in a unified high-performance computing environment comprising an NVIDIA RTX 4090 GPU, Santa Clara, CA, USA (24 GB VRAM with CUDA 12.6 acceleration), 16-core AMD EPYC 9354 CPU @ 3.5 GHz, and 60 GB DDR5 RAM. This configuration supported three computational phases:
Model Training: Comparative testing across four deep learning architectures (LSTM/CNN/LSTM-CNN/two-layer LSTM) and three feature configurations (tech/sent/in-post) for eleven stocks completed in 130 min, demonstrating daily retraining feasibility.
Interpretability: SHAP analysis consumed 390 min for feature importance computation and visualization across all test samples.
Backtesting: The empirical validation cycle, including trading signal generation, transaction cost modeling, and benchmark comparison, required 109 min.
All components shared the same hardware cluster through containerized task scheduling, ensuring computational reproducibility.

4. Results and Discussion

4.1. Sentiment Classification

The experimental results in Table 3 reveal significant differences in the performance of ERNIE 3.0 and BERT models before and after domain-specific fine-tuning. Both models exhibit substantial improvements across all metrics after the two-stage fine-tuning process, highlighting the critical role of task adaptation in financial sentiment analysis.
The experimental results demonstrate that the ERNIE 3.0 model, fine-tuned with annotated data, achieves superior performance in the three-class sentiment classification task, with a macro-averaged accuracy of 0.7680, significantly outperforming both the non-fine-tuned baseline models and the fine-tuned BERT model. This underscores the necessity of domain adaptation in financial text sentiment analysis. Generic pre-trained models (e.g., ERNIE 3.0 and BERT) exhibit poor classification performance (accuracy < 0.4) due to their inability to capture domain-specific terminology, sarcastic expressions, and hybrid sentiment structures prevalent in stock forum comments, highlighting the unique challenges of financial text analysis.
The annotated dataset exhibits pronounced class imbalance (negative: 44.54%, neutral: 31.62%, positive: 23.84%), reflecting stronger emotional articulation during market downturns. This asymmetry aligns with behavioral finance principles where loss aversion drives urgent negative expressions (e.g., panic-driven posts like “Run! Run Now!”), while positive sentiment remains subdued even during rallies—potentially due to profit-taking caution.
The performance improvement of fine-tuned models validates the efficacy of limited high-quality annotated data. Despite constituting only 0.13% of the total dataset, the annotated samples cover critical sentiment expression patterns (e.g., sarcastic phrases, industry jargon), enabling the model to identify non-explicit emotional signals.
However, the model still misclassifies certain ambiguous expressions.
Case 1: “Hengrui Pharmaceuticals will retrace its losses soon—with so many private equity funds backing it, what goes down must come up” was misclassified as negative, likely due to overemphasis on “losses” and “goes down” while neglecting the bullish implication of “come up”.
Case 2: “Shorting PetroChina = printing money!” was incorrectly labeled positive, potentially misinterpreting “printing money” without contextual understanding of short-selling mechanics.
Case 3: “BYD’s cars might be bad, but hype-driven investors keep pumping it. Even a pig can fly if it catches the right wind” was classified as negative, capturing “bad” and “pumping” while missing the bullish idiom “a pig can fly”.
Case 4: “Added positions today—4200 stocks fell, but those with bottom accumulation volume are my top picks” was mislabeled negative, focusing on “fell” and “bottom” while disregarding “added positions” and “top picks”.
Sentiment misclassification distorts price prediction accuracy, consequently generating unreliable signals in quantitative trading frameworks.

4.2. Empirical Validation of Predictive Performance

The empirical validation framework rigorously assessed the predictive efficacy of integrating intraday and post-market sentiment indicators with conventional technical factors across eleven representative stocks. Comprehensive preprocessing protocols were implemented to ensure data quality, including interquartile-range-based outlier correction, strategic handling of missing values through deletion during trading halts, and rigorous min-max normalization to mitigate feature scaling disparities. A sliding window approach (window size = 10 days) generated sequential input–output pairs while preventing data leakage through temporal partitioning (70% training, 20% validation, and 10% testing).
Comparative analysis of four deep learning architectures—LSTM, CNN, CNN-LSTM, and two-layer LSTM—revealed distinct performance hierarchies based on cross-stock-averaged metrics. The experimental results presented in Table 4 reflect the averaged performance across eleven representative stocks, with each model’s performance metrics calculated through three-stage aggregation: individual prediction generation for each stock, metrics computation per stock, and final metrics averaging across the eleven stocks.
The results particularly highlight LSTM’s superior prediction accuracy, achieving an averaged test MSE of 0.00045 and R2 of 0.91707 integrating time-partitioned investor sentiment indicators. The 81.5% MSE reduction compared to CNN baseline (0.00243) demonstrates consistent outperformance across the eleven stocks. Notably, the cross-stock standard deviations for LSTM metrics remained below 0.00019 (MSE) and 0.049 (R2), confirming model robustness beyond input features selection.
Feature ablation studies highlighted the critical role of temporally stratified sentiment indicators. Models utilizing combined intraday–post-market sentiment (in-post) consistently surpassed those employing aggregated daily sentiment (sent) or technical factors alone (tech). For example, the LSTM’s MAE improved by 16.9% (0.00045 vs. 0.00066) when transitioning from “sent” to ”in-post” features, while the R2 gap between in-post and tech configurations widened to 1.5 percentage points (0.917 vs. 0.922). These results empirically validate the hypothesis that decoupling intraday and post-market sentiments provides superior informational granularity, enabling more precise quantification of investor sentiment across different periods.
Hyperparameter optimization via randomized search further enhanced model adaptability, yielding stock-specific configurations (Table 5). By performing a randomized search for hyperparameter optimization, we can customize the model for each individual stock, enabling it to better adapt to the specific market conditions of each security. This not only improves the model’s ability to capture market trends but also enhances its reliability in financial forecasting, highlighting the crucial role of hyperparameter optimization in the field of finance.
The LSTM’s architectural superiority in modeling financial time series, coupled with optimized hyperparameter configurations, provides a robust framework for adaptive market forecasting. This methodology advances quantitative finance by systematically integrating behavioral signals with traditional market data, offering a replicable paradigm for developing sentiment-aware trading strategies.

4.3. Interpretability Analysis

To enhance the interpretability and generalizability of findings, we conducted SHAP (Shapley additive explanations) analysis across all 11 sample stocks. Feature importance rankings were systematically quantified using SHAP values, with SHAP summary plots visualizing the directional impacts of key predictors. Table 6 presents the SHAP importance ratios (mean absolute SHAP values normalized to percentage contributions) for technical indicators and sentiment features across stocks.
Three key patterns emerge from the analysis.
The analysis reveals a pronounced divergence in market sensitivity to sentiment indicators across stocks, contingent on investor structure and behavioral dynamics. Institutional-dominated stocks (e.g., Kweichow Moutai, Yangtze Power) exhibit amplified sentiment effects, where intraday and post-market sentiment contribute 6.65–10.53% and 5.52–5.73% to predictive power, respectively, significantly exceeding sample averages (2.73% intraday, 3.57% post-market). This amplification stems from their ownership structure: over 76% institutional ownership (state-owned enterprises, mutual funds) as of December 2024, characterized by conservatism bias and delayed information assimilation. Institutional inertia prolongs sentiment signal incorporation into prices, extending predictive horizons. Conversely, retail-dominated technology stocks (e.g., BYD, ZTE) display attenuated sentiment importance (intraday: 1.75–0.69%), driven by higher retail participation (37.60–43.40% institutional ownership) and social media-driven herding. Salient news triggers immediate overreactions, causing sentiment to be rapidly priced within single sessions, followed by mean-reversion patterns that erode multi-period predictive value. This structural dichotomy underscores how market microstructure mediates sentiment dynamics: institutional rigidity amplifies sentiment persistence through delayed feedback loops, while retail hyperactivity accelerates sentiment decay via cognitive biases and short-termism. Such divergence highlights the critical role of investor heterogeneity in shaping sentiment–price interactions, necessitating differentiated modeling approaches for institutional versus retail-driven equities in quantitative strategies.
Besides, SHAP analysis reveals a consistent attenuation of sentiment impacts across time lags (Figure 4, Figure 5 and Figure 6). For instance, in Kweichow Moutai (600519), the immediate post-market sentiment (lag 0) ranks 5th in feature importance, while its one-day (lag 1) and two-day (lag 2) lags drop to 12th and 18th positions, respectively. This rapid decay pattern persists across all 11 sample stocks, suggesting efficient market assimilation of sentiment signals—a finding consistent with weak-form efficiency assumptions.
While sentiment indicators generally exhibit positive predictive relationships, certain stocks demonstrate nuanced dynamics. For example, Zijin Mining (601899) shows negative correlations between immediate intraday sentiment (in_emo_0) and price movements, potentially reflecting correction mechanisms for overreactions in high-volatility contexts.
The SHAP framework elucidates how historical prices, technical indicators, and sentiment features jointly drive predictions across heterogeneous stocks. This multi-stock validation enhances the interpretability framework’s robustness while revealing sector-specific decision patterns crucial for developing adaptive quantitative strategies.

4.4. Quantitative Trading Strategy Evaluation

The proposed LSTM-based quantitative trading strategy, which integrates intraday (09:30–15:00) and post-market (15:00–09:30) sentiment indicators, was rigorously validated through backtesting on eleven heterogeneous stocks. As delineated in Table 7, the hybrid strategy combining both intraday and post-market sentiment metrics achieved superior returns, with a mean logarithmic return of 0.37056, outperforming baseline (0.24410), aggregated-sentiment (0.32405), and sentiment-excluded (0.22699) strategies across all stocks except ZTE. This empirical evidence substantiates the critical role of temporal sentiment partitioning in enhancing price prediction accuracy and strategy profitability. Comprehensive specifications of cost calibration methodologies, temporal scope, stock selection, and conditional trading triggers are systematically documented in Section 3.5.
Comprehensive risk metric analysis (Table 8) demonstrates the strategy’s robust risk mitigation capabilities.
Value-at-Risk (5%): Average VaR improved from −0.02972 (baseline) to −0.02036, reflecting a 31.5% reduction in tail risk exposure.
Maximum Drawdown: Portfolio drawdowns decreased by 49.6%, from −0.24672 to −0.12442, indicating enhanced capital preservation during market downturns.
Risk-Adjusted Returns: The Sharpe ratio surged from 0.73823 to 1.64594, signifying a 122.9% improvement in risk-adjusted performance.
Real markets often exhibit variable fills and liquidity constraints, contributing to slippage volatility. Additional cost variations arise from temporal fluctuations in brokerage commissions, settlement fees, and stamp duties. To simulate such environments, we conducted a multi-dimensional sensitivity analysis on the quantitative trading strategy, parameterizing transaction costs across a spectrum of 0.001 to 0.005 (Table 9). The analysis reveals three critical regimes:
Stability Range (0.001–0.0014): The strategy maintains consistent performance with ROI between 0.370 and 0.350 and Sharpe ratios of 1.642–1.569, demonstrating minimal sensitivity to cost variations.
Critical Threshold (0.0015): A pronounced performance deterioration occurs, with ROI decreasing by 11.4% (0.328 vs. peak) and Sharpe ratio declining by 10.7% (1.464 vs. peak).
Economic Viability Limit (0.004): Strategy effectiveness diminishes significantly as ROI approaches baseline levels (0.255 vs. 0.244) with Sharpe ratio reduction to 1.137.
These sensitivity thresholds have direct operational implications: (1) The stability range (0.10–0.14%) corresponds to China’s prevailing transaction cost structure, comprising 0.05% stamp duty, 0.002% transfer fee, and 0.045% estimated slippage, confirming strategic robustness under normative liquidity conditions. Empirical testing demonstrates transfer fee modifications (both reductions and twofold increases) have limited effects on performance metrics. (2) The critical 0.15% threshold signifies that reinstating historical stamp duty levels (0.1% effective September 2008–August 2023) or amplifying slippage costs—exemplified through either trade size escalation from CNY100k to CNY900k transactions or shifting executions to stocks with CNY2–3B market capitalization—would precipitate greater than 10% degradation in both ROI and Sharpe ratios. (3) At 0.4% aggregate cost (equivalent to 0.002% transfer fee, 0.1% stamp duty combined with 0.028% slippage for CNY3–5B market capitalization stocks under CNY900k trade executions), the strategy’s alpha converges statistically with baseline performance, necessitating the implementation of rigorous liquidity filtration criteria for security selection.
While these metrics validate the core proposition, three limitations warrant attention. First, our price impact assumptions tied solely to market capitalization and trade size fail to account for sector-specific liquidity variations (e.g., technology vs. utilities) and temporal turnover rate fluctuations that dynamically influence execution costs. Second, the strategy remains vulnerable to tail risk scenarios, including black swan events and acute liquidity contractions, where historical volatility patterns and linear slippage relationships become invalidated. Third, the assumed T+1 settlement mechanisms and China-specific transaction cost structures may constrain applicability to international markets employing distinct regulatory frameworks, particularly those with real-time settlement protocols.
In spite of these constraints, the findings collectively demonstrate that time-partitioned sentiment-aware LSTM architectures, when coupled with quantitative trading strategies, effectively translate predictive accuracy into economic value. By bridging the gap between investor sentiment extraction and actionable trading insights, this framework advances the development of transparent, sentiment-driven quantitative strategies in dynamic equity markets.

5. Conclusions and Future Research

This study bridges critical gaps between behavioral finance theory and algorithmic trading practice by developing a temporal sentiment partitioning framework that enhances predictive accuracy and model interpretability in China’s A-share market. Through the systematic integration of intraday (09:30–15:00) and post-market (15:00–next day 09:30) sentiment indicators with technical factors, we demonstrate that temporal granularity in sentiment analysis significantly reduces market uncertainty while improving the economic viability of quantitative strategies. Three pivotal contributions emerge from our findings:
First, partitioning investor sentiment into intraday (09:30–15:00) and post-market (15:00–next day 09:30) components captures distinct behavioral mechanisms. Intraday sentiment reflects immediate reactions to price fluctuations and noise-driven trading, while post-market sentiment incorporates fundamental analysis and overnight information, serving as a leading indicator for subsequent trading sessions. Utilizing a fine-tuned ERNIE 3.0 model for domain-specific sentiment extraction (F1-score: 0.77), the framework achieves robust three-class sentiment classification, enabling precise analysis of 3,923,492 investor discussions across intraday (09:30–15:00) and post-market (15:00–09:30) periods. Empirical results confirm that models integrating time-stratified sentiment indicators (LSTM with in-post features) achieve superior prediction accuracy, attaining an R2 of 0.917, reducing MSE by 31.8% compared to daily-aggregated sentiment models and 47.1% versus technical-only baselines.
Second, SHAP analysis demystifies the “black-box” nature of deep learning models, revealing cross-sector heterogeneity in sentiment contributions. SHAP interpretability analysis reveals that time-partitioned sentiment indicators collectively contribute 6.30% to model decisions, with post-market sentiment (3.57%) exhibiting marginally stronger predictive influence than intraday sentiment (2.73%). For institutional-dominated stocks like Kweichow Moutai, intraday and post-market sentiment contributes 6.65% and 10.53% to prediction logic, highlighting behavioral biases in price discovery. Conversely, retail-dominated technology stocks like BYD exhibit weaker sentiment dependencies, emphasizing sector-specific modeling necessities.
Third, backtesting under China’s trading constraints demonstrates that sentiment-aware strategies generate 51.8% higher annualized logarithmic returns (0.371 vs. 0.244 baseline) with 49.6% lower maximum drawdowns. The Sharpe ratio improvement (1.646 vs. 0.738) underscores enhanced risk-adjusted performance, validating the framework’s robustness. Transaction cost sensitivity analysis further identifies a viability threshold (0.4% per trade) beyond which profitability converges to benchmark levels.
The theoretical and practical implications of this research are multifaceted. Methodologically, temporal partitioning of unstructured text data advances financial NLP by aligning sentiment frequencies with market microstructures. The ERNIE 3.0 fine-tuning protocol provides a replicable pipeline for domain-specific sentiment extraction, addressing contextual nuances in investor forums. From a regulatory perspective, SHAP-driven transparency enables policymakers to identify sentiment-driven mispricing mechanisms, informing interventions to mitigate retail investor vulnerabilities during high-volatility periods. For practitioners, the validated T+1 strategy offers a systematic framework to exploit sentiment asymmetries while adhering to market constraints, bridging the gap between behavioral insights and executable trading logic.
Based on the established foundation, three promising research directions emerge. First, leveraging the Eastmoney Guba forum as a baseline, integrating multi-platform investor sentiment may improve the robustness of sentiment indicator construction. This approach would involve separate fine-tuning of the ERNIE 3.0 architecture on labeled datasets from specialized financial platforms (e.g., Xueqiu containing professional analytical content) and social media networks (e.g., Weibo featuring retail investor discussions). Such domain-adaptive training enables the model to capture platform-specific linguistic patterns and discourse characteristics for enhanced sentiment classification performance. To address platform-specific linguistic variations, the derived sentiment scores from heterogeneous sources could serve as distinct explanatory variables within ensemble machine learning frameworks, thereby preserving domain-specific informational value while mitigating cross-platform lexical interference.
Second, architecting hybrid neural systems that synergistically combine cross-platform sentiment dynamics with adaptive decision-making mechanisms, where attention-based neural modules could enhance stock price prediction accuracy, while reinforcement learning agents would optimize trading policy adjustments via sentiment-driven reward signals modulated by real-time market feedback. To counter potential overfitting in network training, adversarial regularization protocols could be implemented through gradient penalty constraints on value function approximators, complemented by synthetic crisis scenario generation using generative adversarial networks trained on historical market dislocation patterns, thereby enhancing model robustness against low-frequency extreme events.
Third, investigating temporal patterns of investor sentiment surrounding financial crises could provide critical insights into behavioral influences on market predictions. Future research could analyze how pre-crisis and post-crisis sentiment divergences affect predictive outcomes by establishing comparative frameworks that contrast sentiment-driven forecasts during stable periods versus crisis-adjacent intervals. For instance, examining whether panic-dominated sentiment preceding the 2015 market crash exhibited stronger predictive validity for subsequent price corrections compared to post-crisis stabilization phases. This approach could integrate sentiment dynamics with traditional financial models by augmenting factor regressions with temporal sentiment metrics (pre-crisis vs. post-crisis), enabling systematic comparison of machine learning outputs with behavioral finance hypotheses.
In conclusion, this research bridges critical gaps between behavioral finance theory and algorithmic trading practice. By demonstrating that temporal sentiment granularity, explainable AI, and market-aware strategy design collectively enhance price prediction frameworks, the findings provide actionable insights for investors, regulators, and researchers navigating sentiment-driven financial ecosystems. The integration of temporally stratified sentiment analysis with interpretable machine learning not only advances academic discourse but also equips market participants with tools to decode the complex interplay of psychology and pricing in modern equity markets.

Author Contributions

Conceptualization, G.S. and Y.L.; data curation, G.S.; formal analysis, G.S.; investigation, G.S.; methodology, G.S.; project administration, Y.L.; resources, Y.L.; software, G.S.; supervision, Y.L.; validation, G.S.; visualization, G.S.; writing—original draft, G.S.; writing—review and editing, G.S. and Y.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Table A1. List of technical indicators and formulas.
Table A1. List of technical indicators and formulas.
IndicatorParametersFormula
Moving average (MA)5; 30; 60 M A n = 1 n i = 1 n C l o s e i
Exponential Moving Average (EMA)5; 30; 60 E M A t = C l o s e t × 2 n + 1 + E M A t 1 × 1 2 n + 1
Moving Average Convergence Divergence (MACD)(6, 15, 6); (12, 26, 9); (30, 60, 30) M A C D = E M A s h o r t E M A l o n g
S i g n a l L i n e = E M A M A C D
H i s t o g r a m = M A C D S i g n a l L i n e
Relative Strength Index (RSI)14 R S = A v e r a g e G a i n A v e r a g e L o s s
R S I = 100 100 1 + R S
Williams’ %R (WILLR)14 W I L L R = H i g h e s t H i g h C l o s e H i g h e s t H i g h L o w e s t L o w × 100
Momentum (MOM)14 M O M t = C l o s e t C l o s e t 14
Chande Momentum Oscillator (CMO)14 C M O = S u m o f G a i n s S u m o f L o s s e s S u m o f G a i n s + S u m o f L o s s e s × 100
Ultimate Oscillator (ULTOSC)7, 14, 28 U L T O S C = ( 100 × S u m o f 7 p e r i o d L o w s + S u m o f 14 p e r i o d L o w s + S u m o f 28 p e r i o d L o w s ) / ( 3 × S u m o f 28 p e r i o d L o w s )
On-Balance Volume (OBV) O B V t = O B V t 1 + V o l u m e t s i g n C l o s e t C l o s e t 14
Accumulation/Distribution Oscillator (ADOSC)3, 10 A D L t = A D L t 1 + V o l u m e t × C l o s e t L o w t H i g h t C l o s e t H i g h t L o w t
A D O S C = A D L f a s t A D L s l o w

References

  1. Fama, E.F. Efficient Capital Markets: A Review of Theory and Empirical Work. J. Financ. 1970, 25, 383–417. [Google Scholar] [CrossRef]
  2. Luo, J.; Zhang, M.; Zhang, Y. An Empirical Study on the Efficiency of the Chinese Stock Market. In Proceedings of the 2022 International Conference on Mathematical Statistics and Economic Analysis, Dalian, China, 27–29 May 2022; Atlantis Press: Dordrecht, The Netherlands, 2023; pp. 690–698. [Google Scholar]
  3. Ameer, S.; Nor, S.; Ali, S.; Zawawi, N. The Impact of COVID-19 on BRICS and MSCI Emerging Markets Efficiency: Evidence from MF-DFA. Fractal Fract. 2023, 7, 519. [Google Scholar] [CrossRef]
  4. Yu, B. Is the Chinese stock market efficient? Evidence from a combined liquidity trading strategy. China Financ. Rev. Int. 2024, in press. [Google Scholar] [CrossRef]
  5. De Long, J.B.; Shleifer, A.; Summers, L.H.; Waldmann, R.J. Noise Trader Risk in Financial Markets. J. Political Econ. 1990, 98, 703–738. [Google Scholar] [CrossRef]
  6. Barberis, N.; Shleifer, A.; Vishny, R. A model of investor sentiment. J. Financ. Econ. 1998, 49, 307–343. [Google Scholar] [CrossRef]
  7. Kariofyllas, S.; Philippas, D.; Siriopoulos, C. Cognitive biases in investors’ behaviour under stress: Evidence from the London Stock Exchange. Int. Rev. Financ. Anal. 2017, 54, 54–62. [Google Scholar] [CrossRef]
  8. Yu, L.; Fung, H.-G.; Leung, W.K. Momentum or contrarian trading strategy: Which one works better in the Chinese stock market. Int. Rev. Econ. Financ. 2019, 62, 87–105. [Google Scholar] [CrossRef]
  9. Mugerman, Y.; Steinberg, N.; Wiener, Z. The exclamation mark of Cain: Risk salience and mutual fund flows. J. Bank. Financ. 2022, 134, 106332. [Google Scholar] [CrossRef]
  10. Gao, Z.; Zhang, J. The fluctuation correlation between investor sentiment and stock index using VMD-LSTM: Evidence from China stock market. N. Am. J. Econ. Financ. 2023, 66, 101915. [Google Scholar] [CrossRef]
  11. Oliveira, N.; Cortez, P.; Areal, N. The impact of microblogging data for stock market prediction: Using Twitter to predict returns, volatility, trading volume and survey sentiment indices. Expert Syst. Appl. 2017, 73, 125–144. [Google Scholar] [CrossRef]
  12. Rehman, M.; Raheem, I.; Al Rababa’a, A.; Ahmad, N.; Vo, X. Reassessing the Predictability of the Investor Sentiments on US Stocks: The Role of Uncertainty and Risks. J. Behav. Financ. 2023, 24, 450–465. [Google Scholar] [CrossRef]
  13. Kousenidis, D.; Maditinos, D.; Sevic, Z. The Premium/Discount of Closed-End Funds as a Measure of Investor Sentiment: Evidence from Greece. J. Appl. Bus. Res. 2011, 27, 29–51. [Google Scholar] [CrossRef]
  14. Colón-De-Armas, C.; Rodriguez, J.; Romero-Perez, H. Investor Sentiment and U.S. Presidential Elections. Rev. Behav. Financ. 2017, 9, 227–241. [Google Scholar] [CrossRef]
  15. Taboada, M.; Brooke, J.; Tofiloski, M.; Voll, K.; Stede, M. Lexicon-Based Methods for Sentiment Analysis. Comput. Linguist. 2011, 37, 267–307. [Google Scholar] [CrossRef]
  16. Im, T.; San, P.; On, C.; Alfred, R.; Anthony, P. Impact of Financial News Headline and Content to Market Sentiment. Int. J. Mach. Learn. Comput. 2014, 4, 237–242. [Google Scholar] [CrossRef]
  17. Barbaglia, L.; Consoli, S.; Manzan, S.; Pezzoli, L.T.; Tosetti, E. Sentiment analysis of economic text: A lexicon-based approach. Econ. Inq. 2025, 63, 125–143. [Google Scholar] [CrossRef]
  18. Xia, H.S.; Yang, Y.T.; Pan, X.T.; Zhang, Z.P.; An, W.Y. Sentiment analysis for online reviews using conditional random fields and support vector machines. Electron. Commer. Res. 2020, 20, 343–360. [Google Scholar] [CrossRef]
  19. Fei, Y. Simultaneous Support Vector Selection and Parameter Optimization Using Support Vector Machines for Sentiment Classification. In Proceedings of the 7th IEEE International Conference on Software Engineering and Service Science (ICSESS), Beijing, China, 26–28 August 2016; IEEE: Piscataway, NJ, USA, 2016; pp. 59–62. [Google Scholar]
  20. Sunarya, P.O.A.; Refianti, R.; Mutiara, A.B.; Octaviani, W. Comparison of Accuracy between Convolutional Neural Networks and Naive Bayes Classifiers in Sentiment Analysis on Twitter. Int. J. Adv. Comput. Sci. Appl. 2019, 10, 77–86. [Google Scholar] [CrossRef]
  21. Yunita, S.; Amaliah, Y.; Suprianto; Indriani, A.; Fadlan, M.; Muhammad. Sentiment Analysis of Practice Service’s Questionnaire Using Naive Bayes Classifier Method. In Proceedings of the 3rd International Conference on Cybernetics and Intelligent System (ICORIS), Makasar, Indonesia, 25–26 October 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 117–122. [Google Scholar]
  22. Alderazi, F.M.; Algosaibi, A.A.; Alabdullatif, M.A. Multi-labeled Dataset of Arabic COVID-19 Tweets for Topic-Based Sentiment Classifications. In Proceedings of the 14th IEEE Conference on Evolving and Adaptive Intelligent Systems (IEEE EAIS), Larnaca, Cyprus, 25–26 May 2022; IEEE: Piscataway, NJ, USA, 2022. [Google Scholar]
  23. Mikolov, T.; Chen, K.; Corrado, G.; Dean, J. Efficient Estimation of Word Representations in Vector Space. arXiv 2013. [Google Scholar] [CrossRef]
  24. Peters, M.; Neumann, M.; Iyyer, M.; Gardner, M.; Clark, C.; Lee, K.; Zettlemoyer, L. Deep contextualized word representations. arXiv 2018. [Google Scholar] [CrossRef]
  25. Devlin, J.; Chang, M.-W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of the North American Chapter of the Association for Computational Linguistics, Minneapolis, MN, USA, 2–7 June 2019. [Google Scholar]
  26. Sun, Y.; Wang, S.; Li, Y.; Feng, S.; Chen, X.; Zhang, H.; Tian, X.; Zhu, D.; Tian, H.; Wu, H. ERNIE: Enhanced Representation through Knowledge Integration. arXiv 2019, arXiv:1904.09223. [Google Scholar]
  27. Zucchet, N.; Orvieto, A. Recurrent neural networks: Vanishing and exploding gradients are not the end of the story. arXiv 2024, arXiv:2405.21064. [Google Scholar]
  28. Noh, S.-H. Analysis of Gradient Vanishing of RNNs and Performance Comparison. Information 2021, 12, 442. [Google Scholar] [CrossRef]
  29. Billah, M.M.; Sultana, A.; Bhuiyan, F.; Kaosar, M.G. Stock price prediction: Comparison of different moving average techniques using deep learning model. Neural Comput. Appl. 2024, 36, 5861–5871. [Google Scholar] [CrossRef]
  30. Anand, C. Comparison of Stock Price Prediction Models using Pre-trained Neural Networks. J. Ubiquitous Comput. Commun. Technol. 2021, 3, 122–134. [Google Scholar] [CrossRef]
  31. Li, J.; Wang, S.; Zhu, Z.; Liu, M.; Zhang, C.; Han, B. Stock Prediction Based on Deep Learning and its Application in Pairs Trading. In Proceedings of the 2022 International Symposium on Networks, Computers and Communications (ISNCC), Shenzhen, China, 19–22 July 2022; pp. 1–7. [Google Scholar]
  32. Renault, T. Intraday online investor sentiment and return patterns in the U.S. stock market. J. Bank. Financ. 2017, 84, 25–40. [Google Scholar] [CrossRef]
  33. Broadstock, D.C.; Zhang, D. Social-media and intraday stock returns: The pricing power of sentiment. Financ. Res. Lett. 2019, 30, 116–123. [Google Scholar] [CrossRef]
  34. Gillet, R.; Renault, T. When machines read the web: Market efficiency and costly information acquisition at the intraday level. Finance 2019, 40, 7–49. [Google Scholar] [CrossRef]
  35. Seok, S.I.; Cho, H.; Ryu, D. Stock Market’s responses to intraday investor sentiment. N. Am. J. Econ. Financ. 2021, 58, 101516. [Google Scholar] [CrossRef]
  36. Seok, S.; Cho, H.; Ryu, D. Scheduled macroeconomic news announcements and intraday market sentiment. N. Am. J. Econ. Financ. 2022, 62, 101739. [Google Scholar] [CrossRef]
  37. Gao, Y.; Han, X.; Li, Y.; Xiong, X. Overnight momentum, informational shocks, and late informed trading in China. Int. Rev. Financ. Anal. 2019, 66, 101394. [Google Scholar] [CrossRef]
  38. Wang, W. Investor sentiment and stock market returns: A story of night and day. Eur. J. Financ. 2024, 30, 1437–1469. [Google Scholar] [CrossRef]
  39. Yang, N.; Fernandez-Perez, A.; Indriawan, I. The price impact of tweets: A high-frequency study. Financ. Rev. 2025, 60, 147–171. [Google Scholar] [CrossRef]
  40. Deng, S.; Zhu, Y.; Duan, S.; Fu, Z.; Liu, Z. Stock Price Crash Warning in the Chinese Security Market Using a Machine Learning-Based Method and Financial Indicators. Systems 2022, 10, 108. [Google Scholar] [CrossRef]
  41. Tran, K.L.; Le, H.A.; Nguyen, T.H.; Nguyen, D.T. Explainable Machine Learning for Financial Distress Prediction: Evidence from Vietnam. Data 2022, 7, 160. [Google Scholar] [CrossRef]
  42. Kumar, S.; Vishal, M.; Ravi, V. Explainable Reinforcement Learning on Financial Stock Trading using SHAP. arXiv 2022, arXiv:2208.08790. [Google Scholar]
  43. Antweiler, W.; Frank, M.Z. Is All That Talk Just Noise? The Information Content of Internet Stock Message Boards. J. Financ. 2004, 59, 1259–1294. [Google Scholar] [CrossRef]
  44. SSE Research Institute. Shanghai Stock Exchange Market Quality Report (2023). Available online: https://www.sse.com.cn/aboutus/research/special/c/10632378/files/b2b77bd4f78b4c0e8e16df5d0ef00214.pdf (accessed on 12 February 2025).
Figure 1. Architectural workflow of the proposed deep learning framework integrating temporal sentiment partitioning.
Figure 1. Architectural workflow of the proposed deep learning framework integrating temporal sentiment partitioning.
Systems 13 00390 g001
Figure 2. The monthly post volume for the sample stocks.
Figure 2. The monthly post volume for the sample stocks.
Systems 13 00390 g002
Figure 3. The hourly post volume for the sample stocks.
Figure 3. The hourly post volume for the sample stocks.
Systems 13 00390 g003
Figure 4. SHAP summary plots. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Figure 4. SHAP summary plots. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Systems 13 00390 g004aSystems 13 00390 g004b
Figure 5. SHAP summary plots of lagged intraday sentiment. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Figure 5. SHAP summary plots of lagged intraday sentiment. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Systems 13 00390 g005
Figure 6. SHAP summary plots of lagged post-market sentiment. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Figure 6. SHAP summary plots of lagged post-market sentiment. (a) 600519 (Kweichow Moutai); (b) 600900 (Yangtze Power); (c) 002475 (Luxshare); (d) 601899 (Zijin Mining).
Systems 13 00390 g006
Table 1. Characteristics of selected sample stocks.
Table 1. Characteristics of selected sample stocks.
Stock CodeStockSectorAvg Daily Volume (M RMB)Market Cap (B RMB)Volatility (%)
601398.SHICBCFinancials1255.92466.320.4
600519.SHKweichow MoutaiConsumer Staples3939.3 1914.4 30.8
601857.SHPetroChinaEnergy876.9 1636.2 28.2
002594.SZBYDConsumer Discretionary2471.3822.344.9
600900.SHYangtze PowerUtilities834.7723.019.7
601899.SHZijin MiningMaterials1605.6401.940.1
002475.SZLuxshareInformation Technology1700.2295.045.6
600276.SHHengrui PharmaceuticalsHealth Care1411.1292.834.8
601668.SHCSCECIndustrials1706.8249.733.0
000063.SZZTECommunication Services2311.0193.346.0
600048.SHPoly Development HoldingReal Estate1334.3106.140.4
Table 2. Representative investor comments from the Eastmoney Guba forum.
Table 2. Representative investor comments from the Eastmoney Guba forum.
TimestampTitleClicksComments
31 December 2024 9:51ZTE corporation rises rapidly on 31 December33521
31 December 2024 10:06High-position selling: the peak has arrived. Sell now or hold forever!1081
31 December 2024 13:10Fear nothing! Institutions keep buying.49211
31 December 2024 14:07Run! Run now!700
31 December 2024 14:35ZTE communications’ trading volume reaches 10 billion yuan.613449
31 December 2024 15:02ZTE’s resilience shines despite market weakness. Let’s fight harder in 2025!1500
31 December 2024 15:28Heartbreak is inevitable. Happy new year!3915116
31 December 2024 16:27Profits from ZTE offset losses in other stocks. Retail investors’ dilemma.1651
31 December 2024 17:57Hua Yang: ZTE’s valuation gap will narrow in 2025.501835
31 December 2024 23:36ZTE to release 2024 annual report on 1 March—auspicious timing!6701
Table 3. Performance comparison of ERNIE 3.0 and BERT with/without fine-tuning on sentiment classification.
Table 3. Performance comparison of ERNIE 3.0 and BERT with/without fine-tuning on sentiment classification.
ModelAccuracyPrecisionRecallF1 Score
ERNIE 3.00.3933330.4841950.3606790.304510
BERT0.3360000.316657 0.339257 0.283566
ERNIE 3.0 (after fine-tuning)0.7680000.768115 0.769589 0.768717
BERT (after fine-tuning)0.7280000.727891 0.730640 0.728357
Table 4. Comparison of model prediction performance.
Table 4. Comparison of model prediction performance.
ModelInput FeaturesMSEMAER2MAPERMSE
LSTMin-post0.000450.015990.917070.015930.02076
sent0.000660.01924 0.90234 0.01908 0.02453
tech0.000850.02175 0.88681 0.02152 0.02743
CNNin-post0.002430.030060.800580.030940.03791
sent0.004150.036220.716810.037940.04629
tech0.005130.045530.589040.046940.05671
CNN-LSTMin-post0.005560.046370.304920.043920.05573
sent0.008000.057860.058940.054540.06892
tech0.039770.12409−2.571730.107330.13654
two-layer LSTMin-post0.000810.020330.887300.020080.02617
sent0.001090.023070.857970.022690.02927
tech0.001700.028200.808920.027570.03556
Table 5. Best hyperparameters based on randomized search.
Table 5. Best hyperparameters based on randomized search.
StockDense UnitsDropout RateLSTM UnitsOptimizer
ICBC2770.11401382adam
Kweichow Moutai2750.2301269rmsprop
PetroChina3370.45157302adam
BYD1670.31861310rmsprop
Yangtze Power1220.18064338rmsprop
Zijin Mining1930.12471174adam
Luxshare1860.10585269rmsprop
Hengrui Pharmaceuticals3040.12604204adam
CSCEC2410.20211254adam
ZTE4940.16921186adam
Poly Development Holding2210.21072360adam
Table 6. SHAP feature importance distribution across sample stocks (top 5 technical indicators and sentiment features.
Table 6. SHAP feature importance distribution across sample stocks (top 5 technical indicators and sentiment features.
StockTechnical Indicators (Top 5, %)In Emo (%)After Emo (%)
ICBCClose (10.74), High (9.24), EMA5 (7.60), Low (6.75), MA30 (5.77)1.472.25
Kweichow MoutaiWILLR (12.74), MACD2 (9.28), CMO (6.86), MACD1 (6.83), High (4.63)6.6510.53
PetroChinaLow (13.72), Close (12.97), High (11.79), Open (9.43), EMA5 (9.07)2.562.18
BYDWILLR (11.32), MA60 (9.70), EMA60 (8.31), MA30 (7.72), EMA30 (6.53)1.750.99
Yangtze PowerEMA5 (6.61), ADOSC (6.48), MA60 (6.18), EMA60 (5.72), WILLR (5.57)5.525.73
Zijin MiningClose (16.01), Low (11.93), High (10.77), Open (7.45), WILLR (7.13)3.034.08
LuxshareWILLR (17.86), CMO (6.90), RSI (6.37), MACD1 (5.70), Low (5.44)2.765.3
Hengrui PharmaceuticalsWILLR (17.09), RSI (12.98), CMO (9.23), OBV (4.88), Close (4.72)2.692.57
CSCECClose (13.18), Low (11.23), WILLR (9.21), EMA5 (7.62), MA5 (7.30)1.041.44
ZTEClose (11.80), High (10.10), Low (9.60), Open (8.22), WILLR (7.93)0.692.25
Poly Development HoldingWILLR (13.74), MA60 (9.90), EMA30 (7.64), Low (7.28), Close (6.37)1.861.91
MeanWILLR (10.52), Close (8.17), Low (7.18), High (6.49), EMA5 (5.44)2.733.57
Table 7. Quantitative strategy log returns with different sentiment indicators.
Table 7. Quantitative strategy log returns with different sentiment indicators.
StockBaselineIn-Post SentimentAggregate SentimentNo Sentiment
ICBC0.377160.541680.515470.32938
Kweichow Moutai−0.030520.13909 0.01144 −0.10943
PetroChina0.164600.17033 0.13523 0.08414
BYD0.439510.533510.449580.38750
Yangtze Power0.168030.196080.187020.16921
Zijin Mining0.250340.426270.403420.30347
Luxshare0.450800.784620.665310.47797
Hengrui Pharmaceuticals0.125270.157940.151590.10923
CSCEC0.220920.278430.249130.19968
ZTE0.594440.667350.669000.49315
Poly Development Holding−0.075410.180820.127350.05258
Mean0.244100.370560.324050.22699
Table 8. Comprehensive risk exposure analysis of backtesting.
Table 8. Comprehensive risk exposure analysis of backtesting.
StockVaR (5%)BaseMax DrawdownBaseSharpe RatioBase
ICBC−0.01476−0.02357−0.06922−0.169843.027631.70338
Kweichow Moutai−0.02148 0.02472 0.19696 −0.318000.56525−0.15702
PetroChina−0.03775 0.02859 0.03775 −0.322681.519760.47267
BYD−0.02124−0.03550−0.12247−0.213692.166831.27106
Yangtze Power−0.01305−0.01708−0.06547−0.174671.228630.77033
Zijin Mining−0.02698−0.03748−0.17126−0.314101.664320.63031
Luxshare−0.03441−0.03498−0.15093−0.150932.254531.09609
Hengrui Pharmaceuticals−0.01670−0.03177−0.12364−0.264820.708300.32856
CSCEC−0.01430−0.02276−0.09530−0.176361.450660.73217
ZTE−0.00925−0.03437−0.06269−0.250492.941091.49026
Poly Development Holding−0.02386−0.03614−0.27291−0.358350.57832−0.21726
Mean−0.02036−0.02972−0.12442−0.246721.645940.73823
Table 9. Transaction cost threshold analysis via sensitivity testing.
Table 9. Transaction cost threshold analysis via sensitivity testing.
Cost0.0010.00110.00120.00130.00140.00150.00160.00170.00180.00190.0020.0030.0040.005
ROI0.3700.3690.3610.3560.3500.3280.3270.3240.3190.3160.3100.2950.2550.210
VaR−0.018 0.018 0.018 −0.018−0.018−0.018−0.018−0.018−0.018−0.018−0.018−0.017−0.017−0.017
Sharpe1.6421.6371.6161.5901.5691.4641.4601.4431.4161.4021.3661.3111.1370.972
MaxDrawdown−0.126−0.127−0.125−0.126−0.127−0.128−0.129−0.129−0.130−0.130−0.131−0.137−0.135−0.136
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Sun, G.; Li, Y. Intraday and Post-Market Investor Sentiment for Stock Price Prediction: A Deep Learning Framework with Explainability and Quantitative Trading Strategy. Systems 2025, 13, 390. https://doi.org/10.3390/systems13050390

AMA Style

Sun G, Li Y. Intraday and Post-Market Investor Sentiment for Stock Price Prediction: A Deep Learning Framework with Explainability and Quantitative Trading Strategy. Systems. 2025; 13(5):390. https://doi.org/10.3390/systems13050390

Chicago/Turabian Style

Sun, Guowei, and Yong Li. 2025. "Intraday and Post-Market Investor Sentiment for Stock Price Prediction: A Deep Learning Framework with Explainability and Quantitative Trading Strategy" Systems 13, no. 5: 390. https://doi.org/10.3390/systems13050390

APA Style

Sun, G., & Li, Y. (2025). Intraday and Post-Market Investor Sentiment for Stock Price Prediction: A Deep Learning Framework with Explainability and Quantitative Trading Strategy. Systems, 13(5), 390. https://doi.org/10.3390/systems13050390

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop