Reinforcement Learning Pair Trading: A Dynamic Scaling approach

—

Reinforcement Learning Pair Trading: A Dynamic Scaling approach

Hongshen Yang
Avinash Malik
Published on 7/23/2024
Crypto
FX
Reinforcement learning
Pairs trading
Machine learning

This paper investigates the application of Reinforcement Learning (RL) to enhance pair trading in cryptocurrency markets, which are characterized by extreme volatility. The authors construct a custom RL environment that allows agents to make dynamic decisions on both trade timing and investment quantity, moving beyond traditional static rule-based approaches. The methodology involves pair formation using correlation and cointegration tests, spread calculation with moving windows, and hyperparameter optimization via grid search. RL agents are trained using actor-critic algorithms (DQN, SAC, A2C, PPO) with a novel reward shaping mechanism that encourages profitable actions while penalizing excessive transactions.

Experiments on 1-minute BTC-GBP and BTC-EUR data (263,520 samples) show that RL-based pair trading significantly outperforms the traditional benchmark. The traditional method yields an annualized profit of 8.33%, while RL agents achieve profits from 9.94% to 31.53%, with the best performance from algorithms allowing continuous action spaces. The dynamic scaling approach, where agents adjust investment amounts based on opportunity quality, is a key innovation that captures more profit in volatile markets. The results demonstrate that RL can effectively adapt to changing market conditions and improve profitability in high-frequency pair trading.

The study's significance lies in its practical contribution to algorithmic trading, showing that RL can automate and enhance decision-making in complex financial environments. The proposed framework offers flexibility in investment sizing and timing, which is crucial for volatile assets like cryptocurrencies. Future work could explore multi-asset pairs, transaction cost sensitivity, and real-time deployment.

Highlights

  • 1Constructs a tailored RL environment for quantity-varying pair trading in cryptocurrency markets.
  • 2Proposes a novel RL-based pair trading method with adaptive investment quantities to capture volatile market opportunities.
  • 3Achieves annualized profits from 9.94% to 31.53% using RL agents, outperforming the traditional pair trading benchmark of 8.33%.
  • 4Introduces a grid search technique for hyperparameter tuning and a reward shaping mechanism to encourage profitable decisions.
  • 5Demonstrates that RL can significantly enhance decision-making in high-frequency pair trading compared to static rule-based strategies.

Methods

  • M
    Reinforcement Learning (RL) with actor-critic algorithms (DQN, SAC, A2C, PPO) for trading decisions.
  • M
    Dynamic scaling approach: RL agents decide both timing and investment quantity (continuous action space in [-1,1]).
  • M
    Pair formation using Pearson correlation and Engle-Granger cointegration test with moving windows.
  • M
    Grid search for optimal parameters (window size, open/close thresholds) and reward shaping with portfolio, action, and transaction components.

Results

  • R
    Traditional pair trading achieved an annualized profit of 8.33% on BTC-GBP and BTC-EUR 1-minute data (n=263,520).
  • R
    RL-based pair trading achieved annualized profits ranging from 9.94% to 31.53% depending on the RL algorithm.
  • R
    RL agents outperformed static rule-based strategies by adapting to market volatility and varying investment amounts.
  • R
    The dynamic scaling approach (RL2) with continuous action space yielded higher profits than discrete action RL1.
  • R
    Grid search identified optimal hyperparameters (window size, thresholds) that improved profitability for both traditional and RL methods.
0/5

Analyze Paper

Generate insights from "Reinforcement Learning Pair Trading: A Dynamic Scaling appro...".

Suggested Actions