From 680261527c0bc6f62047e4d2b177975bac225d64 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 11 Apr 2022 15:39:03 +0800 Subject: [PATCH] binance: fix closed order query --- pkg/exchange/binance/exchange.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index 76c40131c..8e7841abb 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -600,8 +600,10 @@ func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, if lastOrderID > 0 { req.OrderID(int64(lastOrderID)) } else { - req.StartTime(since.UnixNano() / int64(time.Millisecond)). - EndTime(until.UnixNano() / int64(time.Millisecond)) + req.StartTime(since.UnixNano() / int64(time.Millisecond)) + if until.Sub(since) < 24*time.Hour { + req.EndTime(until.UnixNano() / int64(time.Millisecond)) + } } binanceOrders, err := req.Do(ctx) @@ -619,8 +621,7 @@ func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, req.OrderID(int64(lastOrderID)) } else { req.StartTime(since.UnixNano() / int64(time.Millisecond)) - - if until.Sub(since) <= 24*time.Hour { + if until.Sub(since) < 24*time.Hour { req.EndTime(until.UnixNano() / int64(time.Millisecond)) } } @@ -642,8 +643,7 @@ func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, req.OrderID(int64(lastOrderID)) } else { req.StartTime(since.UnixNano() / int64(time.Millisecond)) - - if until.Sub(since) <= 24*time.Hour { + if until.Sub(since) < 24*time.Hour { req.EndTime(until.UnixNano() / int64(time.Millisecond)) } }