mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45: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 GetRequest requestgen -method GET
|
||||||
//go:generate -command PostRequest requestgen -method POST
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/c9s/requestgen"
|
"github.com/c9s/requestgen"
|
||||||
|
|
|
@ -13,8 +13,8 @@ import (
|
||||||
type WalletType string
|
type WalletType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
WalletTypeSpot = WalletType("spot")
|
WalletTypeSpot WalletType = "spot"
|
||||||
WalletTypeMargin = WalletType("m")
|
WalletTypeMargin WalletType = "m"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Order = maxapi.Order
|
type Order = maxapi.Order
|
||||||
|
|
|
@ -190,6 +190,17 @@ func (w *WalletCreateOrderRequest) GetSlugParameters() (map[string]interface{},
|
||||||
}
|
}
|
||||||
// END TEMPLATE check-required
|
// 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
|
// assign parameter of walletType
|
||||||
params["walletType"] = walletType
|
params["walletType"] = walletType
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,17 @@ func (w *WalletGetOrderRequest) GetSlugParameters() (map[string]interface{}, err
|
||||||
}
|
}
|
||||||
// END TEMPLATE check-required
|
// 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
|
// assign parameter of walletType
|
||||||
params["walletType"] = walletType
|
params["walletType"] = walletType
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,17 @@ func (w *WalletOrderCancelAllRequest) GetSlugParameters() (map[string]interface{
|
||||||
}
|
}
|
||||||
// END TEMPLATE check-required
|
// 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
|
// assign parameter of walletType
|
||||||
params["walletType"] = walletType
|
params["walletType"] = walletType
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user