Transformer for Times Series: an Application to the S&P500
Pierre Brugiere, Gabriel Turinici
TL;DR
This work extends Transformer encoder architectures to financial time series by embedding univariate observations and employing a classification objective over discretized future values. It demonstrates that the encoder can learn conditional distributions in a synthetic Ornstein–Uhlenbeck setting and extract volatility-related signals from real S&P 500 data, with meaningful improvements in predicting next-day quadratic variation over naive baselines. Key findings include near-best performance on OU data (approximate bucket accuracy of ~32%) and modest but promising volatility predictions on real data, while direct next-return prediction remains challenging in the baseline setup. The results suggest practical potential for transformer-based time-series modeling in finance, particularly for volatility and risk assessment tasks, and point to avenues for embedding refinements and architectural tuning to boost predictive power.
Abstract
The transformer models have been extensively used with good results in a wide area of machine learning applications including Large Language Models and image generation. Here, we inquire on the applicability of this approach to financial time series. We first describe the dataset construction for two prototypical situations: a mean reverting synthetic Ornstein-Uhlenbeck process on one hand and real S&P500 data on the other hand. Then, we present in detail the proposed Transformer architecture and finally we discuss some encouraging results. For the synthetic data we predict rather accurately the next move, and for the S&P500 we get some interesting results related to quadratic variation and volatility prediction.
