1. A-S reservation price now uses gamma*500000 scaling.
Before: bash.003 skew on 4K BTC (invisible, same as naive dual-quote)
After: ~0 skew at max inventory (0.05% of mid — enough to suppress one side)
2. Mean Reversion: 20-tick → 60-tick window, threshold 1.0σ → 0.5σ.
20 seconds of 1s ticks is noise, not mean-reverting.
60 seconds captures real short-term reversion dynamics.
Fill attribution verified: BTC sizes differ by 50 μBTC, ETH by 0.0025 — all above matching tolerance.
Orderbook null guards present — no crash on failed fetch.
The AS optimal spread formula gives absurd spreads at crypto scale.
Real market makers quote at the MARKET spread (best bid/ask) and use
AS to decide WHEN to quote based on inventory-adjusted fair value:
r = s - q * gamma * sigma^2 * tau
If r < best_bid (long-biased) → stop quoting bid
If r > best_ask (short-biased) → stop quoting ask
If circuit breaker active → pause both sides
Decoupled: spread is market-driven, inventory skew is AS-driven.
Live node:
- Added Hurst VPIN to STRATEGIES (BTC, 0.00024 size, 00)
- Feed BTC price into dollar-bar Hurst/VPIN every 5 ticks
- Signal: BUY/SELL when H>0.55 + VPIN>0.25 + direction bias
Paper trader:
- Added Kalman Pairs, Avellaneda-Stoikov, Hurst VPIN strategies
- All 00 allocation, matching live node asset distribution
- Hurst/VPIN signal from BTC mid-price dollar bars
Strategy file: hurst_vpin_live.py (lightweight price-tick mode)
Backend: strategies/quant_report.py
- equityCurve: daily PnL from trade history
- monthlyReturns: heatmap matrix (years x months)
- yearlyReturns: bar chart data with mean
- monthlyReturnDistribution: histogram bins
- qqPlot: theoretical vs observed quantiles
- rollingStats: 6-month rolling return + volatility
API: /api/quant-report/{name}
Computes full report from any backtest JSON file
Frontend: QuantReport.tsx
- Strategy Performance chart (equity curve, blue line)
- Monthly Returns heatmap (blue saturation)
- Yearly Returns bar chart with mean line
- Distribution histogram
- Normal QQ plot with diagonal reference
- Rolling Statistics (6-month, dual line)
- QF-Lib header with logo and metadata
- Access via QF-Lib Report button in detail view
New: strategies/persistence.py
Tables: strategies_snap, trade_log, equity_history, fill_tracker
Auto-creates on first use, batches inserts per tick
Fix: seen_fills loads from PG (not 2000 API fills)
Before: every restart loaded all 2000 fills from API into
seen_fills, blocking new fills with matching TIDs for ~20min
After: only loads last 100 from API + full history from PG.
New fills saved to PG immediately - survives restarts.
Live node integration:
- write_metrics() → save_strategies() every tick
- On fill → save_trade() to trade_log
- On fill → TID saved to fill_tracker for cross-restart dedup
Replaced the placeholder live node with a proper NautilusTrader
TradingNode that connects to Hyperliquid Testnet using the
official adapter. Added:
- common/hyperliquid_api.py: direct REST calls to Hyperliquid's
info endpoint for funding rates, predicted fundings, and
asset contexts
- backtests/run_backtest.py: CLI runner for strategy backtests
- Updated funding_rate_arb.py to fetch real funding rates
instead of using a hardcoded placeholder
- Added requests to requirements.txt
Set up the directory structure and wrote placeholder logic for:
- Order Book Imbalance: trades on L2 bid/ask skew
- Iceberg/TWAP detection: follows whale accumulation patterns
- Funding rate arbitrage: delta-neutral carry on perp funding
- Pairs trading: BTC/ETH spread mean reversion
- Avellaneda-Stoikov market making: optimal bid/ask quoting
Also added shared risk manager, portfolio tracker, and a plain-language strategy walkthrough in docs/.