mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
Merge pull request #1695 from c9s/c9s/max/fix-deposit-history-query-api
FIX: [max] fix GetDepositHistoryRequest
This commit is contained in:
commit
098de2245c
|
@ -846,6 +846,7 @@ func (e *Exchange) QueryWithdrawHistory(
|
|||
|
||||
withdraws, err := req.
|
||||
Timestamp(startTime).
|
||||
Order("asc").
|
||||
Limit(limit).
|
||||
Do(ctx)
|
||||
|
||||
|
@ -927,8 +928,8 @@ func (e *Exchange) QueryDepositHistory(
|
|||
}
|
||||
|
||||
deposits, err := req.
|
||||
From(startTime).
|
||||
To(endTime).
|
||||
Timestamp(startTime).
|
||||
Order("asc").
|
||||
Limit(limit).
|
||||
Do(ctx)
|
||||
|
||||
|
|
|
@ -133,14 +133,16 @@ type Deposit struct {
|
|||
UpdatedAt types.MillisecondTimestamp `json:"updated_at"`
|
||||
}
|
||||
|
||||
//go:generate GetRequest -url "v2/deposits" -type GetDepositHistoryRequest -responseType []Deposit
|
||||
//go:generate GetRequest -url "v3/deposits" -type GetDepositHistoryRequest -responseType []Deposit
|
||||
type GetDepositHistoryRequest struct {
|
||||
client requestgen.AuthenticatedAPIClient
|
||||
|
||||
currency *string `param:"currency"`
|
||||
from *time.Time `param:"from,seconds"` // seconds
|
||||
to *time.Time `param:"to,seconds"` // seconds
|
||||
timestamp *time.Time `param:"timestamp,milliseconds"` // seconds
|
||||
state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect
|
||||
|
||||
order *string `param:"order"`
|
||||
|
||||
limit *int `param:"limit"`
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by "requestgen -method GET -url v2/deposits -type GetDepositHistoryRequest -responseType []Deposit"; DO NOT EDIT.
|
||||
// Code generated by "requestgen -method GET -url v3/deposits -type GetDepositHistoryRequest -responseType []Deposit"; DO NOT EDIT.
|
||||
|
||||
package max
|
||||
|
||||
|
@ -18,13 +18,8 @@ func (g *GetDepositHistoryRequest) Currency(currency string) *GetDepositHistoryR
|
|||
return g
|
||||
}
|
||||
|
||||
func (g *GetDepositHistoryRequest) From(from time.Time) *GetDepositHistoryRequest {
|
||||
g.from = &from
|
||||
return g
|
||||
}
|
||||
|
||||
func (g *GetDepositHistoryRequest) To(to time.Time) *GetDepositHistoryRequest {
|
||||
g.to = &to
|
||||
func (g *GetDepositHistoryRequest) Timestamp(timestamp time.Time) *GetDepositHistoryRequest {
|
||||
g.timestamp = ×tamp
|
||||
return g
|
||||
}
|
||||
|
||||
|
@ -33,6 +28,11 @@ func (g *GetDepositHistoryRequest) State(state string) *GetDepositHistoryRequest
|
|||
return g
|
||||
}
|
||||
|
||||
func (g *GetDepositHistoryRequest) Order(order string) *GetDepositHistoryRequest {
|
||||
g.order = &order
|
||||
return g
|
||||
}
|
||||
|
||||
func (g *GetDepositHistoryRequest) Limit(limit int) *GetDepositHistoryRequest {
|
||||
g.limit = &limit
|
||||
return g
|
||||
|
@ -61,22 +61,13 @@ func (g *GetDepositHistoryRequest) GetParameters() (map[string]interface{}, erro
|
|||
params["currency"] = currency
|
||||
} 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)
|
||||
} else {
|
||||
}
|
||||
// check to field -> json key to
|
||||
if g.to != nil {
|
||||
to := *g.to
|
||||
|
||||
// assign parameter of to
|
||||
// convert time.Time to seconds time stamp
|
||||
params["to"] = strconv.FormatInt(to.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 state field -> json key state
|
||||
|
@ -87,6 +78,14 @@ func (g *GetDepositHistoryRequest) GetParameters() (map[string]interface{}, erro
|
|||
params["state"] = state
|
||||
} else {
|
||||
}
|
||||
// check order field -> json key order
|
||||
if g.order != nil {
|
||||
order := *g.order
|
||||
|
||||
// assign parameter of order
|
||||
params["order"] = order
|
||||
} else {
|
||||
}
|
||||
// check limit field -> json key limit
|
||||
if g.limit != nil {
|
||||
limit := *g.limit
|
||||
|
@ -180,7 +179,7 @@ func (g *GetDepositHistoryRequest) GetSlugsMap() (map[string]string, error) {
|
|||
|
||||
// GetPath returns the request path of the API
|
||||
func (g *GetDepositHistoryRequest) GetPath() string {
|
||||
return "v2/deposits"
|
||||
return "v3/deposits"
|
||||
}
|
||||
|
||||
// Do generates the request object and send the request object to the API endpoint
|
||||
|
|
Loading…
Reference in New Issue
Block a user