mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
max: fix order query limiter call and order state for query
This commit is contained in:
parent
0c0a12781a
commit
50871c1b61
|
@ -175,10 +175,6 @@ func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders [
|
|||
|
||||
// lastOrderID is not supported on MAX
|
||||
func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error) {
|
||||
if err := closedOrderQueryLimiter.Wait(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
limit := 1000 // max limit = 1000, default 100
|
||||
orderIDs := make(map[uint64]struct{}, limit*2)
|
||||
|
||||
|
@ -186,6 +182,10 @@ func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since,
|
|||
|
||||
page := 1
|
||||
for {
|
||||
if err := closedOrderQueryLimiter.Wait(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Infof("querying %s closed orders from page %d ~ ", symbol, page)
|
||||
maxOrders, err := e.client.OrderService.Closed(toLocalSymbol(symbol), maxapi.QueryOrderOptions{
|
||||
Limit: limit,
|
||||
|
|
|
@ -103,7 +103,7 @@ type Order struct {
|
|||
func (s *OrderService) Closed(market string, options QueryOrderOptions) ([]Order, error) {
|
||||
payload := map[string]interface{}{
|
||||
"market": market,
|
||||
"state": []OrderState{OrderStateDone},
|
||||
"state": []OrderState{OrderStateDone, OrderStateCancel},
|
||||
}
|
||||
|
||||
if options.GroupID > 0 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user