mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-13 15:57:01 +08:00
Feature/okx trading (#1177)
* feat: add OKX exchange trading support - Add OKX trader client with full trading API integration - Support API Key, Secret Key, and Passphrase authentication - Add OKX icon and frontend configuration modal - Update exchange store and types for OKX fields * fix: add passphrase column migration and fix exchange type mapping * fix: show OKX input fields in exchange config modal * fix: ensure all supported exchanges exist for user when listing * fix: simplify exchange type check condition for OKX * debug: add visible debug info for exchange id * fix: remove debug info from exchange config modal * fix: add OKX to exchange type condition in AITradersPage * feat: complete OKX trading support and fix exchange config issues - Add LIGHTER exchange UI support in AITradersPage - Add passphrase field to UpdateExchangeConfigRequest type - Fix OKX HTTP client to bypass proxy (disable system proxy) - Auto-fetch initial balance from exchange when not set - Support multiple balance field names for different exchanges - Add detailed error messages when trader fails to load - Add lighter_api_key_private_key field to exchange store
This commit is contained in:
@@ -443,9 +443,10 @@ func (tm *TraderManager) LoadUserTradersFromStore(st *store.Store, userID string
|
||||
}
|
||||
|
||||
// 使用现有的方法加载交易员
|
||||
logger.Infof("📦 正在加载交易员 %s (AI模型: %s, 交易所: %s, 策略ID: %s)", traderCfg.Name, aiModelCfg.Provider, exchangeCfg.ID, traderCfg.StrategyID)
|
||||
err = tm.addTraderFromStore(traderCfg, aiModelCfg, exchangeCfg, maxDailyLoss, maxDrawdown, stopTradingMinutes, st)
|
||||
if err != nil {
|
||||
logger.Infof("⚠️ 加载交易员 %s 失败: %v", traderCfg.Name, err)
|
||||
logger.Infof("❌ 加载交易员 %s 失败: %v", traderCfg.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,6 +631,10 @@ func (tm *TraderManager) addTraderFromStore(traderCfg *store.Trader, aiModelCfg
|
||||
case "bybit":
|
||||
traderConfig.BybitAPIKey = exchangeCfg.APIKey
|
||||
traderConfig.BybitSecretKey = exchangeCfg.SecretKey
|
||||
case "okx":
|
||||
traderConfig.OKXAPIKey = exchangeCfg.APIKey
|
||||
traderConfig.OKXSecretKey = exchangeCfg.SecretKey
|
||||
traderConfig.OKXPassphrase = exchangeCfg.Passphrase
|
||||
case "hyperliquid":
|
||||
traderConfig.HyperliquidPrivateKey = exchangeCfg.APIKey
|
||||
traderConfig.HyperliquidWalletAddr = exchangeCfg.HyperliquidWalletAddr
|
||||
|
||||
Reference in New Issue
Block a user