Skip to content

Commit

Permalink
Okx: Fix GetInsuranceFundInformation "" resp (thrasher-corp#1405)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
gbjk authored Nov 27, 2023
1 parent 88182ec commit 0620ee0
Show file tree
Hide file tree
Showing 3 changed files with 2,371 additions and 2,365 deletions.
12 changes: 9 additions & 3 deletions exchanges/okx/okx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
10 changes: 5 additions & 5 deletions exchanges/okx/okx_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 0620ee0

Please sign in to comment.