Commit Graph

110 Commits

Author SHA1 Message Date
ramseshk 92ba6a564a chore: ignore generated VBT backtest result files 2026-08-07 12:59:34 +08:00
ramseshk 887a33f278 feat: trade log table, strategy params panel, B+W color scheme
Dashboard:
- Trade log table: all trades with time, side, size, entry/exit price, PnL, duration
  in scrollable panel below charts
- Strategy params panel: displays all coefficients (z_entry, gamma, obi_entry,
  grid_levels, etc.) for the selected strategy
- Color scheme: professional black/white
  • positive: #03A9F4 (light blue)
  • negative: #FF5252 (red)
  • neutral: #777 (gray)
  • backgrounds: #0a0a0a / #111 / #181818
  • borders: #222 / #333

VBT runner:
- _extract_metrics now captures trades from pf.trades.records_readable
  (Avg Entry Price, Avg Exit Price, PnL, Return, Duration, Direction)
- _strategy_params() returns key coefficients per strategy type
- _empty_result includes empty trades/params

New vbt_server.py: minimal standalone dashboard (no live trading machinery,
no memory guard, no broadcast loop) — avoids crashing issues
2026-08-07 12:53:52 +08:00
ramseshk 121c67ae5f feat: VBT dashboard — asset badges, interval/bar selectors, sort/filter
Dashboard (vbt.html):
- Interval selector: 1m, 5m, 15m, 1h, 4h, 1d (all Hyperliquid intervals)
- Candle limit selector: 100-5000 bars (6 levels)
- Asset selector: auto/BTC/ETH/SOL for run
- Strategy filter dropdown
- Sort dropdown: Latest, Sharpe, Return%, Min DD, Trades
- Asset badge on every result item in sidebar
- Asset interval filter for results list
- Improved layout: compact 3-row control panel

API (server.py):
- /api/vbt/results: new sort param (sharpe/return/dd/trades/date)
  new interval filter, asset field with _infer_asset()
- /api/vbt/run: new coin param, interval already supported
  coin suffix in saved filenames
- _infer_asset(): maps strategy names to BTC/ETH/BTC-ETH/SOL

Verified: sort=sharpe shows A-S S=+11.37, interval=1h filters
correctly, 7 dashboard controls rendered, asset badges on all items
2026-08-07 12:41:08 +08:00
ramseshk 623345c4d7 fix: normalize old backtest field names in VBT dashboard API
Old files used pnl_pct (not total_return_pct), max_dd (decimal,
not max_drawdown_pct %), num_periods (not n_bars), no profit_factor.
Added _normalize_vbt_fields() that:
- Maps pnl_pct/ann_return_pct → total_return_pct
- Converts max_dd (decimal) → max_drawdown_pct (percentage)
- Maps num_periods → n_bars
- Computes profit_factor from trades (gross_wins / gross_losses)
- Computes win_rate from trades if missing

Both /api/vbt/results and /api/vbt/result/{filename} now normalise.
Verified: old Cartea-Jaimungal file now shows ret=0.82%, pf=1.18, bars=720
2026-08-07 12:35:18 +08:00
ramseshk 737b24895c fix: VBT dashboard — proper metrics display + redesigned UI
- Fixed total_return_pct, profit_factor, n_bars showing 0 in detail view
  by using ?? operator instead of || 0 and fixing renderDetail logic
- Run Backtest now renders result directly from API response
  (no re-fetch race condition)
- Redesigned UI: monospace trading terminal aesthetic
  - Darker palette (#090d14 background, #0d1321 cards)
  - Indigo histogram, proper grid layout
  - Subtle borders (1px #1a2332), better spacing
  - Status indicator with pulse animation
  - Sidebar shows Sharpe, Return%, Profit Factor per result
  - 8 metric cards: Return, Sharpe, DD, Win Rate, PF, Trades,
    End Equity, Sortino
  - Smaller, cleaner fonts, monospace throughout
- Bumped memory guard to 2GB to prevent dashboard getting killed
2026-08-07 12:31:24 +08:00
ramseshk 3606e7f92e feat: proper Grid MM, Composite MM, Hurst/VPIN, Iceberg, A-S strategies
New strategies (strategies/nt/):
- GridMMNT: symmetric limit order grid around mid-price, captures spread from
  oscillation. Simulates fills from candle high/low. Rebuilds grid every 20 bars.
- CompositeMMNT: weighted ensemble of OBI (30%) + A-S inventory skew (40%) +
  Hurst/VPIN (30%). Votes: +1 long, -1 short, 0 neutral. Entry |score| > 0.5.
- IcebergNT: volume spike detection for whale accumulation. Dual-mode:
  candle proxy (volume > avg*2.5, >= 3 consecutive same-direction) and
  L2 wall detection (single level > avg*3). Exit on stop-loss/time/spike-fade.

Fixed strategies:
- Hurst/VPIN VBT: added proper VPIN proxy from candle volume (buy_vol when close
  > open, sell_vol when close < open). 50-bar rolling VPIN window. Signal:
  H>0.55 AND VPIN>0.25 AND |direction|>0.05. Exit: H<0.45 or direction flips.
- Hurst/VPIN paper trader: added HurstVPINLive integration (was missing entirely)
- A-S VBT: replaced placeholder spread filter with proper A-S simulation using
  reservation price formula (mid - q*gamma*sigma^2*tau), inventory tracking
- A-S NT formula: fixed to standard: mid - q*gamma*sigma^2*tau (was scaled by
  notional and gamma_scale improperly)
- Iceberg VBT: new volume spike detection replacing the old trend proxy

Registry: all 7 strategies now  (pairs, hurst_vpin, as_mm, obi, grid_mm,
         composite_mm, iceberg)

VBT backtest results (500 BTC 1h bars):
  pairs:       -2.81%  13 trades   38% win
  hurst_vpin:  -0.77%   1 trade    (VPIN now active, very selective)
  as_mm:       -16.38%  73 trades  29% win
  obi:         -7.19%  15 trades    7% win
  grid_mm:     -4.79%  22 trades  33% win
  iceberg:     0 trades (threshold strict for 1h BTC data)
2026-08-07 11:42:32 +08:00
ramseshk 37da46a016 feat: proper Order Book Imbalance strategy for BTC-USD on HL
strategies/nt/obi_nt.py:
- Dual-mode OBI: candle proxy (backtest) + real L2 orderbook (live)
- Volume-based imbalance: buy_vol / (buy_vol + sell_vol) over rolling window
- Entry when |imbalance| > 0.35, exit on reversion < 0.10
- Stop-loss 2%, take-profit 0.5%, cooldown 3 bars
- compute_signal(price, orderbook=None) for paper trader integration

backtests/vbt_runner.py:
- Replaced placeholder z-score with proper volume-based OBI
- Buy vol = volume where close > open, sell vol = volume where close < open
- Rolling window imbalance computation
- Parameter sweep support with 12 combos tested

Registered across: deploy.py, nt_runner.py, dashboard, strategies/nt/__init__

Verified:
- VectorBT OBI backtest: 15 trades, -7.2% on default (window=20)
- Param sweep best: w=30 t=0.35 → sharpe -0.82, 49% win, 23% DD
- Real L2 orderbook signal: BUY obi=0.880 (bids 88% of depth)
- NT backtest engine: 201 bars, 8 days, 236ms
2026-08-07 10:50:43 +08:00
ramseshk 879372f69e merge: resolve conflicts, keep local framework changes 2026-08-06 17:52:55 +08:00
ramseshk 9cf871be46 Fix order pricing: 1-tick advantage at best bid/ask + process guard
A-S was quoting at best bid/ask (0% win) — orders filled but
0.04% round-trip maker fee exceeded spread capture.
Now: bid+1 / ask-1 = captures spread minus 1 tick each side.

Signal-driven strategies: same 1-tick pricing instead of
0.03% offset that crossed the book or sat too far away.

Added fcntl file lock to prevent duplicate live nodes.
Added IOC fallback (market-crossing) when post-only rejected.

A-S win rate: 0% → 25% (first 8 trades with new pricing)
2026-08-06 09:47:21 +00:00
ramseshk 6934bfdaa0 feat: VectorBT results dashboard with Plotly charts
Dashboard (dashboard/):
- New /api/vbt/results — list VBT backtest results with full metrics
- New /api/vbt/result/{file} — load result + equity curve (auto-decimated >500pts)
- New /api/vbt/run — run backtests on-demand from the UI
- New /api/vbt/sweep — parameter sweep as heatmap data
- New /api/vbt/strategies — list available strategy keys
- New /vbt — interactive HTML dashboard (Plotly.js):
  - Equity curve chart with area fill
  - Drawdown waterfall chart
  - Returns distribution histogram
  - Metric cards: Sharpe, Sortino, max DD, win rate, profit factor
  - Strategy filter sidebar
  - One-click backtest runner
- Fix BACKTEST_DIR auto-detection for local/dev paths

API verified: all 5 endpoints tested against live data
2026-08-06 17:43:47 +08:00
ramseshk 39545ac94b fix: NT backtest engine venue registration and bar precision
- Fix add_venue call with required OmsType, AccountType, Money params
- Fix Bar volume precision to match instrument size_precision
- Fix subscribe_bars to use BarType not InstrumentId
- Fix _submit_order to gracefully handle NT internal API
- All tests pass: VBT, NT, signals, paper exec, param sweep
2026-08-06 17:33:52 +08:00
ramseshk f5ffe4baee feat: NautilusTrader + VectorBT unified framework for Hyperliquid
Add complete framework for testing and deploying quant strategies:

Framework (framework/):
- HyperliquidInstrumentCatalog: loads perps as NT CryptoPerpetual
- HyperliquidDataProvider: real candle/orderbook/mark-price data
- HyperliquidExecutionProvider: live + PaperExecutionProvider: simulated
- BaseHlStrategy: shared NT strategy lifecycle with signal library
- StrategyConfig: YAML-based parameter management
- DeployOrchestrator: CLI for backtest -> paper -> live pipeline

Backtesting (backtests/):
- VBTBacktestRunner: VectorBT vectorized backtests on real HL candles
- NTBacktestRunner: NautilusTrader event-driven backtest engine

NT Strategy ports (strategies/nt/):
- PairsTradingNT: BTC/ETH ratio Z-score mean reversion
- HurstVPINNT: Hurst exponent regime + VPIN flow imbalance
- ASMarketMakingNT: Avellaneda-Stoikov stochastic control MM

E2E verified: real HL candles fetch, VectorBT backtest (Sharpe 5.2
on Hurst/VPIN), instrument catalog, deploy CLI --list, strategy signals.
Existing live/node.py and paper_trader.py unchanged.
2026-08-06 17:23:49 +08:00
ramseshk 8461ed5097 Live open orders/positions + A-S gamma fix + MR 60-tick window
1. Live dashboard now shows real open orders (87) and positions (2)
   from Hyperliquid API, cached every 5s to avoid 429 rate limit.

2. A-S gamma scaling: gamma*500K gives ~0 skew at max inventory
   (was bash.003, functionally identical to naive dual-quote).

3. Mean Reversion: 60-tick window with 0.5σ threshold
   (20s of 1s ticks was noise, not mean-reverting).

4. Sizes reduced for margin safety (wallet 86, 9 concurrent orders).

5. Kalman win_rate bug fixed: added net_pnl/gross_pnl field support.
2026-08-06 09:13:51 +00:00
ramseshk 2429394cd8 Deep audit fixes: A-S gamma scaling + Mean Rev window
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.
2026-08-06 08:34:37 +00:00
ramseshk a6905f2691 Fix win_rate() for Kalman Pairs: add net_pnl/gross_pnl field support
Bug: win_rate() only checked pnl_net/pnl_gross/pnl fields,
but Kalman backtests save trades with net_pnl/gross_pnl (underscore-first).
Result: all 4 Kalman assets showed 0% win on 27-35 trades.

After fix:
  BTC: 0% → 45% (16/35)
  ETH: 0% → 47% (16/34)
  HYPE: 0% → 51% (14/27)
  VVV: 0% → 57% (19/33)

Also corrected paper trader coin assignments for Mean Reversion
and Momentum Breakout (was BTC, should be ETH).
2026-08-06 08:26:35 +00:00
ramseshk 37b8496dc2 Optimal position sizing: 4x BTC, 40x ETH utilization
Strategy          Old→New Notional   Capital Utilization
─────────────────────────────────────────────────────────
OBI (BTC)          3→1           12%→51%  (4x)
Iceberg (BTC)      3→4           13%→54%  (4x)
Funding (BTC)      4→8           14%→58%  (4x)
A-S MM (BTC)       5→1           15%→61%  (4x)
Hurst VPIN (BTC)   5→4           15%→64%  (4x)
Momentum (ETH)     →8             1%→38%  (40x)
Mean Reversion (ETH) →3           1%→43%  (45x)
Kalman Pairs (ETH) 0→8           10%→48%  (5x)
Pairs Trading (ETH) 1→2          11%→52%  (5x)

ETH strategies were using <1% of capital — essentially generating no PnL.
Kelly-based optimal sizing: 40-65% utilization is the sweet spot for
balancing return vs drawdown at 00/strategy scale.
2026-08-06 08:16:48 +00:00
ramseshk 74113ab624 A-S MM backtest: 4 assets with FIFO round-trip PnL
Results on real 5m candle data (7 days):
  BTC: +0.65% PnL | 506 matched | 72% win | 1044 fills
  ETH: 0.00% PnL | 505 matched | 57% win
  HYPE: 0.00% PnL | 510 matched | 61% win
  VVV: 0.00% PnL | 512 matched | 42% win

Side-selection via reservation price reduces adverse fills.
BTC shows clear edge: spreads are wider in absolute terms.
2026-08-06 08:11:46 +00:00
ramseshk f9bed72b1c Proper A-S: side selection via reservation price (not spread formula)
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.
2026-08-06 08:04:49 +00:00
ramseshk a5de7d526f Proper Avellaneda-Stoikov: reservation price + optimal spread model 2026-08-06 08:00:08 +00:00
ramseshk 08a95e8fe2 Proper Avellaneda-Stoikov: reservation price + optimal spread model 2026-08-06 16:00:00 +08:00
ramseshk 50f8f4f970 Refactor: review, fix, and test entire codebase
Live node:
  - Fix null-handling for open_ords and get_fills requests
  - Cap equity_history, strategy_equity at 600-1000 entries (memory leak fix)
  - Dynamic strategy count in startup log
  - Loop error recovery: catch exceptions, backoff 5s, continue

Dashboard server:
  - Fix backtest detail API: check HISTORICAL_DIR first
  - This was causing all historical detail views to show zeros

Tests (5 suites, all passing):
  1. Signal generation: Mean Reversion VWAP + Momentum + Pairs + OBI
  2. Backtest: SPX mean reversion on 500-point series
  3. Hurst/VPIN: 15 signals from 280 dollar bars
  4. Memory guard: RSS monitoring, GC thresholds
  5. Dashboard API: historical listing + SPX detail

38 backtests on dashboard, 2 SPX entries with real trade data.
2026-08-06 07:52:02 +00:00
ramseshk 392bde44a0 Fix backtest detail API — check historical/ subdirectory first
Bug: /api/backtest/{name} only looked in backtests/results/,
but all historical backtests are saved in backtests/results/historical/.
Fix: check HISTORICAL_DIR first, then fall back to BACKTEST_DIR.
This fixes SPX backtest detail showing zero prices/fees.
2026-08-06 07:44:07 +00:00
ramseshk 6fcf5e7c7d TradeXYZ SPX S&P 500 Mean Reversion backtest
Data: real Hyperliquid SPX perpetual candles (licensed S&P 500).
1h 30d: +0.26% PnL, 38 trades, 74% win rate
30m 7d: +0.14% PnL, 22 trades, 77% win rate

Strategy: Z-score mean reversion on 20-bar rolling window.
Entry at ±1.5σ, exit at ±0.3σ reversion. 1% capital per trade.
2026-08-06 07:34:55 +00:00
ramseshk cbbd0ef941 Fix Mean Reversion VWAP bug — was never firing
Root cause: VWAP weighted the current price highest so dev≈0 always.
- Use prior 19 prices (exclude current) for mean/std calculation
- Compare current price vs prior mean, normalized by prior std
- Paper trader: was using BTC prices instead of ETH (wrong coin)
- Threshold unified: 1.0σ (was 1.5σ in paper, 1.0σ in live)

Backtests show BTC Mean Reversion: +76.42% PnL, 91% win, 22 trades.
2026-08-06 07:28:31 +00:00
ramseshk ff3e68855c Repo cleanup: README with full stack summary + .gitignore + remove stale backups 2026-08-06 07:21:04 +00:00
ramseshk 3cc68cd46a Fix Hurst/VPIN exit logic — time-based exit (20 bars max holding)
Backtest on 6000 synth trades: 46 trades, 44 wins, +1.10% PnL.
Entry: H>0.52 + VPIN>0.15 + direction bias
Exit: after 20 bars OR Hurst decay below exit threshold
2026-08-06 07:13:17 +00:00
ramseshk b0eaee47db Hurst/VPIN backtest: 1 trade, 0% PnL (synthetic — selective by design) 2026-08-06 07:03:12 +00:00
ramseshk cf376f2995 Deploy Hurst/VPIN directional strategy to live + paper
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)
2026-08-06 06:51:51 +00:00
ramseshk a8ed3cafe0 Fix memory guard: remove RLIMIT_AS (blocks Python heap), VmRSS-only 2026-08-06 06:40:08 +00:00
ramseshk 298b9c8020 Memory guard: 512MB hard cap, GC at 256MB, 2GB swap 2026-08-06 06:31:16 +00:00
ramseshk e5a81132ef Memory guard: 512MB hard cap, GC at 256MB, +swap 2026-08-06 14:30:34 +08:00
ramseshk 2176910fab QuantReport: handle API error responses, restart paper trader 2026-08-06 06:19:42 +00:00
ramseshk c98681c130 Fix historical cards + Hurst/VPIN strategy
Historical tab fix:
  - StrategyCard: handle BacktestSummary type (not Strategy)
  - Pass coin/badge/stats/pnlPct/status props for historical
  - Historical cards now show proper data

Hurst/VPIN directional strategy (Hyperliquid BTC-USD):
  - Dollar bars (constant-notional 0K)
  - Hurst exponent R/S analysis on 128-bar window
  - VPIN on 50-bucket volume imbalance
  - Quote-driven entry: both signals agree → BUY/SELL
  - Exit: Hurst decays below exit threshold
2026-08-06 04:49:00 +00:00
ramseshk 6a39125fee Fix detail view crash + QuantReport safety check
- QuantReport: handles empty backtestId gracefully (live/paper)
- QuantReport: only fetches for historical tab (has backtest data)
- Shows No data available for live/paper views
- Ubuntu font throughout: layout, header, tabs, cards
- Consistent Hallmark Cobalt light palette
2026-08-06 04:37:23 +00:00
ramseshk 6552511978 Hallmark Cobalt: unified light palette + Ubuntu fonts
Layout: Ubuntu + Ubuntu Mono (next/font/google), light mode
CSS: Hallmark Cobalt palette — cool paper bg, hairlines,
  electric cobalt primary, slate secondary
Cards: white bg, hairline borders, muted type badges
Header/tabs: Ubuntu Mono labels, Ubuntu tab buttons
Removed: dark mode, Inter/JetBrains Mono, purple gradients
2026-08-06 04:22:50 +00:00
ramseshk 98ee58dfaa Hallmark redesign + QuantReport fix
Header/Tabs: Hallmark Cobalt aesthetic
  - Hairlines, cool paper bg, JetBrains Mono + Inter
  - Electric cobalt accent on active tab
  - No branding, no purple badges, no gradients

QuantReport: inline in strategy detail view
  - Renders below trade history on every tab
  - API maps strategy name -> file prefix
  - Proper backtestId from historical data

Server: strategy-name-to-prefix lookup
  ofi, avellaneda, iceberg, momentum, mean_rev,
  funding_arb, kalman_pairs, pairs
2026-08-06 04:14:21 +00:00
ramseshk 8cb59239c6 Hallmark Cobalt header: clean professional nav
Removed: FTDT Quant Lab branding, purple badges, green pulse dot,
  shadcn Tabs dependency, backdrop blur noise
Replaced with: Hallmark Cobalt engineered aesthetic
  - Hairline borders (#e0e4ec), cool paper (#f8f9fb)
  - JetBrains Mono header labels, Inter tab buttons
  - Electric cobalt (#0ea5e9) signal accent on active tab
  - Flat text labels: Live · Paper · Historical
  - Status dot + CONNECTED/OFFLINE subtle indicator
  - No shadows, no gradients, no rounded cards
2026-08-06 03:59:41 +00:00
ramseshk 232d2dae10 Quant Report inline: embed in strategy detail view
Removed: popup button + fullscreen overlay
Added: QuantReport renders directly below trade history
  in every strategy detail view (live, paper, historical).
  White background, 6-panel layout, QF-Lib header.
2026-08-06 03:56:23 +00:00
ramseshk 79870925f7 Fix QuantReport: fuzzy file matching + proper backtestId from historical data
- API: fuzzy matcher resolves files by strategy name substring
- Frontend: backtestId now uses historical[name].name (the filename)
- Server restarted with quant_report endpoint
2026-08-06 03:50:28 +00:00
ramseshk 0e08543823 QF-Lib Quant Report: full strategy performance analytics
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
2026-08-06 03:37:25 +00:00
ramseshk 03ebe9e795 Paper trader: 00 per strategy, match live node 8-strategy set
- Capital: 00,000 -> 00 (8 x 00)
- 12 old strategies -> 8 core strategies matching live node
- Asset distribution: 4 BTC + 4 ETH
- Removed Hawkes/DeepLOB/Cartea/Gueant/QueueImbalance imports
- Added Kalman Pairs signal generation
- All strategies share same signal logic as live node:
  BTC: OBI, Iceberg, Funding, A-S
  ETH: Pairs, Momentum, Mean Reversion, Kalman
2026-08-06 03:22:05 +00:00
ramseshk 0b8943c926 PostgreSQL persistence layer + seen_fills fix
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
2026-08-06 03:12:10 +00:00
ramseshk 162c535c7c Lower thresholds for silent strategies:
- Funding: 3% -> 1% APR (BTC funding ~0.87%, still below)
- Kalman: Z-entry 2.0 -> 1.5 sigma
- Momentum: 1.2σ -> 1.0σ Bollinger bands
- Mean Reversion: 1.0σ -> 0.8σ VWAP deviation
2026-08-05 10:23:37 +00:00
ramseshk 941c07fe32 Per-strategy type badges with color coding + asset labels
reversal:    blue    (OBI, Mean Reversion)
  momentum:    amber   (Iceberg, Momentum Breakout)
  stat_arb:    purple  (Pairs, Kalman Pairs)
  carry:       cyan    (Funding Rate Arb)
  market_making: emerald (Avellaneda-Stoikov)

Each card now shows: [TYPE badge] [ASSET] [status] [maker/taker]
2026-08-05 10:05:43 +00:00
ramseshk bf137a08a3 Comprehensive live strategy review and fixes
Strategy asset redistribution:
  BTC-USD-PERP: OBI (0.000200), Iceberg (0.000210), A-S (0.000230), Funding (0.000220)
  ETH-USD-PERP: Pairs (0.006), Momentum (0.0005), Mean Reversion (0.0005), Kalman (0.005)

Bug fixes:
  - OBI size: 0.000200504030201000 -> 0.000200 (garbage from bad replace)
  - Iceberg: up>=7 BUY, up<=3 SELL (was both firing at up==5)
  - Kalman: unique ETH size 0.005 (was 0.006 colliding with Pairs)
  - Momentum: switched to ETH data, tighter 1.2sigma bands
  - Mean Reversion: switched to ETH data, higher vol = more signals
  - Pairs: sharper Z threshold 1.2 (was 1.5)

Strategy types (for dashboard viz):
  reversal: OBI, Mean Reversion (equity + PnL cards)
  momentum: Iceberg, Momentum (breakout visualization)
  stat_arb: Pairs, Kalman (spread + hedge ratio charts)
  carry: Funding Rate Arb (funding rate gauge)
  market_making: Avellaneda-Stoikov (quote tracking)
2026-08-05 10:03:36 +00:00
ramseshk d31d301822 Clean dashboard: remove footer links + positions panel
Removed:
  - Three footer link cards (ftdt.io, Quant Lab, Git Repo)
  - Open Positions & Orders collapsible panel
  - Unused imports (Activity, Database, TrendingUp, Collapsible)

Positions already shown live on each strategy card (Pos: 0.0000).
Dashboard is now cleaner: strategies grid + L2 Terminal button only.
2026-08-05 09:55:56 +00:00
ramseshk f198d2ccf6 L2 Terminal: full-screen SOTA order book depth map
Replaces the cramped 480px component with a full-screen
production-grade trading terminal:

  DOM Ladder (25%):
    - 40 price rows centered on mid
    - Bid/ask volume bars with opacity scaling
    - Floating mid price, volume text on both sides

  Depth Heatmap (75%):
    - Cumulative volume profile (filled gradient areas)
    - Green bid fill, red ask fill
    - Yellow dashed mid line with floating labels
    - Price axis, volume scale, imbalance gauge

  Trade Tape (30% bottom):
    - Amber trade path with colored markers
    - Sized dots (trade size proportional)
    - Latest trade callout with direction

  Header bar:
    - Live connection indicator, mid, spread, imbalance
    - Real-time trade count

Access: click L2 Depth Map button on main dashboard
Fullscreen overlay with close button, ESC to dismiss
2026-08-05 09:45:54 +00:00
ramseshk 9b1d46526b Fix strategy isolation: unique sizes + testnet meta fallback
- 6 BTC strategies now have unique sizes (0.000200-0.000250)
- Fill attribution uses tighter tolerance (1e-6) for unambiguous matching
- Testnet meta API returns null -> fallback to mainnet for perp loading
- All strategies placing orders with correct isolation
2026-08-05 09:29:29 +00:00
ramseshk e9629b698b Fix Hyperliquid WebSocket subscribe format: type -> method 2026-08-05 09:04:40 +00:00
ramseshk bfc3214967 Fix L2 tape visibility: add to OBI detail component
Root cause: OrderBookDepthMap was only in non-OBI detail branch.
When user clicked Order Book Imbalance card, the OBIDetail component
replaced the entire detail view, and the tape was never mounted.

Fix: Added OrderBookDepthMap to OBIDetail component below trade history.
Now visible in ALL strategy detail views (both OBI and non-OBI).
2026-08-05 08:58:11 +00:00