diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index 873eed3ef..364329ba0 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -845,8 +845,7 @@ func (e *Exchange) QueryWithdrawHistory( } withdraws, err := req. - From(startTime). - To(endTime). + Timestamp(startTime). Limit(limit). Do(ctx) diff --git a/pkg/exchange/max/maxapi/account.go b/pkg/exchange/max/maxapi/account.go index be176f923..2e1e38f82 100644 --- a/pkg/exchange/max/maxapi/account.go +++ b/pkg/exchange/max/maxapi/account.go @@ -205,11 +205,15 @@ type Withdraw struct { type GetWithdrawHistoryRequest struct { client requestgen.AuthenticatedAPIClient - currency *string `param:"currency"` - state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect - from *time.Time `param:"from,seconds"` // seconds - to *time.Time `param:"to,seconds"` // seconds - limit *int `param:"limit"` + currency *string `param:"currency"` + state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect + timestamp *time.Time `param:"timestamp,milliseconds"` // milli-seconds + + // order could be desc or asc + order *string `param:"order"` + + // limit's default = 50 + limit *int `param:"limit"` } func (c *RestClient) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest { diff --git a/pkg/exchange/max/maxapi/get_withdraw_history_request_requestgen.go b/pkg/exchange/max/maxapi/get_withdraw_history_request_requestgen.go index 91502e9fc..2cc2127a7 100644 --- a/pkg/exchange/max/maxapi/get_withdraw_history_request_requestgen.go +++ b/pkg/exchange/max/maxapi/get_withdraw_history_request_requestgen.go @@ -23,13 +23,13 @@ func (g *GetWithdrawHistoryRequest) State(state string) *GetWithdrawHistoryReque return g } -func (g *GetWithdrawHistoryRequest) From(from time.Time) *GetWithdrawHistoryRequest { - g.from = &from +func (g *GetWithdrawHistoryRequest) Timestamp(timestamp time.Time) *GetWithdrawHistoryRequest { + g.timestamp = ×tamp return g } -func (g *GetWithdrawHistoryRequest) To(to time.Time) *GetWithdrawHistoryRequest { - g.to = &to +func (g *GetWithdrawHistoryRequest) Order(order string) *GetWithdrawHistoryRequest { + g.order = &order return g } @@ -69,22 +69,21 @@ func (g *GetWithdrawHistoryRequest) GetParameters() (map[string]interface{}, err params["state"] = state } else { } - // check from field -> json key from - if g.from != nil { - from := *g.from + // check timestamp field -> json key timestamp + if g.timestamp != nil { + timestamp := *g.timestamp - // assign parameter of from - // convert time.Time to seconds time stamp - params["from"] = strconv.FormatInt(from.Unix(), 10) + // assign parameter of timestamp + // convert time.Time to milliseconds time stamp + params["timestamp"] = strconv.FormatInt(timestamp.UnixNano()/int64(time.Millisecond), 10) } else { } - // check to field -> json key to - if g.to != nil { - to := *g.to + // check order field -> json key order + if g.order != nil { + order := *g.order - // assign parameter of to - // convert time.Time to seconds time stamp - params["to"] = strconv.FormatInt(to.Unix(), 10) + // assign parameter of order + params["order"] = order } else { } // check limit field -> json key limit