Model-based Reinforcement Learning for Predictions and Control for Limit Order Books

Haoran Wei, Yuanbo Wang, Lidia Mangu, Keith DeckerarXiv 2019

Introduction

Training Reinforcement Learning (RL) agents for high-frequency trading (HFT) presents a unique set of challenges. Standard "model-free" RL requires millions of interactions with an environment to learn, which in the real world is prohibitively expensive and risky—a single bad exploratory move can lead to massive monetary loss. This paper introduces a "World Model" approach, creating a robust, data-driven simulator that allows agents to learn effective trading strategies safely and efficiently by capturing complex market dynamics from historical data.

The Challenge of High-Frequency Trading

Limit Order Book (LOB) data is high-dimensional, noisy, and non-stationary. Most existing simulators rely on hand-crafted rules or simple linear models that fail to capture "market impact"—the phenomenon where an agent's own trades actually change the market price.

A visualization of bid and ask levels in a Limit Order Book, showing price and size across different levels.

To address this, the authors propose a framework that learns the causal relationships between actions and market movements directly from data, enabling safer exploration in a simulated environment before real-world deployment.

Methodology: The World Model Framework

The proposed architecture consists of two main components: the World Model (the simulator) and the Agent Model (the trader).

The World Model

  1. Latent Representation (Auto-encoder): To handle the high dimensionality of LOB data, a CNN-based auto-encoder compresses the market state into a compact 16-dimensional "latent" vector. This process filters out noise while retaining essential temporal and causal structures.
  2. Transition Model (RNN-MDN): This core component uses a Recurrent Neural Network (RNN) combined with a Mixture Density Network (MDN). Instead of predicting a single "next state," it predicts a probability distribution (a mixture of Gaussians), allowing the model to account for the inherent stochasticity and uncertainty of the market.
  3. Reward Model: A regression model predicts potential Profit and Loss (PnL) based on predicted changes in the stock's mid-price.
The modular architecture of the system: (a) the CNN auto-encoder for state compression, (b) the RNN-MDN sequence for predicting future states, and (c) the integrated RL training loop.

The Agent Model

The authors evaluated three RL architectures within this simulator: Double DQN (value-based), Policy Gradient (policy-based), and Advantage Actor-Critic (A2C). A2C emerged as the most stable hybrid approach for this high-frequency environment.

Data and Training

The study utilized high-frequency LOB and trade print data from the Hong Kong Stock Exchange (HKEX). The dataset spanned from January to April 2018, encompassing approximately 8 million transitions. With an update frequency of roughly 0.17 seconds, the data represents a true high-frequency environment where rapid decision-making is critical.

Key Results and Insights

The research yielded several significant findings regarding the efficacy of model-based RL in finance:

  • Sim-to-Real Transfer: One of the most significant findings is that a policy trained exclusively inside the neural simulator maintains its profitability when transferred back to real historical market data.
  • Outperformance: RL agents (specifically PG and A2C) consistently outperformed momentum-driven and classifier-based benchmarks by 10% to 30% in terms of cumulative reward.
  • Nuanced Strategies: Traditional trading ML often uses classifiers (predicting "up," "down," or "neutral"), which are frequently biased toward the "no change" class. In contrast, the RL approach learned more nuanced strategies, successfully identifying local peaks to sell and local valleys to buy.

Conclusion and Future Work

By leveraging latent space representations and Mixture Density Networks, this model-based RL framework provides a safer and more realistic environment for developing trading strategies. While the model currently struggles in oscillating market regimes due to data imbalance, it represents a significant step toward robust, data-driven financial simulators. Future work will focus on generalizing the model across different assets and incorporating more rigorous modeling of real-world factors like variable slippage and system latency.

Summary updated

BibTeX
@misc{wei2019model,
  author = {Haoran Wei and Yuanbo Wang and Lidia Mangu and Keith Decker},
  title = {{Model-based Reinforcement Learning for Predictions and Control for Limit Order Books}},
  year = {2019},
  eprint = {1910.03743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.03743},
}
Figure