Critical bugs fixed:
- executeCloseLong/CloseShort: cancel stop-loss and take-profit orders BEFORE closing
position to prevent orphaned orders from triggering and creating unintended positions
- emergencyClosePosition: same fix for drawdown monitor's emergency close path
- Skip SetStopLoss/SetTakeProfit when AI returns price=0 (prevents exchange API errors)
Also includes:
- Add agent.Stop() to graceful shutdown sequence in main.go
- Remove unused variable suppression in Hyperliquid trader
- Replace all raw pos["key"].(type) assertions with posFloat64/posString/posInt64 helpers
across auto_trader_decision, auto_trader_grid, auto_trader_grid_orders,
auto_trader_grid_regime, auto_trader_loop, auto_trader_orders, auto_trader_risk
- Add posInt64 helper for int64 extraction (createdTime etc)
- Fix emergencyExit: log CloseLong/CloseShort errors instead of silently dropping
- Fix emergencyExit: log GetPositions error on failure
- Upgrade closeAllPositions log level from Infof to Warnf for close failures
- Zero raw type assertions remaining in auto_trader_* files