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

Method FetchVergexDataBatch

kernel/engine.go:1113–1218  ·  view source on GitHub ↗
(ctx context.Context, symbols []string)

Source from the content-addressed store, hash-verified

1111}
1112
1113func (e *StrategyEngine) FetchVergexDataBatch(ctx context.Context, symbols []string) map[string]*vergex.MarketAnalysis {
1114 result := make(map[string]*vergex.MarketAnalysis)
1115 if e == nil || e.config == nil || e.config.CoinSource.SourceType != "vergex_signal" {
1116 return result
1117 }
1118 if e.vergexClient == nil {
1119 logger.Warnf("⚠️ Vergex signal data skipped: claw402 wallet is not configured")
1120 return result
1121 }
1122 if ctx == nil {
1123 ctx = context.Background()
1124 }
1125
1126 source := e.config.CoinSource
1127 marketType := source.VergexMarketType
1128 if marketType == "" {
1129 marketType = vergex.DefaultMarketType
1130 }
1131 chain := source.VergexChain
1132 chain = vergex.QueryChain(chain)
1133
1134 seen := make(map[string]bool)
1135 limited := make([]string, 0, store.MaxCandidateCoins)
1136 for _, symbol := range symbols {
1137 symbol = vergexDetailSymbolForLookup(marketType, symbol)
1138 if symbol == "" {
1139 continue
1140 }
1141 if seen[symbol] {
1142 continue
1143 }
1144 seen[symbol] = true
1145 limited = append(limited, symbol)
1146 if len(limited) >= store.MaxCandidateCoins+store.MaxPositions {
1147 break
1148 }
1149 }
1150
1151 type vergexAnalysisResult struct {
1152 symbol string
1153 analysis *vergex.MarketAnalysis
1154 }
1155
1156 resultCh := make(chan vergexAnalysisResult, len(limited))
1157 var wg sync.WaitGroup
1158 sem := make(chan struct{}, vergexDetailSymbolConcurrency)
1159 for _, symbol := range limited {
1160 symbol := symbol
1161 querySymbol := vergex.QuerySymbol(symbol)
1162 if querySymbol == "" {
1163 continue
1164 }
1165 itemMarketType := marketType
1166 itemCategory := ""
1167 var ranking *vergex.SignalRankItem
1168 if cached, ok := e.vergexRankingCache[symbol]; ok && cached != nil {
1169 ranking = cached
1170 if cached.MarketType != "" {

Callers 2

handleStrategyTestRunMethod · 0.95

Calls 8

WarnfFunction · 0.92
QueryChainFunction · 0.92
QuerySymbolFunction · 0.92
InfofFunction · 0.92
AddMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected