feat: 重构仓位轮训逻辑并修复多语言配置

主要改动:
1. 创建独立的 PositionCheckService 服务
   - 将仓位检查逻辑从 PositionPushService 中分离
   - 实现待赎回仓位检查和未卖出订单检查
   - 实现订单状态更新逻辑(FIFO策略)

2. 修改 PositionPushService
   - 后端启动时自动启动轮训任务
   - 每次轮训后推送全量数据给所有订阅的客户端
   - 调用 PositionCheckService 进行仓位检查

3. 自动赎回功能调整
   - 将自动赎回从跟单配置级别移到系统级别
   - 添加系统级自动赎回配置管理
   - 支持 Builder API Key 配置检查

4. 多语言配置修复
   - 修复 PositionCheckService 中的硬编码消息
   - 使用 MessageSource 获取多语言文本
   - 添加自动赎回和 Builder API Key 相关的多语言资源

5. 数据库迁移
   - V8: 添加跟单配置名称字段
   - V9: 将自动赎回配置移到系统配置表

6. 前端更新
   - 添加系统级自动赎回配置界面
   - 更新跟单配置管理界面
   - 添加 Builder API Key 配置界面
This commit is contained in:
WrBug
2025-12-07 02:06:19 +08:00
parent bfbbbdd1de
commit cb167d442f
31 changed files with 1544 additions and 121 deletions
+37
View File
@@ -304,6 +304,18 @@
"systemSettingsDesc": "Configure proxy, view API health status",
"footer": "Please use the above pages for configuration management."
},
"systemSettings": {
"autoRedeem": {
"title": "Auto Redeem Configuration",
"label": "Auto Redeem",
"tooltip": "When enabled, the system will automatically redeem redeemable positions. Requires Builder API Key configuration to take effect",
"builderApiKeyNotConfigured": "Builder API Key Not Configured",
"builderApiKeyNotConfiguredDesc": "Auto redeem feature requires Builder API Key configuration to take effect.",
"goToConfigure": "Go to Configure",
"saveSuccess": "Auto redeem configuration updated",
"saveFailed": "Failed to update auto redeem configuration"
}
},
"builderApiKey": {
"title": "Builder API Key Configuration",
"alertTitle": "What is Builder API Key?",
@@ -326,6 +338,7 @@
"saveSuccess": "Builder API Key configuration saved successfully",
"saveFailed": "Failed to save Builder API Key configuration",
"getFailed": "Failed to get Builder API Key configuration",
"noChanges": "No fields to update",
"notConfigured": "Builder API Key not configured, please go to System Settings to configure",
"notConfiguredError": "Builder API Key not configured, cannot execute Gasless transactions. Please go to System Settings to configure Builder API Key.",
"apiReference": "API Reference Documentation",
@@ -654,6 +667,18 @@
"priceRangeTooltip": "Only copy orders where Leader's trade price is within the specified range. Leave empty to disable. Examples: Fill 0.11 and 0.89 means only copy orders with price between 0.11 and 0.89; Fill only max price 0.89 means only copy orders with price below 0.89; Fill only min price 0.11 means only copy orders with price above 0.11.",
"minPricePlaceholder": "Min Price (leave empty for no limit)",
"maxPricePlaceholder": "Max Price (leave empty for no limit)",
"configName": "Configuration Name",
"configNameRequired": "Please enter configuration name",
"configNamePlaceholder": "e.g., Copy Trading Config 1",
"configNameTooltip": "Set a name for the copy trading configuration for easy identification and management",
"advancedSettings": "Advanced Settings",
"pushFailedOrders": "Push Failed Orders",
"pushFailedOrdersTooltip": "When enabled, failed orders will be pushed to Telegram",
"autoRedeem": "Auto Redeem",
"autoRedeemTooltip": "When enabled, the system will automatically redeem redeemable positions. Requires Builder API Key configuration to take effect",
"builderApiKeyNotConfigured": "Builder API Key Not Configured",
"builderApiKeyNotConfiguredDesc": "Auto redeem feature requires Builder API Key configuration to take effect.",
"goToConfigure": "Go to Configure",
"supportSell": "Support Sell",
"supportSellTooltip": "Whether to copy Leader's sell orders",
"create": "Create Copy Trading Config",
@@ -717,6 +742,18 @@
"priceRangeTooltip": "Only copy orders where Leader's trade price is within the specified range. Leave empty to disable. Examples: Fill 0.11 and 0.89 means only copy orders with price between 0.11 and 0.89; Fill only max price 0.89 means only copy orders with price below 0.89; Fill only min price 0.11 means only copy orders with price above 0.11.",
"minPricePlaceholder": "Min Price (leave empty for no limit)",
"maxPricePlaceholder": "Max Price (leave empty for no limit)",
"configName": "Configuration Name",
"configNameRequired": "Please enter configuration name",
"configNamePlaceholder": "e.g., Copy Trading Config 1",
"configNameTooltip": "Set a name for the copy trading configuration for easy identification and management",
"advancedSettings": "Advanced Settings",
"pushFailedOrders": "Push Failed Orders",
"pushFailedOrdersTooltip": "When enabled, failed orders will be pushed to Telegram",
"autoRedeem": "Auto Redeem",
"autoRedeemTooltip": "When enabled, the system will automatically redeem redeemable positions. Requires Builder API Key configuration to take effect",
"builderApiKeyNotConfigured": "Builder API Key Not Configured",
"builderApiKeyNotConfiguredDesc": "Auto redeem feature requires Builder API Key configuration to take effect.",
"goToConfigure": "Go to Configure",
"supportSell": "Support Sell",
"supportSellTooltip": "Whether to copy Leader's sell orders",
"save": "Save",
+39
View File
@@ -216,6 +216,18 @@
"systemSettingsDesc": "配置代理、查看 API 健康状态",
"footer": "请使用上述页面进行配置管理。"
},
"systemSettings": {
"autoRedeem": {
"title": "自动赎回配置",
"label": "自动赎回",
"tooltip": "开启后,系统会自动赎回可赎回的仓位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自动赎回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"saveSuccess": "自动赎回配置已更新",
"saveFailed": "更新自动赎回配置失败"
}
},
"builderApiKey": {
"title": "Builder API Key 配置",
"alertTitle": "什么是 Builder API Key",
@@ -238,6 +250,7 @@
"saveSuccess": "保存 Builder API Key 配置成功",
"saveFailed": "保存 Builder API Key 配置失败",
"getFailed": "获取 Builder API Key 配置失败",
"noChanges": "没有需要更新的字段",
"notConfigured": "Builder API Key 未配置,请前往系统设置页面配置",
"notConfiguredError": "Builder API Key 未配置,无法执行 Gasless 交易。请前往系统设置页面配置 Builder API Key。",
"apiReference": "API 参考文档",
@@ -508,6 +521,18 @@
"copyTradingAdd": {
"title": "新增跟单配置",
"back": "返回",
"configName": "配置名",
"configNameRequired": "请输入配置名",
"configNamePlaceholder": "例如:跟单配置1",
"configNameTooltip": "为跟单配置设置一个名称,便于识别和管理",
"advancedSettings": "高级设置",
"pushFailedOrders": "推送失败订单",
"pushFailedOrdersTooltip": "开启后,失败的订单会推送到 Telegram",
"autoRedeem": "自动赎回",
"autoRedeemTooltip": "开启后,系统会自动赎回可赎回的仓位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自动赎回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"selectWallet": "选择钱包",
"selectWalletPlaceholder": "请选择钱包",
"walletRequired": "请选择钱包",
@@ -579,6 +604,18 @@
"copyTradingEdit": {
"title": "编辑跟单配置",
"back": "返回",
"configName": "配置名",
"configNameRequired": "请输入配置名",
"configNamePlaceholder": "例如:跟单配置1",
"configNameTooltip": "为跟单配置设置一个名称,便于识别和管理",
"advancedSettings": "高级设置",
"pushFailedOrders": "推送失败订单",
"pushFailedOrdersTooltip": "开启后,失败的订单会推送到 Telegram",
"autoRedeem": "自动赎回",
"autoRedeemTooltip": "开启后,系统会自动赎回可赎回的仓位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自动赎回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"wallet": "钱包",
"leader": "Leader",
"selectWallet": "钱包",
@@ -666,6 +703,8 @@
"copyTradingList": {
"title": "跟单配置管理",
"addCopyTrading": "新增跟单",
"configName": "配置名",
"configNameNotProvided": "未提供",
"wallet": "钱包",
"account": "账户",
"template": "模板",
+37
View File
@@ -304,6 +304,18 @@
"systemSettingsDesc": "配置代理、查看 API 健康狀態",
"footer": "請使用上述頁面進行配置管理。"
},
"systemSettings": {
"autoRedeem": {
"title": "自動贖回配置",
"label": "自動贖回",
"tooltip": "開啟後,系統會自動贖回可贖回的倉位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自動贖回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"saveSuccess": "自動贖回配置已更新",
"saveFailed": "更新自動贖回配置失敗"
}
},
"builderApiKey": {
"title": "Builder API Key 配置",
"alertTitle": "什麼是 Builder API Key",
@@ -326,6 +338,7 @@
"saveSuccess": "保存 Builder API Key 配置成功",
"saveFailed": "保存 Builder API Key 配置失敗",
"getFailed": "獲取 Builder API Key 配置失敗",
"noChanges": "沒有需要更新的字段",
"notConfigured": "Builder API Key 未配置,請前往系統設置頁面配置",
"notConfiguredError": "Builder API Key 未配置,無法執行 Gasless 交易。請前往系統設置頁面配置 Builder API Key。",
"apiReference": "API 參考文檔",
@@ -654,6 +667,18 @@
"priceRangeTooltip": "僅跟單 Leader 交易價格在指定區間內的訂單。不填寫表示不限制。示例:填寫 0.11 和 0.89 表示僅跟單價格在 0.11 到 0.89 之間的訂單;只填寫最高價 0.89 表示僅跟單價格在 0.89 以下的訂單;只填寫最低價 0.11 表示僅跟單價格在 0.11 以上的訂單。",
"minPricePlaceholder": "最低價(留空不限制)",
"maxPricePlaceholder": "最高價(留空不限制)",
"configName": "配置名",
"configNameRequired": "請輸入配置名",
"configNamePlaceholder": "例如:跟單配置1",
"configNameTooltip": "為跟單配置設置一個名稱,便於識別和管理",
"advancedSettings": "高級設置",
"pushFailedOrders": "推送失敗訂單",
"pushFailedOrdersTooltip": "開啟後,失敗的訂單會推送到 Telegram",
"autoRedeem": "自動贖回",
"autoRedeemTooltip": "開啟後,系統會自動贖回可贖回的倉位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自動贖回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"supportSell": "跟單賣出",
"supportSellTooltip": "是否跟單 Leader 的賣出訂單",
"create": "創建跟單配置",
@@ -717,6 +742,18 @@
"priceRangeTooltip": "僅跟單 Leader 交易價格在指定區間內的訂單。不填寫表示不限制。示例:填寫 0.11 和 0.89 表示僅跟單價格在 0.11 到 0.89 之間的訂單;只填寫最高價 0.89 表示僅跟單價格在 0.89 以下的訂單;只填寫最低價 0.11 表示僅跟單價格在 0.11 以上的訂單。",
"minPricePlaceholder": "最低價(留空不限制)",
"maxPricePlaceholder": "最高價(留空不限制)",
"configName": "配置名",
"configNameRequired": "請輸入配置名",
"configNamePlaceholder": "例如:跟單配置1",
"configNameTooltip": "為跟單配置設置一個名稱,便於識別和管理",
"advancedSettings": "高級設置",
"pushFailedOrders": "推送失敗訂單",
"pushFailedOrdersTooltip": "開啟後,失敗的訂單會推送到 Telegram",
"autoRedeem": "自動贖回",
"autoRedeemTooltip": "開啟後,系統會自動贖回可贖回的倉位。需要配置 Builder API Key 才能生效",
"builderApiKeyNotConfigured": "Builder API Key 未配置",
"builderApiKeyNotConfiguredDesc": "自動贖回功能需要配置 Builder API Key 才能生效。",
"goToConfigure": "前往配置",
"supportSell": "跟單賣出",
"supportSellTooltip": "是否跟單 Leader 的賣出訂單",
"save": "保存",