Skip to content

Commit

Permalink
add debug log statements for price updates
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Feb 24, 2024
1 parent a067102 commit 4e6f6f1
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/binance.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func BinancePriceUpdate(symbols set.Set[types.Symbol], logger zerolog.Logger) (r
rawPrices = make(map[types.Symbol]float64)
for _, ticker := range tickers {
rawPrices[types.Symbol(ticker.Symbol)] = ticker.Price
logger.Debug().Msgf("fetched price for %s on data source %s: %f", ticker.Symbol, Binance, ticker.Price)
}

return rawPrices, nil
Expand Down
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/bitfinex.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func BitfinexPriceUpdate(symbols set.Set[types.Symbol], logger zerolog.Logger) (
lastPrice := ticker[lastPriceIndex].(float64)

rawPrices[symbol] = lastPrice
logger.Debug().Msg(fmt.Sprintf("fetched price for %s on data source %s: %f", symbol, Bitfinex, lastPrice))
}

return rawPrices, nil
Expand Down
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/coingecko.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func extractPricesFromResponse(symbols set.Set[types.Symbol], response []byte, l
for symbol := range symbols {
if price, ok := result[string(symbol)]; ok {
rawPrices[symbol] = price.Price
logger.Debug().Msg(fmt.Sprintf("fetched price for %s on data source %s: %f", symbol, Coingecko, price.Price))
} else {
logger.Err(fmt.Errorf("failed to parse price for %s on data source %s", symbol, Coingecko)).Msg(string(response))
continue
Expand Down
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/coinmarketcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func getPricesFromResponse(symbols set.Set[types.Symbol], response []byte, logge
for symbol := range symbols {
if price, ok := cmcPrice[string(symbol)]; ok {
rawPrices[symbol] = price
logger.Debug().Msg(fmt.Sprintf("fetched price for %s on data source %s: %f", symbol, CoinMarketCap, price))
} else {
logger.Err(err).Msg(fmt.Sprintf("failed to parse price for %s on data source %s", symbol, CoinMarketCap))
continue
Expand Down
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/gateio.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func GateIoPriceUpdate(symbols set.Set[types.Symbol], logger zerolog.Logger) (ra
}

rawPrices[symbol] = price
logger.Debug().Msg(fmt.Sprintf("fetched price for %s on data source %s: %f", symbol, GateIo, price))
}

return rawPrices, nil
Expand Down
1 change: 1 addition & 0 deletions feeder/priceprovider/sources/okex.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func OkexPriceUpdate(symbols set.Set[types.Symbol], logger zerolog.Logger) (rawP
}

rawPrices[symbol] = price
logger.Debug().Msg(fmt.Sprintf("fetched price for %s on data source %s: %f", symbol, Okex, price))
}
return rawPrices, nil
}

0 comments on commit 4e6f6f1

Please sign in to comment.