mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
pkg/exchange: add jumpIfEmpty opts to closed order batch query
This commit is contained in:
parent
881db49b70
commit
55d444d86a
|
@ -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