MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / GetCandidateCoins

Method GetCandidateCoins

kernel/engine.go:291–504  ·  view source on GitHub ↗

============================================================================ Candidate Coins ============================================================================ GetCandidateCoins gets candidate coins based on strategy configuration

()

Source from the content-addressed store, hash-verified

289
290// GetCandidateCoins gets candidate coins based on strategy configuration
291func (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

Callers 1

handleStrategyTestRunMethod · 0.95

Calls 11

filterExcludedCoinsMethod · 0.95
getAI500CoinsMethod · 0.95
getOITopCoinsMethod · 0.95
getOILowCoinsMethod · 0.95
getHyperAllCoinsMethod · 0.95
getHyperMainCoinsMethod · 0.95
getHyperRankCoinsMethod · 0.95
getVergexSignalCoinsMethod · 0.95
NormalizeFunction · 0.92
InfofFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected