diff --git a/trader/auto_trader_risk.go b/trader/auto_trader_risk.go index b8c94fb3..937b1839 100644 --- a/trader/auto_trader_risk.go +++ b/trader/auto_trader_risk.go @@ -49,6 +49,12 @@ func (at *AutoTrader) checkPositionDrawdown() { quantity = -quantity // Short position quantity is negative, convert to positive } + // Guard: skip if entry price is zero (prevents division by zero panic) + if entryPrice <= 0 { + logger.Warnf("⚠️ Drawdown monitoring: %s %s has zero entry price, skipping", symbol, side) + continue + } + // Calculate current P&L percentage leverage := 10 // Default value if lev, ok := pos["leverage"].(float64); ok { diff --git a/web/src/App.tsx b/web/src/App.tsx index 34fbef5c..df4afab2 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -451,19 +451,7 @@ function App() { // Data page - publicly accessible with embedded dashboard if (route === '/data') { const dataPageNavigate = (page: Page) => { - const pathMap: Record = { - 'data': '/data', - 'competition': '/competition', - 'strategy-market': '/strategy-market', - 'traders': '/traders', - 'trader': '/dashboard', - 'strategy': '/strategy', - 'faq': '/faq', - } - const path = pathMap[page] - if (path) { - window.location.href = path - } + navigateToPage(page) } return (
+