mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
start time is required for syncing trades
This commit is contained in:
parent
83053ab807
commit
ab0519c4be
|
@ -2,6 +2,7 @@ package batch
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
|
@ -21,17 +22,26 @@ func (e TradeBatchQuery) Query(ctx context.Context, symbol string, options *type
|
|||
|
||||
tradeHistoryService, ok := e.Exchange.(types.ExchangeTradeHistoryService)
|
||||
if !ok {
|
||||
defer close(c)
|
||||
defer close(errC)
|
||||
close(errC)
|
||||
close(c)
|
||||
// skip exchanges that does not support trading history services
|
||||
logrus.Warnf("exchange %s does not implement ExchangeTradeHistoryService, skip syncing closed orders (TradeBatchQuery.Query)", e.Exchange.Name())
|
||||
return c, errC
|
||||
}
|
||||
|
||||
if options.StartTime == nil {
|
||||
|
||||
errC <- errors.New("start time is required for syncing trades")
|
||||
close(errC)
|
||||
close(c)
|
||||
return c, errC
|
||||
}
|
||||
|
||||
var lastTradeID = options.LastTradeID
|
||||
var startTime = *options.StartTime
|
||||
var endTime = *options.EndTime
|
||||
|
||||
|
||||
go func() {
|
||||
limiter := rate.NewLimiter(rate.Every(5*time.Second), 2) // from binance (original 1200, use 1000 for safety)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user