EarnHFT: Efficient Hierarchical Reinforcement Learning for High Frequency Trading

Molei Qin, Shuo Sun, Wentao Zhang, Haochong Xia, Xinrun Wang, Bo An

Abstract

High-frequency trading (HFT) in cryptocurrency markets presents significant challenges due to long decision horizons and non-stationary market dynamics. We present EarnHFT, a novel three-stage hierarchical reinforcement learning framework. EarnHFT utilizes a "Q-teacher" for efficient training via hindsight, maintains a diverse pool of specialized agents for various market regimes, and employs a dynamic router to select the optimal specialist in real-time. Experimental results on Binance cryptocurrency datasets demonstrate that EarnHFT significantly outperforms state-of-the-art baselines in both profitability and risk-adjusted returns.

Introduction

Reinforcement Learning (RL) has demonstrated success in low-frequency trading, but High-Frequency Trading (HFT) introduces two primary obstacles: the Horizon Problem and the Non-Stationarity Problem. HFT involves millions of second-level decision steps, making it difficult for standard RL agents to converge. Furthermore, financial markets are non-stationary; strategies optimized for a "Bull" market often fail during a "Bear" market. Existing methods typically rely on a single agent, which often fails to adapt to shifting market regimes.

The EarnHFT Framework

To address these challenges, EarnHFT decomposes the trading problem into three distinct stages:

  1. Stage I: Efficient RL with Q-Teacher: To overcome data inefficiency, the framework uses dynamic programming and hindsight (future price information) to calculate optimal action-values. This "Q-teacher" provides a KL divergence loss that guides the RL agent, bypassing the extensive exploration phase usually required.
  2. Stage II: Diverse Agent Pool: Rather than training a single generalist, EarnHFT trains hundreds of specialized agents. By using sampling methods based on "return rate preferences," the system develops experts for various scenarios (e.g., sideways, volatile). Dynamic Time Warping (DTW) is then used to categorize trends and select the most profitable specialists for the final strategy pool.
  3. Stage III: Dynamic Routing: A high-level "router" operates at a minute-level timescale. Its role is to analyze macro-market conditions and select the best specialist from the pool to execute second-by-second trades for the following minute.
Overview of the EarnHFT framework, illustrating the three stages: Efficient Training with Q-Teacher, Diverse Strategy Pool generation, and Dynamic Routing Optimization.

Experimental Setup

The framework was evaluated using high-fidelity cryptocurrency datasets from Binance, representing diverse market dynamics:

  • BTC/TUSD & BTC/USDT: Sideways markets.
  • ETH/USDT: Bear market.
  • GALA/USDT: Bull market.

The datasets include both Limit Order Book (LOB) micro-structure data and OHLC price data.

Results and Discussion

EarnHFT was compared against six baselines, including popular RL algorithms (PPO, DQN) and traditional technical indicators (MACD).

  • Profitability: EarnHFT achieved the highest Total Return (TR) across all datasets. Notably, in the GALA/USDT bull market, it reached a 19.41% return, significantly outperforming all competitors.
  • Risk-Adjusted Return: The framework consistently achieved superior Sharpe Ratios (SR), indicating higher returns relative to the risks taken.
  • Training Efficiency: Ablation studies showed that the "Q-teacher" allowed the model to converge in as little as 15% of the steps required by standard DDQN.
Cumulative total return of the EarnHFT Router compared to specialized agents across four cryptocurrency datasets (BTCT, BTCU, ETH, GALA).

As shown in the performance plots, the dynamic router effectively navigates different market conditions by switching between specialized strategies, consistently outperforming individual specialists in the pool.

Conclusion

EarnHFT demonstrates that hierarchical time-scales and hindsight-based supervision can significantly improve RL performance in HFT. While the current model is a "radical trader" that may prioritize profit over risk in specific sub-segments, it sets a new benchmark for profitability in crypto HFT. Future work will focus on extending this framework to multi-asset portfolio management and further refining execution models to account for real-world latency and slippage.

Summary updated

BibTeX
@inproceedings{qin2024earnhft,
  author = {Molei Qin and Shuo Sun and Wentao Zhang and Haochong Xia and Xinrun Wang and Bo An},
  title = {{EarnHFT: Efficient Hierarchical Reinforcement Learning for High Frequency Trading}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i13.29384},
}
Figure