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.
|
||||
From(startTime).
|
||||
To(endTime).
|
||||
Timestamp(startTime).
|
||||
Limit(limit).
|
||||
Do(ctx)
|
||||
|
||||
|
|
|
@ -207,8 +207,12 @@ type GetWithdrawHistoryRequest struct {
|
|||
|
||||
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
|
||||
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"`
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user