mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
Merge pull request #1365 from bailantaotao/edwin/make-jump-to-option-2
FEATURE: [batch] add jumpIfEmpty opts to closed order batch query
This commit is contained in:
commit
8ddb31b339
|
@ -12,7 +12,7 @@ type ClosedOrderBatchQuery struct {
|
||||||
types.ExchangeTradeHistoryService
|
types.ExchangeTradeHistoryService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *ClosedOrderBatchQuery) Query(ctx context.Context, symbol string, startTime, endTime time.Time, lastOrderID uint64) (c chan types.Order, errC chan error) {
|
func (q *ClosedOrderBatchQuery) Query(ctx context.Context, symbol string, startTime, endTime time.Time, lastOrderID uint64, opts ...Option) (c chan types.Order, errC chan error) {
|
||||||
query := &AsyncTimeRangedBatchQuery{
|
query := &AsyncTimeRangedBatchQuery{
|
||||||
Type: types.Order{},
|
Type: types.Order{},
|
||||||
Q: func(startTime, endTime time.Time) (interface{}, error) {
|
Q: func(startTime, endTime time.Time) (interface{}, error) {
|
||||||
|
@ -32,6 +32,10 @@ func (q *ClosedOrderBatchQuery) Query(ctx context.Context, symbol string, startT
|
||||||
JumpIfEmpty: 30 * 24 * time.Hour,
|
JumpIfEmpty: 30 * 24 * time.Hour,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(query)
|
||||||
|
}
|
||||||
|
|
||||||
c = make(chan types.Order, 100)
|
c = make(chan types.Order, 100)
|
||||||
errC = query.Query(ctx, c, startTime, endTime)
|
errC = query.Query(ctx, c, startTime, endTime)
|
||||||
return c, errC
|
return c, errC
|
||||||
|
|
Loading…
Reference in New Issue
Block a user