-
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1814 from c9s/c9s/maxapi/update-deposit-info
IMPROVE: [maxapi] update deposit info fields
- Loading branch information
Showing
3 changed files
with
75 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package max | ||
|
||
//go:generate -command GetRequest requestgen -method GET | ||
//go:generate -command PostRequest requestgen -method POST | ||
//go:generate -command DeleteRequest requestgen -method DELETE | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/c9s/requestgen" | ||
|
||
"github.com/c9s/bbgo/pkg/fixedpoint" | ||
"github.com/c9s/bbgo/pkg/types" | ||
) | ||
|
||
type DepositState string | ||
|
||
const ( | ||
DepositStateSubmitting DepositState = "submitting" | ||
DepositStateCancelled DepositState = "cancelled" | ||
DepositStateSubmitted DepositState = "submitted" | ||
DepositStatePending DepositState = "pending" | ||
DepositStateSuspect DepositState = "suspect" | ||
DepositStateRejected DepositState = "rejected" | ||
DepositStateSuspended DepositState = "suspended" | ||
DepositStateAccepted DepositState = "accepted" | ||
DepositStateChecking DepositState = "checking" | ||
|
||
// v3 states | ||
DepositStateProcessing DepositState = "processing" | ||
DepositStateFailed DepositState = "failed" | ||
DepositStateDone DepositState = "done" | ||
) | ||
|
||
type Deposit struct { | ||
Currency string `json:"currency"` // "eth" | ||
NetworkProtocol string `json:"network_protocol"` // "ethereum-erc20" | ||
Amount fixedpoint.Value `json:"amount"` | ||
Fee fixedpoint.Value `json:"fee"` | ||
TxID string `json:"txid"` | ||
State DepositState `json:"state"` | ||
StateReason string `json:"state_reason"` | ||
Status string `json:"status"` | ||
Confirmations int64 `json:"confirmations"` | ||
Address string `json:"to_address"` // 0x5c7d23d516f120d322fc7b116386b7e491739138 | ||
CreatedAt types.MillisecondTimestamp `json:"created_at"` | ||
UpdatedAt types.MillisecondTimestamp `json:"updated_at"` | ||
} | ||
|
||
//go:generate GetRequest -url "v3/deposits" -type GetDepositHistoryRequest -responseType []Deposit | ||
type GetDepositHistoryRequest struct { | ||
client requestgen.AuthenticatedAPIClient | ||
|
||
currency *string `param:"currency"` | ||
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"` | ||
} | ||
|
||
func (c *RestClient) NewGetDepositHistoryRequest() *GetDepositHistoryRequest { | ||
return &GetDepositHistoryRequest{ | ||
client: c, | ||
} | ||
} |