============================================================================ Candidate Coins ============================================================================ GetCandidateCoins gets candidate coins based on strategy configuration
()
| 289 | |
| 290 | // GetCandidateCoins gets candidate coins based on strategy configuration |
| 291 | func (e *StrategyEngine) GetCandidateCoins() ([]CandidateCoin, error) { |
| 292 | var candidates []CandidateCoin |
| 293 | symbolSources := make(map[string][]string) |
| 294 | |
| 295 | coinSource := e.config.CoinSource |
| 296 | |
| 297 | switch coinSource.SourceType { |
| 298 | case "static": |
| 299 | for _, symbol := range coinSource.StaticCoins { |
| 300 | symbol = market.Normalize(symbol) |
| 301 | candidates = append(candidates, CandidateCoin{ |
| 302 | Symbol: symbol, |
| 303 | Sources: []string{"static"}, |
| 304 | }) |
| 305 | } |
| 306 | |
| 307 | return e.filterExcludedCoins(candidates), nil |
| 308 | |
| 309 | case "ai500": |
| 310 | // Check use_ai500 flag; if false, fall back to static coins |
| 311 | if !coinSource.UseAI500 { |
| 312 | logger.Infof("⚠️ source_type is 'ai500' but use_ai500 is false, falling back to static coins") |
| 313 | for _, symbol := range coinSource.StaticCoins { |
| 314 | symbol = market.Normalize(symbol) |
| 315 | candidates = append(candidates, CandidateCoin{ |
| 316 | Symbol: symbol, |
| 317 | Sources: []string{"static"}, |
| 318 | }) |
| 319 | } |
| 320 | return e.filterExcludedCoins(candidates), nil |
| 321 | } |
| 322 | coins, err := e.getAI500Coins(coinSource.AI500Limit) |
| 323 | if err != nil { |
| 324 | return nil, err |
| 325 | } |
| 326 | // Empty list is a normal condition, return directly |
| 327 | return e.filterExcludedCoins(coins), nil |
| 328 | |
| 329 | case "oi_top": |
| 330 | // Check use_oi_top flag; if false, fall back to static coins |
| 331 | if !coinSource.UseOITop { |
| 332 | logger.Infof("⚠️ source_type is 'oi_top' but use_oi_top is false, falling back to static coins") |
| 333 | for _, symbol := range coinSource.StaticCoins { |
| 334 | symbol = market.Normalize(symbol) |
| 335 | candidates = append(candidates, CandidateCoin{ |
| 336 | Symbol: symbol, |
| 337 | Sources: []string{"static"}, |
| 338 | }) |
| 339 | } |
| 340 | return e.filterExcludedCoins(candidates), nil |
| 341 | } |
| 342 | coins, err := e.getOITopCoins(coinSource.OITopLimit) |
| 343 | if err != nil { |
| 344 | return nil, err |
| 345 | } |
| 346 | // Empty list is a normal condition, return directly |
| 347 | return e.filterExcludedCoins(coins), nil |
| 348 |
no test coverage detected