Types: Switch convert.StringToFloat64 to types.Number (#1415)

* Types: Add Number type

* Types: Switch StringToFloat64 for Number

This change mostly just renames the type.
convert package and StringToFloat64 represent actions, not types,
and make it misleading to use outside of the API context,
especially when using it for a Float64ToString operation.

* Common: Remove StringToFloat64

Replaced by types.Number

* fixup! Types: Switch StringToFloat64 for Number

Second pass at Okx

* Spellcheck: Fix whitespace handling for okx line
This commit is contained in:
Gareth Kirwan
2023-12-20 03:01:27 +01:00
committed by GitHub
parent 5042bf9790
commit f05f24da8b
21 changed files with 3158 additions and 3140 deletions

View File

@@ -5,9 +5,9 @@ import (
"time"
"github.com/shopspring/decimal"
"github.com/thrasher-corp/gocryptotrader/common/convert"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
"github.com/thrasher-corp/gocryptotrader/types"
)
const wsRateLimitMilliseconds = 250
@@ -295,14 +295,14 @@ type AggregatedTrade struct {
// IndexMarkPrice stores data for index and mark prices
type IndexMarkPrice struct {
Symbol string `json:"symbol"`
Pair string `json:"pair"`
MarkPrice convert.StringToFloat64 `json:"markPrice"`
IndexPrice convert.StringToFloat64 `json:"indexPrice"`
EstimatedSettlePrice convert.StringToFloat64 `json:"estimatedSettlePrice"`
LastFundingRate convert.StringToFloat64 `json:"lastFundingRate"`
NextFundingTime int64 `json:"nextFundingTime"`
Time int64 `json:"time"`
Symbol string `json:"symbol"`
Pair string `json:"pair"`
MarkPrice types.Number `json:"markPrice"`
IndexPrice types.Number `json:"indexPrice"`
EstimatedSettlePrice types.Number `json:"estimatedSettlePrice"`
LastFundingRate types.Number `json:"lastFundingRate"`
NextFundingTime int64 `json:"nextFundingTime"`
Time int64 `json:"time"`
}
// CandleStick holds kline data

View File

@@ -3,8 +3,8 @@ package binance
import (
"time"
"github.com/thrasher-corp/gocryptotrader/common/convert"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/types"
)
var (
@@ -84,11 +84,11 @@ type UMarkPrice struct {
// FundingRateInfoResponse stores funding rate info
type FundingRateInfoResponse struct {
Symbol string `json:"symbol"`
AdjustedFundingRateCap convert.StringToFloat64 `json:"adjustedFundingRateCap"`
AdjustedFundingRateFloor convert.StringToFloat64 `json:"adjustedFundingRateFloor"`
FundingIntervalHours int64 `json:"fundingIntervalHours"`
Disclaimer bool `json:"disclaimer"`
Symbol string `json:"symbol"`
AdjustedFundingRateCap types.Number `json:"adjustedFundingRateCap"`
AdjustedFundingRateFloor types.Number `json:"adjustedFundingRateFloor"`
FundingIntervalHours int64 `json:"fundingIntervalHours"`
Disclaimer bool `json:"disclaimer"`
}
// FundingRateHistory stores funding rate history