binance: add workaround for the myTrades api

This commit is contained in:
c9s 2022-12-09 17:09:03 +08:00
parent 85097840f1
commit ae678d1b3b

View File

@ -1413,11 +1413,11 @@ func (e *Exchange) queryMarginTrades(ctx context.Context, symbol string, options
req.Limit(1000)
}
// BINANCE seems to have an API bug, we can't use both fromId and the start time/end time
// BINANCE uses inclusive last trade ID
if options.LastTradeID > 0 {
req.FromID(int64(options.LastTradeID))
}
} else {
if options.StartTime != nil && options.EndTime != nil {
if options.EndTime.Sub(*options.StartTime) < 24*time.Hour {
req.StartTime(options.StartTime.UnixMilli())
@ -1430,6 +1430,7 @@ func (e *Exchange) queryMarginTrades(ctx context.Context, symbol string, options
} else if options.EndTime != nil {
req.EndTime(options.EndTime.UnixMilli())
}
}
remoteTrades, err = req.Do(ctx)
if err != nil {