Skip to content

Commit 22b0221

Browse files
committed
optimize bybit resp processing
1 parent 505ca11 commit 22b0221

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

feeder/priceprovider/sources/bybit.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ func BybitPriceUpdate(symbols set.Set[types.Symbol], logger zerolog.Logger) (raw
6666

6767
for _, ticker := range response.Data.List {
6868
symbol := types.Symbol(ticker.Symbol)
69+
if !symbols.Has(symbol) {
70+
continue
71+
}
72+
6973
price, err := strconv.ParseFloat(ticker.Price, 64)
7074
if err != nil {
7175
logger.Err(err).Msgf("failed to parse price for %s on data source %s", symbol, Bybit)
7276
continue
7377
}
74-
75-
if _, ok := symbols[symbol]; ok {
76-
rawPrices[symbol] = price
77-
}
78+
rawPrices[symbol] = price
7879
}
7980
logger.Debug().Msgf("fetched prices for %s on data source %s: %v", symbols, Bybit, rawPrices)
8081
metrics.PriceSourceCounter.WithLabelValues(Bybit, "true").Inc()

0 commit comments

Comments
 (0)