feat: auto-restart traders on system startup

- Add AutoStartRunningTraders method to TraderManager
- Automatically restore traders marked as running in database
- Call auto-start after loading traders from store on startup
This commit is contained in:
tinkle-community
2025-12-06 18:21:12 +08:00
parent 1e5ece947c
commit 5e5be347ad
2 changed files with 46 additions and 0 deletions

View File

@@ -345,6 +345,9 @@ func main() {
logger.Info("按 Ctrl+C 停止运行")
logger.Info(strings.Repeat("=", 60))
// 自动恢复之前运行中的交易员
traderManager.AutoStartRunningTraders(st)
// 获取API服务器端口优先级环境变量 > 数据库配置 > 默认值)
apiPort := 8080 // 默认端口