hedge-gym
Option hedging on 21-day market worlds, synthetic or real. This is the environment behind "Trained only in synthetic markets, better on the real 2020 and 2022 crashes": a Qwen3-1.7B trained with RL on synthetic worlds only (3,840 episodes, prime-rl, LoRA) cut its hedging error on the real 2020 crash from 0.0352 to 0.0173 and on the real 2022 crash from 0.0281 to 0.0144, paired block-bootstrap CIs excluding zero on both, pass rule committed before any score existed. Every trace, config and script: https://github.com/giack-hack/synthetic-markets-transfer
The game
One episode is one 21-day price path, rebased to 100, no date, no ticker, no news. You sold one
at-the-money call and were paid a fair premium. Each day you reply [HEDGE 0.00-1.00], the share of the
underlying to hold. Changing the hedge costs 5 bps of the traded value.
Reward = -( |option payoff - premium - hedging P&L| / strike + costs ). Zero is a perfect replication.
Deterministic scoring, no judge.
Run it
prime env install sablier/hedge-gym
uv run vf-eval hedge-gym -n 20 -m <model> # synthetic held-out worlds
uv run vf-eval hedge-gym -m <model> --env.taskset.bank exam_2020_overlap # real 2020, all 188 windows
uv run vf-eval hedge-gym -m <model> --env.taskset.bank exam_2022_overlap # real 2022, all 184 windows
Add --env.agent.runtime.type subprocess to run locally without a sandbox. Reward per episode is
hedge_score; invalid_replies counts turns with no valid action (one retry, then the previous hedge stays).
Reference players on the real windows (mean loss, lower is better, 2020 / 2022): never hedges 0.0388 / 0.0293, constant 50% hedge 0.0203 / 0.0149, textbook delta hedge 0.0120 / 0.0091, untrained Qwen3-1.7B 0.0352 / 0.0281, the same model after synthetic-only training 0.0173 / 0.0144.
Banks in this package
era2019_flow_heldout: 400 synthetic worlds, 100 for each of four US ETFs (large caps, tech, small caps, long bonds), generated by Sablier's market generator fitted on data up to 2019-12-31 and volatility-matched to each asset's 2003-2019 history. Held out from training.exam_2020_overlap,exam_2022_overlap: every real 21-day window of 2020 and 2022 on a 5-day grid, same four ETFs.
The 14,000-path training bank (3,500 worlds per asset) and the trained adapters are available on request:
team@sablier.ai. Point HEDGE_GYM_BANKS at a folder to use them.
Who
Sablier (sablier.ai) generates synthetic market data. Code under MIT (LICENSE); the synthetic worlds are
for research and reproduction only (DATA_LICENSE.md).