pkg/exchange: add jumpIfEmpty opts to closed order batch query

This commit is contained in:
Edwin 2023-10-26 09:31:25 +08:00
parent 881db49b70
commit 55d444d86a

View File

@ -12,7 +12,7 @@ type ClosedOrderBatchQuery struct {
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{
Type: types.Order{},
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,
}
for _, opt := range opts {
opt(query)
}
c = make(chan types.Order, 100)
errC = query.Query(ctx, c, startTime, endTime)
return c, errC