TL;DR
TCGPN is a novel pre-training framework for stock forecasting that effectively integrates temporal patterns with inter-stock correlations. By utilizing a node-independent architecture and dual self/semi-supervised pre-training tasks, it overcomes the memory bottlenecks and poor generalization to non-periodic data that typically limit traditional spatio-temporal models.
What Problem Does This Paper Address?
Predicting stock prices is a classic "hard" problem because financial time series lack the clear periodicity found in domains like traffic or weather. While Spatio-Temporal Graph Neural Networks (STGNNs) have shown promise by modeling both time and the relationships between entities (e.g., stocks in the same industry), they face two major hurdles:
- Lack of Robustness: Most STGNNs struggle with the non-stationary, non-periodic nature of stock data.
- Scalability: The computational cost of these models often scales quadratically with the number of nodes (stocks), making it difficult to model large market indices.
The authors illustrate this challenge in Figure 1, showing how unrelated stocks can share trends by chance, while related stocks might exhibit similar patterns with a time lag.
Methods
The core of the paper is the Temporal-Correlation Graph Pre-trained Network (TCGPN). Its architecture is designed to be "node-free," meaning it doesn't depend on a fixed number or specific ordering of stocks.
Key Components:
- Data Augmentation: To improve robustness, the model uses node random sampling, graph random masks (hiding parts of the stock relationship graph), and temporal random masks (hiding continuous blocks of time series data).
- TCFEncoder (Temporal-Correlation Fusion Encoder): This module first uses a Graph Attention Network (GAT) to adaptively learn relationships between stocks. It then passes these features through a TGMformer—a Transformer variant that uses a temporal Gaussian mask to respect the "arrow of time" and model the natural decay of historical influence.
- Pre-training Tasks: The model is trained on two tasks simultaneously:
- Temporal Self-Supervised Task: Recovering masked time steps from their context and the behavior of correlated stocks.
- Correlation Semi-Supervised Task: Recovering masked edges in the adjacency matrix to learn more effective relational linkages.
Datasets
The authors evaluated TCGPN on two major real-world stock market datasets from China:
- CSI300: Daily data for the top 300 companies on the Shanghai and Shenzhen exchanges.
- CSI500: Daily data for 500 small-to-medium-sized companies. Both datasets cover a 12-year span (2010–2022) and include 45 features per stock at each time step.
Key Insights and Ideas
- Node-Independence is a Game Changer: By making the model invariant to node order and quantity, the authors can train on random subsets of stocks. This not only allows for massive data augmentation but also drastically reduces memory overhead, enabling the model to handle large-scale datasets that would crash standard STGNNs.
- Correlation vs. Time: The ablation study (Figure 3) reveals that removing the Graph Attention (GAT) component or the correlation pre-training task leads to a more significant performance drop than removing the temporal task alone. This suggests that in stock forecasting, learning how stocks relate to each other is at least as important as learning their individual historical patterns.
- Gaussian Masking for Finance: Unlike standard Transformers, the TGMformer uses a Gaussian mask to emphasize recent history. This effectively models the "time decay" effect, where recent events are more predictive of the immediate future than distant ones.
Key Results
TCGPN achieved state-of-the-art (SOTA) performance across nearly all metrics on both datasets.
- Superior Accuracy: On the CSI300 dataset with an industry-based graph, TCGPN achieved an Information Coefficient (IC) of 0.10548, significantly higher than the best baseline (ASTGCN at 0.08142).
- Better Risk-Adjusted Returns: The model reached a Sharpe Ratio of 9.5298 on the CSI500 dataset, nearly tripling the performance of some traditional STGNN baselines.
- Efficiency: Even when fine-tuning only a simple MLP on top of the frozen pre-trained representations, TCGPN outperformed end-to-end trained complex models, proving the richness of its learned embeddings.
Limitations and Future Work
The authors note that while their method is robust, the initial graphs used (based on industry or Euclidean distance) are often incomplete or biased. They suggest that future work could focus on:
- Developing even more sophisticated pre-training tasks to uncover hidden relational structures.
- Applying the TCGPN framework to a wider variety of spatio-temporal tasks beyond the stock market, such as traffic flow or energy consumption forecasting.
Summary updated