ramseshk
0486e8c93f
feat: VBT overview + light mode + /api/vbt/summary
...
dashboard/static/vbt.html — complete rewrite:
- CSS variables for theming (--bg, --text, --blue, etc.)
- Light mode toggle (☀/☾) persisted in localStorage
- Plotly charts update colors on theme switch
- Overview panel on load: strategy cards + heatmap
- Strategy cards: best Sharpe, best return, top combo,
+Sharpe %, run count. Click to filter.
- Heatmap: color-coded strategy×interval table
(green>2, green>0.5, yellow>0, orange>-0.5, red)
- Back-to-overview button on detail view
- Default sort: Sharpe (was date)
dashboard/server.py:
- New /api/vbt/summary endpoint:
Per-strategy best (Sharpe, Return, Calmar, trades,
positive-Sharpe %, top combo)
Heatmap: strategy×interval best Sharpe matrix
Tests: 241 passing (excl. Hawkes)
2026-08-10 12:38:31 +08:00
ramseshk
b7c7fbb0af
feat: VBT dashboard overview — strategy cards + heatmap + /api/vbt/summary
...
dashboard/server.py — new /api/vbt/summary endpoint:
- Aggregated per-strategy best stats (Sharpe, Return, Calmar, trades,
positive-Sharpe %, top combo details)
- Heatmap: strategy × interval matrix with best Sharpe per cell
dashboard/static/vbt.html — overview panel replaces empty state:
- Strategy cards grid: best Sharpe, best return, top combo,
positive-Sharpe %, run count. Click to filter sidebar.
- Heatmap: color-coded strategy × interval table (green=good,
red=bad). Hover for tooltip, click to load result.
- Back-to-overview button when viewing a strategy detail
- Overview re-shown on page load, auto-loads from /api/vbt/summary
Dashboard opens to overview → select strategy → drill into details
2026-08-10 12:03:49 +08:00
ramseshk
0162e83138
feat: Hyperliquid fee schedule — all tiers, staking, maker rebates
...
config/fee_tiers.py — complete rewrite:
- 7 perps fee tiers (T0-T6) matching HL docs:
T0: 0.045/0.015% → T6: 0.024/0.000%
- 7 spot fee tiers (T0-T6):
T0: 0.070/0.040% → T6: 0.025/0.000%
- 7 staking tiers (none → diamond):
multiplier 1.00 → 0.60 (40% discount)
- 3 maker rebate tiers (>0.5%, >1.5%, >3% maker ratio)
extra -0.001% to -0.003% on positive maker rates
- compute_trade_fees() — per-trade fee breakdown
- fee_tier_from_volume(), staking_tier_from_hype()
- STRATEGY_FEE_MODELS: maker/taker classification per strategy
backtests/vbt_runner.py:
- Accept vip_tier, staking_tier, maker_rebate_tier at init
- Auto-detect fee model per strategy (maker vs taker)
- compute_trade_fees() for per-trade fee calculation
- Include fee_info in result JSON
dashboard/server.py:
- /api/vbt/run accepts fee_tier/aking_tier/maker_rebate params
- Trade normalization uses proper HL fee schedule per strategy
- /api/vbt/result/{filename}/recalc — recalc trades with new tiers
- /api/vbt/fee_tiers — get full fee schedule as JSON
dashboard/static/vbt.html:
- Fee tier selector (T0-T6) + staking tier selector
- Auto-recalculate on tier change when a result is selected
- Fee rate shown in trade log header (e.g. 0.045%)
2026-08-07 15:44:43 +08:00
ramseshk
9d817ac2fa
feat: VBT trade log — show asset, entry/exit prices, Hyperliquid fees
...
Backend (vbt_runner.py):
- Add asset (BTC/ETH) to each trade record
- Compute per-trade fee using HL taker rate (0.05%)
entry_fee = size * entry_px * fee_rate
exit_fee = size * exit_px * fee_rate
- Add pnl_gross (before fees) and pnl_net (after fees)
- Add fee_rate field for transparency
Server (server.py):
- Normalize old backtest trades: add missing asset, fee,
pnl_net, pnl_gross fields
- Holyliquid default fee rate: 0.05% taker
Frontend (vbt.html):
- Trade log table now shows:
Time | Side + Asset | Size | Entry | Exit | Fee | PnL (net) | Duration
- Asset shown as inline badge in Side column
- Fee column with explicit USD amount
- PnL now explicitly labeled 'net' (after fees)
- Fallback to old 'pnl' field for legacy backtest files
2026-08-07 15:35:33 +08:00
ramseshk
870df57051
fix: dashboard errors — Math.abs, API routing, fetchHistorical guard
...
Fixes three bugs in dashboard:
1. vbt.html: bare abs(dd) → Math.abs(dd) — fixes ReferenceError
2. server.py: Add /cv/ routing for Next.js quant dashboard
- Mount _next static assets at /cv/_next (not /cv/ which eats API routes)
- Add /cv/api/* routes for backtests/historical, detail, recalc, risk
- Add /cv/ws WebSocket endpoints for live/paper metrics
- Add /cv/ catchall for Next.js HTML pages
3. dashboard-next/src/lib/api.ts: add res.ok guard to fetchHistorical()
— prevents SyntaxError when API returns HTML error pages
4. sim/maker.py: guard observe() against zero mid_price
2026-08-07 15:19:18 +08:00
ramseshk
b13ce68fef
fix: inverted condition in loadResults — new API response format was falling into wrong branch
2026-08-07 14:17:03 +08:00
ramseshk
6889e06a86
feat: VBT dashboard overhaul — pagination, caching, LTTB downsampling, deep links, export, more metrics
...
- Merge vbt_server.py into server.py (eliminate duplicated VBT API)
- Add server-side pagination (offset/limit) with metadata (total, has_more)
- Add server-side ?asset= filtering to results endpoint
- Add JSON file caching with 5s TTL to avoid re-parsing on every request
- Add LTTB (Largest-Triangle-Three-Buckets) downsampling for equity curves
- Add pre-computed drawdown curve to result detail response
- Add /api/vbt/result/{filename}/csv endpoint for trade export
- Add Calmar ratio and expectancy to results metadata
- Rebuild vbt.html frontend with:
- URL hash deep-linking (#filename) for bookmarkable views
- JSON and CSV export buttons in detail panel
- More metrics: Calmar, Sortino, Expectancy, End Equity (10 total)
- Running backtest progress indicator with elapsed seconds
- Pagination controls (prev/next) with page info
- Filter/sort changes auto-apply (no manual refresh needed)
- Better error states with retry buttons
- Run strategy selector independent of filter
2026-08-07 14:14:40 +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
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
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