max: group the request building statement

This commit is contained in:
c9s 2023-11-14 16:09:47 +08:00
parent d5fe13272e
commit 3cfc810f8d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -24,6 +24,7 @@ var log = logrus.WithField("exchange", "max")
func init() { func init() {
_ = types.ExchangeTradeHistoryService(&Exchange{}) _ = types.ExchangeTradeHistoryService(&Exchange{})
} }
type Exchange struct { type Exchange struct {
@ -290,13 +291,14 @@ func (e *Exchange) queryClosedOrdersByLastOrderID(
walletType = maxapi.WalletTypeMargin walletType = maxapi.WalletTypeMargin
} }
req := e.v3client.NewGetWalletOrderHistoryRequest(walletType).Market(market)
if lastOrderID == 0 { if lastOrderID == 0 {
lastOrderID = 1 lastOrderID = 1
} }
req.FromID(lastOrderID) req := e.v3client.NewGetWalletOrderHistoryRequest(walletType).
req.Limit(1000) Market(market).
FromID(lastOrderID).
Limit(1000)
maxOrders, err := req.Do(ctx) maxOrders, err := req.Do(ctx)
if err != nil { if err != nil {