fix: division by zero guard, logout redirect, onboarding close button

- auto_trader_risk: skip drawdown check when entryPrice <= 0
- AuthContext: redirect to / on logout
- App.tsx: simplify data page navigation
- BeginnerOnboardingPage: add close button to overlay
This commit is contained in:
shinchan-zhai
2026-03-30 14:02:50 +08:00
parent 55db747318
commit fb0bd13f51
4 changed files with 18 additions and 13 deletions
+6
View File
@@ -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 {