From b1aadb4bf00bdb3139bafcd7085e0cec8f0226c4 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 23 May 2021 13:45:17 +0800 Subject: [PATCH] okex: parse numbers as fixedpoints --- pkg/exchange/okex/okexapi/client.go | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/pkg/exchange/okex/okexapi/client.go b/pkg/exchange/okex/okexapi/client.go index 7dc042eba..383aa607d 100644 --- a/pkg/exchange/okex/okexapi/client.go +++ b/pkg/exchange/okex/okexapi/client.go @@ -117,21 +117,21 @@ func (c *RestClient) newAuthenticatedRequest(method, refURL string, params url.V } type BalanceDetail struct { - Currency string `json:"ccy"` - Available string `json:"availEq"` - CashBalance string `json:"cashBal"` - OrderFrozen string `json:"ordFrozen"` - Frozen string `json:"frozenBal"` - Equity string `json:"eq"` - EquityInUSD string `json:"eqUsd"` - UpdateTime string `json:"uTime"` - UnrealizedProfitAndLoss string `json:"upl"` + Currency string `json:"ccy"` + Available fixedpoint.Value `json:"availEq"` + CashBalance fixedpoint.Value `json:"cashBal"` + OrderFrozen fixedpoint.Value `json:"ordFrozen"` + Frozen fixedpoint.Value `json:"frozenBal"` + Equity fixedpoint.Value `json:"eq"` + EquityInUSD fixedpoint.Value `json:"eqUsd"` + UpdateTime types.MillisecondTimestamp `json:"uTime"` + UnrealizedProfitAndLoss fixedpoint.Value `json:"upl"` } type BalanceSummary struct { - TotalEquityInUSD string `json:"totalEq"` - UpdateTime string `json:"uTime"` - Details []BalanceDetail `json:"details"` + TotalEquityInUSD fixedpoint.Value `json:"totalEq"` + UpdateTime string `json:"uTime"` + Details []BalanceDetail `json:"details"` } type BalanceSummaryList []BalanceSummary @@ -160,10 +160,10 @@ func (c *RestClient) AccountBalances() (BalanceSummaryList, error) { } type AssetBalance struct { - Currency string `json:"ccy"` - Balance string `json:"bal"` - Frozen string `json:"frozenBal,omitempty"` - Available string `json:"availBal,omitempty"` + Currency string `json:"ccy"` + Balance fixedpoint.Value `json:"bal"` + Frozen fixedpoint.Value `json:"frozenBal,omitempty"` + Available fixedpoint.Value `json:"availBal,omitempty"` } type AssetBalanceList []AssetBalance @@ -192,15 +192,15 @@ func (c *RestClient) AssetBalances() (AssetBalanceList, error) { } type AssetCurrency struct { - Currency string `json:"ccy"` - Name string `json:"name"` - Chain string `json:"chain"` - CanDeposit bool `json:"canDep"` - CanWithdraw bool `json:"canWd"` - CanInternal bool `json:"canInternal"` - MinWithdrawalFee string `json:"minFee"` - MaxWithdrawalFee string `json:"maxFee"` - MinWithdrawalThreshold string `json:"minWd"` + Currency string `json:"ccy"` + Name string `json:"name"` + Chain string `json:"chain"` + CanDeposit bool `json:"canDep"` + CanWithdraw bool `json:"canWd"` + CanInternal bool `json:"canInternal"` + MinWithdrawalFee fixedpoint.Value `json:"minFee"` + MaxWithdrawalFee fixedpoint.Value `json:"maxFee"` + MinWithdrawalThreshold fixedpoint.Value `json:"minWd"` } func (c *RestClient) AssetCurrencies() ([]AssetCurrency, error) {