Okx: Fix GetInsuranceFundInformation "" resp (#1405)

* Okx: Fix GetInsuranceFundInformation "" resp

When amount is "" this was erroring

* Test: Standardise configtest.json

Simple jq formatting of configtest
git diff -w or github ignore whitespaces should show no changes.
Any conflicts, just accept --ours and reformat it. Or not :o)
This commit is contained in:
Gareth Kirwan
2023-11-27 23:38:37 +01:00
committed by GitHub
parent 88182ec414
commit 0620ee034d
3 changed files with 2413 additions and 2407 deletions

View File

@@ -359,12 +359,18 @@ func TestGetPublicUnderlyings(t *testing.T) {
func TestGetInsuranceFundInformation(t *testing.T) {
t.Parallel()
if _, err := ok.GetInsuranceFundInformation(contextGenerate(), &InsuranceFundInformationRequestParams{
r, err := ok.GetInsuranceFundInformation(contextGenerate(), &InsuranceFundInformationRequestParams{
InstrumentType: "FUTURES",
Underlying: "BTC-USDT",
Limit: 2,
}); err != nil {
t.Error("Okx GetInsuranceFundInformation() error", err)
})
assert.NoError(t, err, "GetInsuranceFundInformation should not error")
assert.Positive(t, r.Total, "Total should be positive")
assert.NotEmpty(t, r.Details, "Should have some details")
for _, d := range r.Details {
assert.Positive(t, d.Balance, "Balance should be positive")
assert.NotEmpty(t, d.Type, "Type should not be empty")
assert.Positive(t, d.Timestamp, "Timestamp should be positive")
}
}

View File

@@ -505,11 +505,11 @@ type InsuranceFundInformation struct {
// InsuranceFundInformationDetail represents an Insurance fund information item for a
// single currency and type
type InsuranceFundInformationDetail struct {
Amount float64 `json:"amt,string"`
Balance float64 `json:"balance,string"`
Currency string `json:"ccy"`
Timestamp okxUnixMilliTime `json:"ts"`
Type string `json:"type"`
Amount convert.StringToFloat64 `json:"amt"`
Balance convert.StringToFloat64 `json:"balance"`
Currency string `json:"ccy"`
Timestamp okxUnixMilliTime `json:"ts"`
Type string `json:"type"`
}
// SupportedCoinsData holds information about currencies supported by the trading data endpoints.