From 6c0cc71c1c9d85d40dea4ca338eb7a16f3dccba9 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 9 Dec 2022 17:28:06 +0800 Subject: [PATCH] binance: avoid using fromId and timeRange at the same time --- pkg/exchange/binance/exchange.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index 918b85c2f..cba2ed274 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -1506,19 +1506,19 @@ func (e *Exchange) querySpotTrades(ctx context.Context, symbol string, options * // BINANCE uses inclusive last trade ID if options.LastTradeID > 0 { req.FromID(options.LastTradeID) - } - - if options.StartTime != nil && options.EndTime != nil { - if options.EndTime.Sub(*options.StartTime) < 24*time.Hour { + } else { + if options.StartTime != nil && options.EndTime != nil { + if options.EndTime.Sub(*options.StartTime) < 24*time.Hour { + req.StartTime(*options.StartTime) + req.EndTime(*options.EndTime) + } else { + req.StartTime(*options.StartTime) + } + } else if options.StartTime != nil { req.StartTime(*options.StartTime) + } else if options.EndTime != nil { req.EndTime(*options.EndTime) - } else { - req.StartTime(*options.StartTime) } - } else if options.StartTime != nil { - req.StartTime(*options.StartTime) - } else if options.EndTime != nil { - req.EndTime(*options.EndTime) } if options.Limit > 0 {