Commit Graph
8 Commits
Author SHA1 Message Date
Claude 1eecc06bc2 feat: Hedge Lab — Monte Carlo delta-hedging / gamma-scalping P&L
- core/hedge_sim.py: vectorised Garman-Kohlhagen, self-financing delta hedge
  of the whole portfolio (legs settle at their own expiries) with domestic
  financing, foreign/lease carry and proportional costs; time-based or
  delta-band rebalancing.
- Path models: GBM, Merton jump-diffusion at equal total variance, and a
  stationary block bootstrap of the asset's own daily returns (Brownian-bridge
  intraday steps); Monday-open weekend gaps for 24/5 assets.
- Benchmarks: theoretical edge V(sigma_r)-V(sigma_i), Derman-Kamal
  discrete-hedging error, Leland cost; hedge-frequency sweep (risk vs cost).
- POST /api/hedge/simulate with work caps; bootstrap reuses cached history.
- Hedge Lab tab: scenario controls, 'use Vol Forecast' for realised vol,
  KPIs, P&L histogram, frequency sweep, attribution, sample paths.
- 7 tests: GK parity, unbiased fair-vol hedge with Derman-Kamal sd, mean
  P&L vs theoretical edge, sqrt(N) sweep, band/Leland costs, gaps/jumps
  tails, endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-10-03 05:25:36 +00:00
Claude c646e80e35 feat: Vol Forecast & Regime engine (HAR-RV, GJR-GARCH, gradient boosting, HMM)
- core/vol_forecast.py: forecasts average variance over the next 1D/1W/1M
  with HAR-RV (weekend dummy for 24/7 crypto), GJR-GARCH(1,1) QMLE with a
  vectorised filter, HistGradientBoosting on HAR/return/calendar features,
  and EWMA as benchmark. Garman-Klass + overnight-gap proxy scaled to
  close-to-close on pre-backtest data only.
- Rolling out-of-sample backtest (refit every 21 days, no look-ahead),
  QLIKE / RMSE / bias per model (Patton 2011), inverse-QLIKE ensemble.
- 2-state Gaussian HMM (Baum-Welch) regime probabilities and durations.
- For BTC/ETH: ensemble forecast vs Deribit ATM implied -> rich/cheap view.
- GET /api/vol/forecast/{pair} (cached 30 min; 503 when history is short
  or sources are down); scikit-learn added (models degrade gracefully
  without it).
- Vol Forecast tab: KPIs, forecast term structure vs implied, HMM regime
  history, OOS backtest vs realised (+DVOL), model leaderboard per horizon.
- 7 new tests on simulations with known answers (proxy bias, GARCH and HMM
  parameter recovery, weekend effect, look-ahead check, endpoint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-10-01 05:21:59 +00:00
Claude 3653078d02 ci: make email approve/reject parsing robust to quoted replies
Phone mail apps can glue the quoted header onto the reply
("ApproveOn 29 Sep 2026, at 10:48 AM, ... wrote:"), so the first word was
read as "approveon" and the approval on #3 was ignored. Parse in Python:
strip the quoted email ("On <date> ... wrote:" and '>' lines), then match
approve/lgtm/reject by prefix. Reasons keep their full text, and the
GITHUB_OUTPUT delimiter is random.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-29 05:50:20 +00:00
Claude 88e4d48000 feat: BTC/ETH/XAG support and Vol Lab (live Deribit SVI surface, vol cone, VRP)
Volatile instruments
- Add XAGUSD (SI=F, silver lease rate as r_f), BTCUSD and ETHUSD end to end:
  pair metadata, live rates/OHLC/signals, CFTC positioning mappings
- Asset-class calendars: crypto annualised on 365 days, FX/metals on 252,
  threaded through the signal engine
- Pair switch loads a typical ATM vol, rescales legs by moneyness, and
  strategy templates use a ~1%-of-spot strike step

Vol Lab tab
- /api/vol/crypto/{BTC,ETH}: Deribit book summaries -> raw SVI fit per
  expiry with Durrleman butterfly-arbitrage check, ATM / 25d RR / 25d BF
  (Black-76 forward delta), DVOL, 30d constant-maturity IV, realised vol
  and vol risk premium; cached 60s, 503 when Deribit is unreachable
- /api/vol/cone/{pair}: Burghardt-Lane realised-vol cone on the asset's
  calendar
- UI: KPIs, cone with implied term-structure overlay, per-expiry smile
  (market vs SVI), term-structure table with 'Use' to load T/sigma/RR/BF
  into pricing and the Vol Smile tab

Fixes in the signal engine
- OU half-life divided by 252 twice; stationary sd used sqrt(252k) not sqrt(2k)
- Fallback realised vol returned decimals under *_pct keys

Tests: backend/tests (pytest) validate SVI recovery, exact 25d strikes,
cone calibration on both calendars and the endpoints with mocked feeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-29 05:17:14 +00:00
Claude 23a5a975ff feat: Vanna-Volga FX volatility smile tab
Builds the implied-vol smile from the three standard FX market quotes
(ATM delta-neutral straddle, 25-delta risk reversal, 25-delta butterfly)
using Castagna & Mercurio's second-order Vanna-Volga approximation, and
reprices each portfolio leg off the smile vs the flat vol.

- backend: core/vanna_volga.py (delta->strike, DNS ATM, VV smile) and
  POST /api/smile
- frontend: new "Vol Smile" dashboard tab with quote inputs, smile
  chart, pillar table and smile-vs-flat leg repricing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-28 16:45:11 +00:00
Claude 12950ba196 ci: approve or reject daily PRs by comment or email reply
Adds a workflow that pings the repo owner on each daily Claude PR and
acts on their reply: "approve" merges it, "reject: <reason>" closes it
with the reason recorded and a "rejected" label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-28 16:29:19 +00:00
Claude 280196fe39 Revert "ci: run keep-alive workflow once a day instead of every 10 minutes"
Restores the 10-minute keep-alive schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-28 16:12:30 +00:00
Claude f30533d971 ci: run keep-alive workflow once a day instead of every 10 minutes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpiqUMAyo4RL5DdQHMWbwE
2026-09-28 16:10:56 +00:00