mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user