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
This commit is contained in:
@@ -79,6 +79,7 @@ export function usePaperMetrics() {
|
||||
|
||||
export async function fetchHistorical(): Promise<Record<string, import("./types").BacktestSummary>> {
|
||||
const res = await fetch(`${API_BASE}/backtests/historical`);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const list: import("./types").BacktestSummary[] = await res.json();
|
||||
const byStrat: Record<string, import("./types").BacktestSummary> = {};
|
||||
for (const b of list) {
|
||||
|
||||
Reference in New Issue
Block a user