From f6750acc971964e10bbcefc183e22886f7449adb Mon Sep 17 00:00:00 2001 From: Shui <88711385+hzb1115@users.noreply.github.com> Date: Fri, 7 Nov 2025 23:58:02 -0500 Subject: [PATCH] Fix(auto_trader): casue panic because close a close channel (#737) Co-authored-by: zbhan --- trader/auto_trader.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/trader/auto_trader.go b/trader/auto_trader.go index 76de2051..88ed54fa 100644 --- a/trader/auto_trader.go +++ b/trader/auto_trader.go @@ -269,6 +269,9 @@ func (at *AutoTrader) Run() error { // Stop 停止自动交易 func (at *AutoTrader) Stop() { + if !at.isRunning { + return + } at.isRunning = false close(at.stopMonitorCh) // 通知监控goroutine停止 at.monitorWg.Wait() // 等待监控goroutine结束