← All projects

2025

Synthetic Limit Order Book Generation using TimeGAN

Generated synthetic limit order book sequences using TimeGAN and evaluated statistical and temporal realism of high-frequency market simulations.

Evaluated Chart

Category: Finance, Generative-models, Time-series

Overview

Built a deep learning pipeline to generate synthetic Limit Order Book (LOB) sequences using TimeGAN, aiming to reproduce realistic statistical and temporal patterns of high-frequency financial market data for simulation and analysis.

Project overview

Synthetic Limit Order Book Generation using TimeGAN overview

What I Built

  • Developed a preprocessing pipeline to convert raw high-frequency LOB snapshots into sequential model-ready training data
  • Engineered 43 standardized LOB features from LOBSTER AMZN Level-10 data, including relative prices, log-transformed volumes, spread, mid-price return, and imbalance
  • Implemented a full TimeGAN architecture with Embedder, Recovery, Supervisor, Generator, and Discriminator modules using GRU-based recurrent networks
  • Trained the model in two phases: supervised reconstruction / latent transition learning followed by adversarial refinement
  • Performed hyperparameter tuning with Optuna across 20 trials to identify more stable configurations
  • Experimented with an enhanced variant using empirical latent sampling, AR(1) latent correlations, stronger regularization, and extended training
  • Evaluated synthetic data quality using KL divergence, SSIM, AR(1) temporal gap, latent divergence, and representative heatmap comparisons

Tech Stack

Python, PyTorch, NumPy, Pandas, Matplotlib, Optuna

Outcome

The project successfully produced a working TimeGAN pipeline for synthetic LOB generation and improved training stability through tuning and enhanced latent modeling. However, the final models did not meet the target realism thresholds: KL divergence and SSIM remained well outside target ranges, and the generated depth maps were still overly smooth compared with real market data. The project highlighted both the feasibility and the practical difficulty of applying GAN-based sequence generation to high-frequency financial microstructure data.

Links