mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
binance: add workaround for the myTrades api
This commit is contained in:
parent
85097840f1
commit
ae678d1b3b
|
@ -1413,22 +1413,23 @@ func (e *Exchange) queryMarginTrades(ctx context.Context, symbol string, options
|
||||||
req.Limit(1000)
|
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
|
// BINANCE uses inclusive last trade ID
|
||||||
if options.LastTradeID > 0 {
|
if options.LastTradeID > 0 {
|
||||||
req.FromID(int64(options.LastTradeID))
|
req.FromID(int64(options.LastTradeID))
|
||||||
}
|
} else {
|
||||||
|
if options.StartTime != nil && options.EndTime != nil {
|
||||||
if options.StartTime != nil && options.EndTime != nil {
|
if options.EndTime.Sub(*options.StartTime) < 24*time.Hour {
|
||||||
if options.EndTime.Sub(*options.StartTime) < 24*time.Hour {
|
req.StartTime(options.StartTime.UnixMilli())
|
||||||
|
req.EndTime(options.EndTime.UnixMilli())
|
||||||
|
} else {
|
||||||
|
req.StartTime(options.StartTime.UnixMilli())
|
||||||
|
}
|
||||||
|
} else if options.StartTime != nil {
|
||||||
req.StartTime(options.StartTime.UnixMilli())
|
req.StartTime(options.StartTime.UnixMilli())
|
||||||
|
} else if options.EndTime != nil {
|
||||||
req.EndTime(options.EndTime.UnixMilli())
|
req.EndTime(options.EndTime.UnixMilli())
|
||||||
} else {
|
|
||||||
req.StartTime(options.StartTime.UnixMilli())
|
|
||||||
}
|
}
|
||||||
} else if options.StartTime != nil {
|
|
||||||
req.StartTime(options.StartTime.UnixMilli())
|
|
||||||
} else if options.EndTime != nil {
|
|
||||||
req.EndTime(options.EndTime.UnixMilli())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteTrades, err = req.Do(ctx)
|
remoteTrades, err = req.Do(ctx)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user