Merge upstream/main: Integrate Hyperliquid support with leverage config

Resolved conflicts in manager/trader_manager.go by combining:
- Upstream: Exchange field, Hyperliquid API keys, Hyperliquid testnet
- Local: BTCETHLeverage and AltcoinLeverage fields

Both features are now working together.
This commit is contained in:
PorunC
2025-10-29 21:01:05 +08:00
9 changed files with 1075 additions and 72 deletions

View File

@@ -33,22 +33,25 @@ func (tm *TraderManager) AddTrader(cfg config.TraderConfig, coinPoolURL string,
// 构建AutoTraderConfig
traderConfig := trader.AutoTraderConfig{
ID: cfg.ID,
Name: cfg.Name,
AIModel: cfg.AIModel,
BinanceAPIKey: cfg.BinanceAPIKey,
BinanceSecretKey: cfg.BinanceSecretKey,
CoinPoolAPIURL: coinPoolURL,
UseQwen: cfg.AIModel == "qwen",
DeepSeekKey: cfg.DeepSeekKey,
QwenKey: cfg.QwenKey,
ScanInterval: cfg.GetScanInterval(),
InitialBalance: cfg.InitialBalance,
BTCETHLeverage: leverage.BTCETHLeverage, // 使用配置的杠杆倍数
AltcoinLeverage: leverage.AltcoinLeverage, // 使用配置的杠杆倍数
MaxDailyLoss: maxDailyLoss,
MaxDrawdown: maxDrawdown,
StopTradingTime: time.Duration(stopTradingMinutes) * time.Minute,
ID: cfg.ID,
Name: cfg.Name,
AIModel: cfg.AIModel,
Exchange: cfg.Exchange,
BinanceAPIKey: cfg.BinanceAPIKey,
BinanceSecretKey: cfg.BinanceSecretKey,
HyperliquidPrivateKey: cfg.HyperliquidPrivateKey,
HyperliquidTestnet: cfg.HyperliquidTestnet,
CoinPoolAPIURL: coinPoolURL,
UseQwen: cfg.AIModel == "qwen",
DeepSeekKey: cfg.DeepSeekKey,
QwenKey: cfg.QwenKey,
ScanInterval: cfg.GetScanInterval(),
InitialBalance: cfg.InitialBalance,
BTCETHLeverage: leverage.BTCETHLeverage, // 使用配置的杠杆倍数
AltcoinLeverage: leverage.AltcoinLeverage, // 使用配置的杠杆倍数
MaxDailyLoss: maxDailyLoss,
MaxDrawdown: maxDrawdown,
StopTradingTime: time.Duration(stopTradingMinutes) * time.Minute,
}
// 创建trader实例