mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-17 09:24:36 +08:00
fix(trader): stop swallowing critical errors in order paths
- check CancelAllOrders errors in okx/kucoin/bitget/gate open/close paths (aligns with existing binance/hyperliquid/aster/bybit pattern) - log saveDecision failures in auto_trader_loop instead of discarding - remove dead MustNormalizeTimeframe that panicked in market package - web: npm audit fix resolves react-router HIGH CVEs (GHSA-49rj-9fvp-4h2h, GHSA-2j2x-hqr9-3h42, GHSA-8x6r-g9mw-2r78, GHSA-rxv8-25v2-qmq8)
This commit is contained in:
@@ -47,7 +47,9 @@ func (at *AutoTrader) runCycle() error {
|
||||
at.logWarnf("⏸ Risk control: Trading paused, remaining %.0f minutes", remaining.Minutes())
|
||||
record.Success = false
|
||||
record.ErrorMessage = fmt.Sprintf("Risk control paused, remaining %.0f minutes", remaining.Minutes())
|
||||
at.saveDecision(record)
|
||||
if err := at.saveDecision(record); err != nil {
|
||||
at.logWarnf("⚠ Failed to save decision record: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -64,7 +66,9 @@ func (at *AutoTrader) runCycle() error {
|
||||
at.logErrorf("failed to build trading context: %v", err)
|
||||
record.Success = false
|
||||
record.ErrorMessage = fmt.Sprintf("Failed to build trading context: %v", err)
|
||||
at.saveDecision(record)
|
||||
if saveErr := at.saveDecision(record); saveErr != nil {
|
||||
at.logWarnf("⚠ Failed to save decision record: %v", saveErr)
|
||||
}
|
||||
return fmt.Errorf("failed to build trading context: %w", err)
|
||||
}
|
||||
|
||||
@@ -84,7 +88,9 @@ func (at *AutoTrader) runCycle() error {
|
||||
PositionCount: ctx.Account.PositionCount,
|
||||
InitialBalance: at.initialBalance,
|
||||
}
|
||||
at.saveDecision(record)
|
||||
if err := at.saveDecision(record); err != nil {
|
||||
at.logWarnf("⚠ Failed to save decision record: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -157,7 +163,9 @@ func (at *AutoTrader) runCycle() error {
|
||||
}
|
||||
}
|
||||
|
||||
at.saveDecision(record)
|
||||
if saveErr := at.saveDecision(record); saveErr != nil {
|
||||
at.logWarnf("⚠ Failed to save decision record: %v", saveErr)
|
||||
}
|
||||
|
||||
// In safe mode, don't return error — keep the loop running to retry next cycle
|
||||
if at.safeMode {
|
||||
|
||||
Reference in New Issue
Block a user