mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
maxapi: add wallet type validation
This commit is contained in:
parent
79893f4b88
commit
9d459612a4
|
@ -2,6 +2,7 @@ package max
|
|||
|
||||
//go:generate -command GetRequest requestgen -method GET
|
||||
//go:generate -command PostRequest requestgen -method POST
|
||||
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||
|
||||
import (
|
||||
"github.com/c9s/requestgen"
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
type WalletType string
|
||||
|
||||
const (
|
||||
WalletTypeSpot = WalletType("spot")
|
||||
WalletTypeMargin = WalletType("m")
|
||||
WalletTypeSpot WalletType = "spot"
|
||||
WalletTypeMargin WalletType = "m"
|
||||
)
|
||||
|
||||
type Order = maxapi.Order
|
||||
|
|
|
@ -190,6 +190,17 @@ func (w *WalletCreateOrderRequest) GetSlugParameters() (map[string]interface{},
|
|||
}
|
||||
// END TEMPLATE check-required
|
||||
|
||||
// TEMPLATE check-valid-values
|
||||
switch walletType {
|
||||
case WalletTypeSpot, WalletTypeMargin:
|
||||
params["walletType"] = walletType
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("walletType value %v is invalid", walletType)
|
||||
|
||||
}
|
||||
// END TEMPLATE check-valid-values
|
||||
|
||||
// assign parameter of walletType
|
||||
params["walletType"] = walletType
|
||||
|
||||
|
|
|
@ -190,6 +190,17 @@ func (w *WalletGetOrderRequest) GetSlugParameters() (map[string]interface{}, err
|
|||
}
|
||||
// END TEMPLATE check-required
|
||||
|
||||
// TEMPLATE check-valid-values
|
||||
switch walletType {
|
||||
case WalletTypeSpot, WalletTypeMargin:
|
||||
params["walletType"] = walletType
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("walletType value %v is invalid", walletType)
|
||||
|
||||
}
|
||||
// END TEMPLATE check-valid-values
|
||||
|
||||
// assign parameter of walletType
|
||||
params["walletType"] = walletType
|
||||
|
||||
|
|
|
@ -119,6 +119,17 @@ func (w *WalletOrderCancelAllRequest) GetSlugParameters() (map[string]interface{
|
|||
}
|
||||
// END TEMPLATE check-required
|
||||
|
||||
// TEMPLATE check-valid-values
|
||||
switch walletType {
|
||||
case WalletTypeSpot, WalletTypeMargin:
|
||||
params["walletType"] = walletType
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("walletType value %v is invalid", walletType)
|
||||
|
||||
}
|
||||
// END TEMPLATE check-valid-values
|
||||
|
||||
// assign parameter of walletType
|
||||
params["walletType"] = walletType
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user