{"data":{"kind":"file","path":"README.md","version_id":"rpiuiqrhtfj2c7s7nrrvaprk","entry":{"name":"README.md","path":"README.md","is_directory":false,"size":2636,"modified_at":"2026-10-14T04:22:30.917000","content_hash":"645485773b6e4b2bc76da662c9de5cfcde8e3771740fdced548907a693c66e71"},"entries":[],"content":"# hedge-gym\n\nOption hedging on 21-day market worlds, synthetic or real. This is the environment behind\n\"Trained only in synthetic markets, better on the real 2020 and 2022 crashes\": a Qwen3-1.7B trained\nwith RL on synthetic worlds only (3,840 episodes, prime-rl, LoRA) cut its hedging error on the real\n2020 crash from 0.0352 to 0.0173 and on the real 2022 crash from 0.0281 to 0.0144, paired block-bootstrap\nCIs excluding zero on both, pass rule committed before any score existed. Every trace, config and script:\nhttps://github.com/giack-hack/synthetic-markets-transfer\n\n## The game\n\nOne episode is one 21-day price path, rebased to 100, no date, no ticker, no news. You sold one\nat-the-money call and were paid a fair premium. Each day you reply `[HEDGE 0.00-1.00]`, the share of the\nunderlying to hold. Changing the hedge costs 5 bps of the traded value.\nReward = -( |option payoff - premium - hedging P&L| / strike + costs ). Zero is a perfect replication.\nDeterministic scoring, no judge.\n\n## Run it\n\n```bash\nprime env install sablier/hedge-gym\nuv run vf-eval hedge-gym -n 20 -m <model>                                  # synthetic held-out worlds\nuv run vf-eval hedge-gym -m <model> --env.taskset.bank exam_2020_overlap    # real 2020, all 188 windows\nuv run vf-eval hedge-gym -m <model> --env.taskset.bank exam_2022_overlap    # real 2022, all 184 windows\n```\n\nAdd `--env.agent.runtime.type subprocess` to run locally without a sandbox. Reward per episode is\n`hedge_score`; `invalid_replies` counts turns with no valid action (one retry, then the previous hedge stays).\n\nReference players on the real windows (mean loss, lower is better, 2020 / 2022): never hedges\n0.0388 / 0.0293, constant 50% hedge 0.0203 / 0.0149, textbook delta hedge 0.0120 / 0.0091, untrained\nQwen3-1.7B 0.0352 / 0.0281, the same model after synthetic-only training 0.0173 / 0.0144.\n\n## Banks in this package\n\n- `era2019_flow_heldout`: 400 synthetic worlds, 100 for each of four US ETFs (large caps, tech, small caps,\n  long bonds), generated by Sablier's market generator fitted on data up to 2019-12-31 and volatility-matched\n  to each asset's 2003-2019 history. Held out from training.\n- `exam_2020_overlap`, `exam_2022_overlap`: every real 21-day window of 2020 and 2022 on a 5-day grid,\n  same four ETFs.\n\nThe 14,000-path training bank (3,500 worlds per asset) and the trained adapters are available on request:\nteam@sablier.ai. Point `HEDGE_GYM_BANKS` at a folder to use them.\n\n## Who\n\nSablier (sablier.ai) generates synthetic market data. Code under MIT (`LICENSE`); the synthetic worlds are\nfor research and reproduction only (`DATA_LICENSE.md`).\n","encoding":"utf-8","truncated":false,"total_bytes":2636},"status":null}