okex: parse numbers as fixedpoints

This commit is contained in:
c9s 2021-05-23 13:45:17 +08:00
parent 8842208441
commit b1aadb4bf0

View File

@ -118,18 +118,18 @@ func (c *RestClient) newAuthenticatedRequest(method, refURL string, params url.V
type BalanceDetail struct { type BalanceDetail struct {
Currency string `json:"ccy"` Currency string `json:"ccy"`
Available string `json:"availEq"` Available fixedpoint.Value `json:"availEq"`
CashBalance string `json:"cashBal"` CashBalance fixedpoint.Value `json:"cashBal"`
OrderFrozen string `json:"ordFrozen"` OrderFrozen fixedpoint.Value `json:"ordFrozen"`
Frozen string `json:"frozenBal"` Frozen fixedpoint.Value `json:"frozenBal"`
Equity string `json:"eq"` Equity fixedpoint.Value `json:"eq"`
EquityInUSD string `json:"eqUsd"` EquityInUSD fixedpoint.Value `json:"eqUsd"`
UpdateTime string `json:"uTime"` UpdateTime types.MillisecondTimestamp `json:"uTime"`
UnrealizedProfitAndLoss string `json:"upl"` UnrealizedProfitAndLoss fixedpoint.Value `json:"upl"`
} }
type BalanceSummary struct { type BalanceSummary struct {
TotalEquityInUSD string `json:"totalEq"` TotalEquityInUSD fixedpoint.Value `json:"totalEq"`
UpdateTime string `json:"uTime"` UpdateTime string `json:"uTime"`
Details []BalanceDetail `json:"details"` Details []BalanceDetail `json:"details"`
} }
@ -161,9 +161,9 @@ func (c *RestClient) AccountBalances() (BalanceSummaryList, error) {
type AssetBalance struct { type AssetBalance struct {
Currency string `json:"ccy"` Currency string `json:"ccy"`
Balance string `json:"bal"` Balance fixedpoint.Value `json:"bal"`
Frozen string `json:"frozenBal,omitempty"` Frozen fixedpoint.Value `json:"frozenBal,omitempty"`
Available string `json:"availBal,omitempty"` Available fixedpoint.Value `json:"availBal,omitempty"`
} }
type AssetBalanceList []AssetBalance type AssetBalanceList []AssetBalance
@ -198,9 +198,9 @@ type AssetCurrency struct {
CanDeposit bool `json:"canDep"` CanDeposit bool `json:"canDep"`
CanWithdraw bool `json:"canWd"` CanWithdraw bool `json:"canWd"`
CanInternal bool `json:"canInternal"` CanInternal bool `json:"canInternal"`
MinWithdrawalFee string `json:"minFee"` MinWithdrawalFee fixedpoint.Value `json:"minFee"`
MaxWithdrawalFee string `json:"maxFee"` MaxWithdrawalFee fixedpoint.Value `json:"maxFee"`
MinWithdrawalThreshold string `json:"minWd"` MinWithdrawalThreshold fixedpoint.Value `json:"minWd"`
} }
func (c *RestClient) AssetCurrencies() ([]AssetCurrency, error) { func (c *RestClient) AssetCurrencies() ([]AssetCurrency, error) {