Optimal Execution with Reinforcement Learning

—

Optimal Execution with Reinforcement Learning

Yadh Hafsi
Edoardo Vittori
Published on 11/10/2024
Equities
Futures
Reinforcement learning
High frequency trading
Machine learning
Risk management

This paper presents a reinforcement learning approach for optimal execution of large orders in financial markets, using the multi-agent market simulator ABIDES to generate realistic limit order book dynamics and endogenous market impact. The authors formulate the problem as a Markov Decision Process (MDP) with state features including percentage holdings remaining, percentage time remaining, volume imbalance up to five levels, and best bid/ask prices. The action space consists of five discrete actions: do nothing or consume a multiple of a minimum quantity. The reward function combines implementation shortfall, a penalty for depth consumed, and a terminal penalty for incomplete execution. The DQN algorithm is employed with a neural network architecture of two hidden layers (50 and 20 neurons), a linear learning rate decay from 1e-3 to 0 over 90,000 steps, and epsilon-greedy exploration decaying from 1 to 0.02 over 10,000 steps.

The experimental results demonstrate that the RL agent consistently outperforms standard benchmark strategies—TWAP, random, and passive—across multiple market configurations. The RL agent achieves a mean implementation shortfall close to zero with low variance, indicating consistent execution near the arrival price with minimal market impact. Analysis of the execution trajectory reveals a front-loaded pattern: the agent executes a significant portion of the order early, then tapers off, balancing immediate impact and long-term price stability. The agent also maintains tight spreads and balanced volume imbalance, suggesting it trades when liquidity is high and avoids disrupting the order book. Robustness tests with varying numbers of noise agents (10, 1000, 2000) and momentum agents (6, 12, 24) confirm that the RL strategy maintains its advantage, with statistical significance in most cases. The study provides a practical foundation for real-world trading applications, bridging the gap between strategic trade scheduling and tactical order placement.

Highlights

  • 1Proposes a reinforcement learning framework for optimal execution that unifies strategic scheduling and tactical decision-making within a single MDP.
  • 2Uses the multi-agent market simulator ABIDES to generate realistic limit order book dynamics and endogenous market impact.
  • 3Demonstrates that a DQN agent consistently outperforms TWAP, random, and passive baselines in terms of implementation shortfall and variance.
  • 4Shows robustness of the RL strategy across varying numbers of noise agents and momentum agents in the simulation.
  • 5Provides detailed analysis of the learned execution trajectory, revealing front-loaded trading with tight spreads and balanced order book.

Methods

  • M
    Deep Q-Network (DQN) with experience replay and epsilon-greedy exploration.
  • M
    Custom MDP formulation with state features including percentage holdings remaining, percentage time remaining, volume imbalance up to 5 levels, best bid and ask prices.
  • M
    Multi-agent market simulation using ABIDES with RMSC-4 configuration, including noise, value, market maker, and momentum agents.
  • M
    Reward function combining implementation shortfall, depth penalty, and terminal penalty for incomplete execution.

Results

  • R
    The RL agent achieves a mean implementation shortfall close to zero (0.0002) with low variance (0.0011), outperforming TWAP (-0.0321), passive (-0.0106), and random (-0.016) strategies.
  • R
    The RL agent executes with tight spreads and maintains balanced volume imbalance, indicating minimal market impact.
  • R
    Statistical tests (one-sided t-tests) confirm RL significantly outperforms baselines under various market configurations (e.g., 10, 1000, 2000 noise agents; 6, 12, 24 momentum agents).
  • R
    The learned execution trajectory is front-loaded: a large portion executed early, followed by a steady pace, aligning with optimal execution principles.
  • R
    The RL agent completes execution on average in 63% of the time window, compared to 99.8% for TWAP.
0/5

Analyze Paper

Generate insights from "Optimal Execution with Reinforcement Learning".

Suggested Actions