diff --git a/pkg/pricefiller/price_fillter.go b/pkg/pricefiller/price_fillter.go index 4215da2..71e5ca8 100644 --- a/pkg/pricefiller/price_fillter.go +++ b/pkg/pricefiller/price_fillter.go @@ -17,9 +17,11 @@ const ( NetworkETHChanID = 1 NetworkETH = "ETH" updateAllCoinInfoInterval = time.Hour - backfillTradeLogsPriceInterval = time.Hour + backfillTradeLogsPriceInterval = 30 * time.Second + backfillTradeLogsLimit = 60 addressETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" coinUSDT = "USDT" + invalidSymbolErrString = " code=-1121, msg=Invalid symbol." ) var ( @@ -136,7 +138,7 @@ func (p *PriceFiller) runBackFillTradelogPriceRoutine() { for range ticker.C { tradeLogs, err := p.s.Get(storage.TradeLogsQuery{ State: string(storage.TradeLogStateNew), - Limit: 100, + Limit: backfillTradeLogsLimit, }) if err != nil { p.l.Errorw("Failed to get tradeLogs", "err", err) @@ -157,8 +159,10 @@ func (p *PriceFiller) fullFillTradeLog(tradeLog storage.TradeLog) (storage.Trade makerPrice, makerUsdAmount, err := p.getPriceAndAmountUsd(strings.ToLower(tradeLog.MakerToken), tradeLog.MakerTokenAmount, int64(tradeLog.Timestamp)) if err != nil { - p.l.Errorw("Failed to getPriceAndAmountUsd for maker", "err", err) - return tradeLog, err + if err.Error() != invalidSymbolErrString { + p.l.Errorw("Failed to getPriceAndAmountUsd for maker", "err", err) + return tradeLog, err + } } tradeLog.MakerTokenPrice = makerPrice @@ -167,8 +171,10 @@ func (p *PriceFiller) fullFillTradeLog(tradeLog storage.TradeLog) (storage.Trade takerPrice, takerUsdAmount, err := p.getPriceAndAmountUsd(strings.ToLower(tradeLog.TakerToken), tradeLog.TakerTokenAmount, int64(tradeLog.Timestamp)) if err != nil { - p.l.Errorw("Failed to getPriceAndAmountUsd for taker", "err", err) - return tradeLog, err + if err.Error() != invalidSymbolErrString { + p.l.Errorw("Failed to getPriceAndAmountUsd for taker", "err", err) + return tradeLog, err + } } tradeLog.TakerTokenPrice = takerPrice