Abstract
Can deep reinforcement learning algorithms be exploited as solvers for optimal trading strategies? The aim of this work is to test reinforcement learning algorithms on conceptually simple, but mathematically non-trivial, trading environments. The environments are chosen such that an optimal or close-to-optimal trading strategy is known. We study the deep deterministic policy gradient algorithm and show that such a reinforcement learning agent can successfully recover the essential features of the optimal trading strategies and achieve close-to-optimal rewards.
Introduction
While deep reinforcement learning (dRL) has seen a surge of interest in finance, it faces a "reproducibility crisis" and a lack of rigorous benchmarking. Most studies compare dRL agents against simple, sub-optimal baselines (like a "buy and hold" strategy). This makes it difficult to tell if the agent is truly finding an efficient solution or just getting lucky.
This paper investigates whether dRL can "rediscover" mathematically optimal trading strategies in controlled financial environments. By testing the Deep Deterministic Policy Gradient (DDPG) algorithm against three classic stochastic control problems, the authors demonstrate that dRL agents can successfully recover complex features like no-trading bands and risk-adjusted positioning, even in the presence of significant noise.
Problem Statement
The authors address the gap in benchmarking by creating "ground truth" environments where the optimal trading strategy is already known through classical stochastic control theory. The central question is: Can a model-free dRL agent, starting with no knowledge of the underlying physics of the market, learn to trade as well as a perfect mathematical formula?
Methodology
The researchers utilized the Deep Deterministic Policy Gradient (DDPG) algorithm, an actor-critic framework designed for continuous action spaces. This is essential for trading, where position sizes are continuous variables.
Key technical additions included:
- Prioritized Experience Replay (PER): The agent focuses on "surprising" events where its predictions were most off-mark, rather than learning from random past experiences.
- Tanh Smooth Penalty Barrier: To handle the "maxpos" constraint (a hard limit on the maximum position size), which is normally non-differentiable and "breaks" gradient-based learning, the authors introduced a smooth, differentiable penalty function to guide the agent back to safety.
- State Representation: The agent's state was defined by its current portfolio weight and a "predictor" variable following an autoregressive (AR) process.
Experimental Setup
The study uses synthetic datasets generated from autoregressive processes. Synthetic data allows for:
- Comparison against an exact optimal strategy.
- Control of the noise-to-signal ratio (testing ratios as high as 10:1).
- Statistical significance through thousands of simulated "episodes."
Results and Insights
The authors observed that agents tend to learn in stages: first following the signal ("alpha"), then minimizing trading costs, and finally fine-tuning risk control. PnL (Profit and Loss) often reached optimality faster than the total reward.
Key findings include:
- Emergent No-Trading Zones: In environments with proportional costs, the DDPG agent successfully learned "no-trading bands"—doing nothing unless the signal is very strong—without being explicitly programmed to do so.
- Near-Optimal Performance: In the simplest environment (Quadratic Cost/Risk), the best dRL agents achieved rewards within ~0.5% of the theoretical maximum.
- Structural Recovery: Visualizations of the learned policies show a high degree of qualitative agreement with the theoretical solutions, successfully capturing the slopes and thresholds of the optimal controllers.
- Robustness to Noise: Even with high noise-to-signal ratios, agents recovered the essential features of the optimal strategy, albeit with higher variance across training runs.
Discussion and Conclusion
The success of the "maxpos" environment relied heavily on fine-tuning the penalty function. Standard dRL often fails on hard constraints; without the "tanh barrier" trick, half of the agents diverged.
Future work should explore model-based approaches, which might be more efficient by exploiting known cost and risk functions. Additionally, while this study focused on single-asset cases, scaling to high-dimensional portfolios with complex asset correlations remains a key challenge for future research.
Summary updated