max: fix order query limiter call and order state for query

This commit is contained in:
c9s 2022-01-24 23:45:56 +08:00
parent 0c0a12781a
commit 50871c1b61
2 changed files with 5 additions and 5 deletions

View File

@ -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,

View File

@ -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 {