mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-18 18:04:32 +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:
@@ -14,7 +14,9 @@ import (
|
||||
// OpenLong opens long position
|
||||
func (t *KuCoinTrader) OpenLong(symbol string, quantity float64, leverage int) (map[string]interface{}, error) {
|
||||
// Cancel old orders
|
||||
t.CancelAllOrders(symbol)
|
||||
if err := t.CancelAllOrders(symbol); err != nil {
|
||||
logger.Infof(" ⚠ Failed to cancel old pending orders (may not have any): %v", err)
|
||||
}
|
||||
|
||||
// Set leverage
|
||||
if err := t.SetLeverage(symbol, leverage); err != nil {
|
||||
@@ -69,7 +71,9 @@ func (t *KuCoinTrader) OpenLong(symbol string, quantity float64, leverage int) (
|
||||
// OpenShort opens short position
|
||||
func (t *KuCoinTrader) OpenShort(symbol string, quantity float64, leverage int) (map[string]interface{}, error) {
|
||||
// Cancel old orders
|
||||
t.CancelAllOrders(symbol)
|
||||
if err := t.CancelAllOrders(symbol); err != nil {
|
||||
logger.Infof(" ⚠ Failed to cancel old pending orders (may not have any): %v", err)
|
||||
}
|
||||
|
||||
// Set leverage
|
||||
if err := t.SetLeverage(symbol, leverage); err != nil {
|
||||
@@ -218,7 +222,9 @@ func (t *KuCoinTrader) CloseLong(symbol string, quantity float64) (map[string]in
|
||||
logger.Infof("✓ KuCoin closed long position: %s", symbol)
|
||||
|
||||
// Cancel pending orders
|
||||
t.CancelAllOrders(symbol)
|
||||
if err := t.CancelAllOrders(symbol); err != nil {
|
||||
logger.Infof(" ⚠ Failed to cancel pending orders: %v", err)
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"orderId": result.OrderId,
|
||||
@@ -299,7 +305,9 @@ func (t *KuCoinTrader) CloseShort(symbol string, quantity float64) (map[string]i
|
||||
logger.Infof("✓ KuCoin closed short position: %s", symbol)
|
||||
|
||||
// Cancel pending orders
|
||||
t.CancelAllOrders(symbol)
|
||||
if err := t.CancelAllOrders(symbol); err != nil {
|
||||
logger.Infof(" ⚠ Failed to cancel pending orders: %v", err)
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"orderId": result.OrderId,
|
||||
|
||||
Reference in New Issue
Block a user