5 Commits

Author SHA1 Message Date
ramseshk f7f47b5484 Fix Kalman Pairs historical backtest: real BTC/ETH pair data
Root cause: Kalman filter needs a cointegrated pair, but the
historical runner was feeding it synthetic noise (close vs SMA).
The Kalman filter found no mean-reverting spread, producing 0 signals.

Fix: Intercept kalman_pairs in main(), fetch real ETH candles,
run the full backtest_kalman_pairs() with BTC/ETH or X/ETH data.

Results (30-day, 720h candles, BTC/ETH pair):
  BTC: 35 trades, -0.36% PnL
  ETH: 34 trades, -0.01% PnL  (ETH/BTC pair)
  HYPE: 27 trades, -0.00% PnL (HYPE/BTC pair)
  VVV: 33 trades, -0.01% PnL  (VVV/BTC pair)

Total: 32 historical backtests (8 strategies x 4 coins)
2026-08-05 07:32:41 +00:00
ramseshk 803a38b237 Funding Rate Arb: historical backtests running (was pass/skip)
Historical runner:
  - funding_arb was just "pass" — replaced with hourly trend proxy
  - Annualizes 1h return as funding rate: rate = ret_1h * 365 * 24
  - Entry when |annual_rate| > 3%, scales strength with rate

Backtest results (30-day, 720h candles):
  BTC: +146.94% net, 75% win, 72 trades
  ETH: -13.76% net, 69% win, 87 trades
  HYPE: -0.95% net, 73% win, 63 trades
  VVV: +0.10% net, 78% win, 86 trades

Total: 32 historical backtests (8 strategies x 4 coins)
Cleaned 4 duplicate files from old names
2026-08-05 07:10:39 +00:00
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 156ea40e78 Add multi-ticker historical backtests: 28 results (7 strategies × 4 coins)
- Cleaned old timestamp-named files
- New files with proper ticker naming: {strategy}_{TICKER}_{timestamp}.json
- BTC, ETH, HYPE, VVV backtests for all 7 strategies
- Mean Reversion BTC: +76.42%, VVV: +0.04%, ETH: -0.12%, HYPE: -0.02%
2026-08-05 05:11:32 +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