mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1694 from c9s/c9s/max/fix-withdrawal-query-api
FIX: [max] fix max withdrawal api parameters
This commit is contained in:
commit
7488a1069f
|
@ -845,8 +845,7 @@ func (e *Exchange) QueryWithdrawHistory(
|
||||||
}
|
}
|
||||||
|
|
||||||
withdraws, err := req.
|
withdraws, err := req.
|
||||||
From(startTime).
|
Timestamp(startTime).
|
||||||
To(endTime).
|
|
||||||
Limit(limit).
|
Limit(limit).
|
||||||
Do(ctx)
|
Do(ctx)
|
||||||
|
|
||||||
|
|
|
@ -205,11 +205,15 @@ type Withdraw struct {
|
||||||
type GetWithdrawHistoryRequest struct {
|
type GetWithdrawHistoryRequest struct {
|
||||||
client requestgen.AuthenticatedAPIClient
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
currency *string `param:"currency"`
|
currency *string `param:"currency"`
|
||||||
state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect
|
state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect
|
||||||
from *time.Time `param:"from,seconds"` // seconds
|
timestamp *time.Time `param:"timestamp,milliseconds"` // milli-seconds
|
||||||
to *time.Time `param:"to,seconds"` // seconds
|
|
||||||
limit *int `param:"limit"`
|
// order could be desc or asc
|
||||||
|
order *string `param:"order"`
|
||||||
|
|
||||||
|
// limit's default = 50
|
||||||
|
limit *int `param:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RestClient) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest {
|
func (c *RestClient) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest {
|
||||||
|
|
|
@ -23,13 +23,13 @@ func (g *GetWithdrawHistoryRequest) State(state string) *GetWithdrawHistoryReque
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GetWithdrawHistoryRequest) From(from time.Time) *GetWithdrawHistoryRequest {
|
func (g *GetWithdrawHistoryRequest) Timestamp(timestamp time.Time) *GetWithdrawHistoryRequest {
|
||||||
g.from = &from
|
g.timestamp = ×tamp
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GetWithdrawHistoryRequest) To(to time.Time) *GetWithdrawHistoryRequest {
|
func (g *GetWithdrawHistoryRequest) Order(order string) *GetWithdrawHistoryRequest {
|
||||||
g.to = &to
|
g.order = &order
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,22 +69,21 @@ func (g *GetWithdrawHistoryRequest) GetParameters() (map[string]interface{}, err
|
||||||
params["state"] = state
|
params["state"] = state
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
// check from field -> json key from
|
// check timestamp field -> json key timestamp
|
||||||
if g.from != nil {
|
if g.timestamp != nil {
|
||||||
from := *g.from
|
timestamp := *g.timestamp
|
||||||
|
|
||||||
// assign parameter of from
|
// assign parameter of timestamp
|
||||||
// convert time.Time to seconds time stamp
|
// convert time.Time to milliseconds time stamp
|
||||||
params["from"] = strconv.FormatInt(from.Unix(), 10)
|
params["timestamp"] = strconv.FormatInt(timestamp.UnixNano()/int64(time.Millisecond), 10)
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
// check to field -> json key to
|
// check order field -> json key order
|
||||||
if g.to != nil {
|
if g.order != nil {
|
||||||
to := *g.to
|
order := *g.order
|
||||||
|
|
||||||
// assign parameter of to
|
// assign parameter of order
|
||||||
// convert time.Time to seconds time stamp
|
params["order"] = order
|
||||||
params["to"] = strconv.FormatInt(to.Unix(), 10)
|
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
// check limit field -> json key limit
|
// check limit field -> json key limit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user