Expose the default mainstream currency settings to the configuration file

This commit is contained in:
SkywalkerJi
2025-10-30 10:01:45 +08:00
parent 2bf3e18ca8
commit a6fceff4d3
4 changed files with 38 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ type LeverageConfig struct {
type Config struct {
Traders []TraderConfig `json:"traders"`
UseDefaultCoins bool `json:"use_default_coins"` // 是否使用默认主流币种列表
DefaultCoins []string `json:"default_coins"` // 默认主流币种池
CoinPoolAPIURL string `json:"coin_pool_api_url"`
OITopAPIURL string `json:"oi_top_api_url"`
APIServerPort int `json:"api_server_port"`
@@ -78,6 +79,20 @@ func LoadConfig(filename string) (*Config, error) {
config.UseDefaultCoins = true
}
// 设置默认币种池
if len(config.DefaultCoins) == 0 {
config.DefaultCoins = []string{
"BTCUSDT",
"ETHUSDT",
"SOLUSDT",
"BNBUSDT",
"XRPUSDT",
"DOGEUSDT",
"ADAUSDT",
"HYPEUSDT",
}
}
// 验证配置
if err := config.Validate(); err != nil {
return nil, fmt.Errorf("配置验证失败: %w", err)