QR-DQN Stat-Pair Trading Agent (r6 Production)
Quantile Regression DQN (51-quantile) for statistical pair trading.
Best model from 13 rounds of iterative experiments.
Model
| Parameter |
Value |
| Algorithm |
QR-DQN (Dabney et al. 2018) |
| State Dim |
28 |
| Actions |
3 (EXIT, HOLD, ENTER) |
| Quantiles |
51 |
| Hidden |
256 |
| Best Eval |
+5.857 |
| Envs |
~44 high-quality pairs |
28-dim State Space
- Base (15): z_score, velocity, acceleration, halflife, correlation, spread_vol, position, days_held, pnl, entry_z, z_distance, z_percentile, momentum, vol_ratio, pnl_velocity
- Extended (7): halflife_change, z_trend, corr_zscore, corr_instability, adf_norm, z_reversal, kurtosis
- Regime (3): SPY HMM bear/sideways/bull
- Macro (3): vix_z, spy_vol, yield_curve
Ensemble Backtest (275 days OOS)
| Sharpe |
Return |
MDD |
Win Rate |
| 1.97 |
+20.80% |
4.93% |
56.1% |
Usage
from app.trading.rl.agents.qr_dqn import QRDQNAgent
agent = QRDQNAgent.load("production.pt").eval_mode()
action = agent.act(state, deterministic=True)
cvar = agent.cvar(state, action_env=1, alpha=0.05)