mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1278 from c9s/c9s/strategy-deposit2transfer
FEATURE: [max] update deposit states and add more fields to deposit
This commit is contained in:
commit
43cd25c9f9
|
@ -262,24 +262,24 @@ func toGlobalTradeV2(t max.Trade) (*types.Trade, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toGlobalDepositStatus(a string) types.DepositStatus {
|
||||
func toGlobalDepositStatus(a max.DepositState) types.DepositStatus {
|
||||
switch a {
|
||||
case "submitting", "submitted", "checking":
|
||||
|
||||
case max.DepositStateSubmitting, max.DepositStateSubmitted, max.DepositStatePending, max.DepositStateChecking:
|
||||
return types.DepositPending
|
||||
|
||||
case "accepted":
|
||||
return types.DepositSuccess
|
||||
|
||||
case "rejected":
|
||||
case max.DepositStateRejected:
|
||||
return types.DepositRejected
|
||||
|
||||
case "canceled":
|
||||
case max.DepositStateCancelled:
|
||||
return types.DepositCancelled
|
||||
|
||||
case "suspect", "refunded":
|
||||
|
||||
case max.DepositStateAccepted:
|
||||
return types.DepositSuccess
|
||||
}
|
||||
|
||||
// other states goes to this
|
||||
// max.DepositStateSuspect, max.DepositStateSuspended
|
||||
return types.DepositStatus(a)
|
||||
}
|
||||
|
||||
|
|
|
@ -781,10 +781,11 @@ func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since,
|
|||
Time: types.Time(d.CreatedAt),
|
||||
Amount: d.Amount,
|
||||
Asset: toGlobalCurrency(d.Currency),
|
||||
Address: "", // not supported
|
||||
Address: d.Address, // not supported
|
||||
AddressTag: "", // not supported
|
||||
TransactionID: d.TxID,
|
||||
Status: toGlobalDepositStatus(d.State),
|
||||
Confirmation: "",
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -106,14 +106,31 @@ func (c *RestClient) NewGetAccountsRequest() *GetAccountsRequest {
|
|||
return &GetAccountsRequest{client: c}
|
||||
}
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
type Deposit struct {
|
||||
Currency string `json:"currency"`
|
||||
Currency string `json:"currency"` // "eth"
|
||||
CurrencyVersion string `json:"currency_version"` // "eth"
|
||||
NetworkProtocol string `json:"network_protocol"` // "ethereum-erc20"
|
||||
Amount fixedpoint.Value `json:"amount"`
|
||||
Fee fixedpoint.Value `json:"fee"`
|
||||
TxID string `json:"txid"`
|
||||
State string `json:"state"`
|
||||
State DepositState `json:"state"`
|
||||
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"`
|
||||
}
|
||||
|
@ -135,6 +152,14 @@ func (c *RestClient) NewGetDepositHistoryRequest() *GetDepositHistoryRequest {
|
|||
}
|
||||
}
|
||||
|
||||
// submitted -> accepted -> processing -> sent -> confirmed
|
||||
type WithdrawState string
|
||||
|
||||
const (
|
||||
WithdrawStateSubmitting WithdrawState = "submitting"
|
||||
WithdrawStateConfirmed WithdrawState = "confirmed"
|
||||
)
|
||||
|
||||
type Withdraw struct {
|
||||
UUID string `json:"uuid"`
|
||||
Currency string `json:"currency"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user