From 2e749bb7a8a77c1a2381a9632cd382e556b60954 Mon Sep 17 00:00:00 2001 From: Jui-Nan Lin Date: Tue, 25 May 2021 23:21:38 +0800 Subject: [PATCH] fix(ftx): always update since to avoid infinite loop --- pkg/exchange/ftx/exchange.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/exchange/ftx/exchange.go b/pkg/exchange/ftx/exchange.go index ccd3c3ba1..c61cefb4f 100644 --- a/pkg/exchange/ftx/exchange.go +++ b/pkg/exchange/ftx/exchange.go @@ -267,6 +267,9 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type }) for _, r := range resp.Result { + // always update since to avoid infinite loop + since = r.Time.Time + if _, ok := tradeIDs[r.TradeId]; ok { continue } @@ -276,7 +279,6 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type } tradeIDs[r.TradeId] = struct{}{} lastTradeID = r.TradeId - since = r.Time.Time t, err := toGlobalTrade(r) if err != nil {