Temporal Representation Learning for Stock Similarities and Its Applications in Investment Management

Yoontae Hwang, Stefan Zohren, Yongjae LeearXiv 2024

Abstract

In the era of rapid globalization and digitalization, accurate identification of similar stocks has become increasingly challenging due to the non-stationary nature of financial markets and the ambiguity in conventional regional and sector classifications. To address these challenges, we examine SimStock, a novel temporal self-supervised learning framework that combines techniques from self-supervised learning (SSL) and temporal domain generalization to learn robust and informative representations of financial time series data. The primary focus of our study is to understand the similarities between stocks from a broader perspective, considering the complex dynamics of the global financial landscape. We conduct extensive experiments on four real-world datasets with thousands of stocks and demonstrate the effectiveness of SimStock in finding similar stocks, outperforming existing methods. The practical utility of SimStock is showcased through its application to various investment strategies, such as pairs trading, index tracking, and portfolio optimization, where it leads to superior performance compared to conventional methods. Our findings empirically examine the potential of data-driven approach to enhance investment decision-making and risk management practices by leveraging the power of temporal self-supervised learning in the face of the ever-changing global financial landscape.

Introduction

Identifying similar stocks is a fundamental task in investment management, underpinning strategies like pairs trading, index tracking, and portfolio diversification. Traditionally, stocks are grouped by industry sectors or market capitalization. However, in a globalized and digital economy, these static classifications often fail to capture the dynamic and complex relationships between assets. For instance, a technology company's market behavior might align more closely with a healthcare provider than with other hardware manufacturers.

Furthermore, financial markets are characterized by non-stationarity, often referred to as "concept drift." The statistical properties and relationships between stocks evolve over time, rendering stationary similarity measures obsolete. To address these challenges, we present SimStock, a novel self-supervised learning (SSL) framework designed to learn robust, time-aware representations of financial assets.

Methodology

SimStock bridges the gap between SSL and Temporal Domain Generalization (TDG) to create embeddings that are both informative and resilient to market shifts. The framework processes temporal feature variants—such as multiple moving averages (5 to 30 days)—to capture multi-scale dynamics rather than relying on raw price data alone.

The SimStock framework architecture, illustrating the integration of feature tokenization, dimension corruption for self-supervised learning, and temporal domain generalization.

Framework Architecture

As illustrated in the figure above, the architecture consists of several key modules:

  1. Feature Tokenizer: This module transforms input features into high-dimensional tokens, enhancing the model's ability to learn from tabular financial data.
  2. Dimension Corruption: A novel data augmentation strategy specifically designed for financial time series. By shuffling data across time, asset, and feature dimensions, the model generates "positive" (low perturbation) and "negative" (high perturbation) views. These views are processed through a shared-weight representation layer and optimized using a triplet loss.
  3. Temporal Domain Generalization (TDG): To proactively adapt to market shifts, SimStock utilizes an LSTM-based approach to predict the evolution of model parameters. This allows the model to generalize across different temporal domains (e.g., from period $s$ to $s+1$).

Datasets

The framework was evaluated using massive real-world datasets from five major global exchanges: NYSE and NASDAQ (US), SSE and SZSE (China), and TSE (Japan). The data, spanning from January 2018 to December 2023, includes over 11,000 stocks, providing a rigorous testing ground for cross-border and cross-sector similarity detection.

Key Results

SimStock demonstrates significant improvements over state-of-the-art time-series models like TS2VEC across several financial benchmarks.

  • Superior Similarity Detection: In "same exchange" scenarios, SimStock achieved a correlation of approximately 0.8 for top-ranked similar stocks, significantly higher than the 0.6 achieved by baseline methods.
  • Profitable Pairs Trading: In practical applications, SimStock-selected pairs yielded higher average terminal wealth and lower Maximum Drawdown (MDD) across 12 major query stocks, indicating superior risk-adjusted performance.
  • Thematic Index Tracking: The model excelled at tracking complex thematic ETFs (e.g., ARKK, SKYY). Portfolios constructed using SimStock embeddings followed target trajectories more closely than those based on standard correlation or other SSL methods.
  • Portfolio Optimization: SimStock-based covariance matrices produced more efficient frontiers, consistently outperforming historical covariance and the Gerber statistic.

Discussion and Conclusion

The success of SimStock highlights the importance of accounting for temporal non-stationarity in financial modeling. By leveraging "dimension corruption," the model preserves the essence of a stock's behavior while remaining robust to noise. The integration of TDG allows the model to proactively model the trajectory of changing relationships rather than just static snapshots, enabling better adaptation to market volatility.

Future research directions include incorporating unstructured data—such as news and financial statements via Large Language Models (LLMs)—to deepen the semantic understanding of stock similarities. Additionally, exploring the stability of these embedding spaces across different market regimes remains a key area for investigation. In conclusion, SimStock offers a powerful, data-driven approach to modern investment decision-making and risk management in an ever-changing global landscape.

Summary updated

BibTeX
@misc{hwang2024temporal,
  author = {Yoontae Hwang and Stefan Zohren and Yongjae Lee},
  title = {{Temporal Representation Learning for Stock Similarities and Its Applications in Investment Management}},
  year = {2024},
  eprint = {2407.13751},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.13751},
}
Figure