Commit Graph

12 Commits

Author SHA1 Message Date
ramseshk 84efb4014a Add Kalman Pairs to all three systems: live, paper, historical
Live node:
  - Registered in STRATEGIES dict (8th strategy)
  - Signal: KalmanPairsTrader.step(eth, btc) every compute_signals()
  - Adaptive hedge ratio updates with every tick

Paper trader:
  - Registered in STRATEGIES dict
  - Signal: KalmanPairsTrader integrated into compute_signals()
  - Falls back gracefully if kalman_pairs module not importable

Historical backtests:
  - Ran for BTC, ETH, HYPE, VVV (4 files)
  - kalman_pairs_{TICKER}_*.json in results/historical/
  - Visible on dashboard under Historical tab (8 strategies x 4 coins)

Dashboard: now shows Kalman Pairs card on all three tabs.
2026-08-05 07:05:00 +00:00
ramseshk 9bfadaec27 Merge risk analytics panel into dashboard HTML (recovered from subagent)
Risk panel now shows below strategy grid: VaR 95%, CVaR 95%, Max DD,
Calmar ratio, Sharpe, Sortino. Strategy correlation summary with
color-coded ρ values (red=high >0.7, amber=medium). Auto-refreshes
when paper data updates (throttled 30s). Collapsible with ▶ toggle.
2026-08-04 07:33:43 +00:00
ramseshk 1bf54b4c00 Add real historical backtesting with Hyperliquid mainnet candle data
backtests/historical_runner.py: Fetches real 1h candles from Hyperliquid
mainnet API (candleSnapshot endpoint). Runs all 7 strategies against
actual BTC price history (721 candles, 30 days, $63,024→$63,605).
Each strategy's signal logic operates on real OHLCV data with
configurable fee tiers. Saves to backtests/results/historical/.

Results on 30d BTC data at VIP0:
  Mean Reversion: +93.87% net (Sharpe 0.94)
  Order Book Imbalance: +54.31% net (Sharpe 1.03)
  Avellaneda-Stoikov: -1.02% net (Sharpe -0.13)
  Iceberg Detection: -33.20% net
  Momentum Breakout: -54.72% net

Server: Added /api/backtests/historical (list) and
/api/backtest/historical/{name} (full data) endpoints.

Dashboard: Added "Historical" tab with "Real Data" badge. Cards show
coin + mainnet source. Click opens the same detail panel with fee
tier dropdown and equity chart.
2026-08-04 07:29:51 +00:00
ramseshk e4de21192a Fix dashboard backtest detail, deterministic backtest seeds, paper trader fees, live node crash guard
Backtest detail: openDetail() now fetches full backtest JSON from the API
instead of showing "Full trade data not in summary". Renders equity curve
chart + full trade history table with 100 rows.

Backtest reproducibility: replaced hash(key) with fixed per-strategy seeds.
Python's hash() is randomized per process (PYTHONHASHSEED), causing wildly
different results for same strategy across runs. Now deterministic.

Server: added total_trades and sortino to /api/backtests summary response.

Paper trader: fixed Avellaneda-Stoikov simulate using TAKER_FEE instead of
MAKER_FEE. Lowered OBI signal threshold from 5bps to 1.5bps for flat markets.

Live node: added None-guard in get_mark_prices — Hyperliquid testnet API
sometimes returns null, crashing the node. Wrapped in try/except.
2026-08-04 07:07:15 +00:00
ramseshk cc2b7df740 Professional dashboard: strategy detail panel with chart, trades, and signal reasons 2026-08-04 06:30:36 +00:00
ramseshk 9768bf80cc Cartea-Jaimungal, Queue Imbalance, Guéant MM: 3 new quant finance strategies + backtests 2026-08-04 06:19:19 +00:00
ramseshk 2c0750e355 Fee optimization: per-strategy maker/taker model + signal strength filter + 9 backtests 2026-08-04 06:12:35 +00:00
ramseshk e2b3f40b37 Hawkes OFI + Deep LOB: two new strategies from advanced microstructure research 2026-08-04 06:01:19 +00:00
ramseshk acf3a556ec Regime-switching Avellaneda-Stoikov + Advanced Strategies research doc
Implemented regime detection in paper trader:
- Rolling 30-tick volatility classifies market as LOW_VOL/NORMAL/HIGH_VOL
- A-S fill probability adapts: 25% (low vol), 15% (normal), 8% (high vol)
- HIGH_VOL with spreads >$30: skip trading (adverse selection protection)
- Regime shown on dashboard header with color-coded badge

Added docs/ADVANCED_STRATEGIES.md — comprehensive research covering:
  1. Deep Learning LOB Prediction (Transformers/TLOB)
  2. Latency Arbitrage in Fragmented Markets
  3. Hawkes Process OFI Modeling
  4. Cross-Chain MEV Arbitrage
  5. Institutional Capital Flow Arbitrage (ETF flows)
  6. Hybrid Transformer + Hawkes Fusion
  7. Implementation Roadmap (Phase 1-4)

All strategies referenced with papers from arXiv, SSRN, and empirical studies.
2026-08-04 04:54:26 +00:00
ramseshk 1ece7ec7c6 Per-strategy equity curves + $100K paper capital
Paper trader now tracks individual equity history per strategy
(strategy_equity dict with deque per strategy). Metrics file
exports per-strategy data for dashboard rendering.

Dashboard paper chart upgraded to 7 overlaid area series:
- Each strategy gets its own colored curve (green, blue, purple, etc.)
- 300px height for better visibility of multiple lines
- Color palette distinguishes strategies at a glance

$100K total capital: $10K per strategy × 7 + $30K reserve.

Exeria Charts evaluated: excellent library (Benzinga award winner,
Canvas/WebGL, exchange connectors) but requires npm+bundler —
not suitable for single-file dashboard. Lightweight-charts
remains the right choice for our architecture.
2026-08-04 04:37:27 +00:00
ramseshk 7a5fdf2f8d Fix tab switching + $100K paper trading capital
Tab IDs now match JavaScript: tab-backtest instead of tab-bt.
Paper trading increased to $100,000 ($10K per strategy, $30K reserve).
Server default paper metrics updated to $100K.
2026-08-04 04:26:38 +00:00
ramseshk f26892f8b2 Paper trading dashboard — 7 strategies on Hyperliquid MAINNET data
New paper trading engine (live/paper_trader.py):
- Pulls real mainnet prices, orderbooks, funding rates every 2s
- Runs all 7 strategies in simulation without placing orders
- Simulates fills at market with realistic taker fees (0.05%) and slip (1bp)
- Avellaneda-Stoikov: simulates spread capture with 15%/tick fill probability
- Tracks virtual positions and PnL per strategy
- $5,000 capital ($1,000 per strategy, $1,000 reserve)
- Writes to /tmp/ftdt-paper-metrics.json

Dashboard updated with 3 tabs:
- Live Trading (Testnet) — real orders on testnet
- Paper Trading (Mainnet) — simulated fills on real mainnet data
- Backtesting — 30-day simulated results

Server.py: added /ws/paper WebSocket endpoint, paper_clients set,
paper metrics reader and broadcast loop.
2026-08-04 04:18:52 +00:00