Kucoin: Fix unmarshalling of FuturesTicker resp (#1414)

* Kucoin: Fix unmarshalling of FuturesTicker resp

* Fix several string float64 fields not unmarshalling
* Fix time field misnamed; Make a time.Time
* Use order.Side for sides
* Add tests

This change opts to expose float64 instead of StringToFloat64 because
there's no wrapper to convert the type over, and it's not a websocket.
Essentially choosing to not expose internal convert types for methods
called directly.

Possible we'll eventually harmonise this with a types.Number or
something.

* Kucoin: FuturesRealTimeTicker => FuturesTicker

Kucoin only call it RealTime in the first sentence of their docs. None of the API names, endpoints or any thing mention RealTime.
This is just a ticker

* Tests: Improve clarity of failed push data

* Kucoin: Move PushData to a fixture file

This avoids both the linter errors, and the bloat.
Loses the name of the "test", but I think that's okay
This commit is contained in:
Gareth Kirwan
2023-12-12 04:57:32 +01:00
committed by GitHub
parent 7d92206788
commit 32f08f82f4
5 changed files with 75 additions and 72 deletions

View File

@@ -177,9 +177,8 @@ func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixtu
s := bufio.NewScanner(fixture)
for s.Scan() {
msg := s.Bytes()
if err := reader(msg); err != nil {
t.Errorf("%v from message: %s", err, msg)
}
err := reader(msg)
assert.NoErrorf(t, err, "Fixture message should not error:\n%s", msg)
}
assert.NoError(t, s.Err(), "Fixture Scanner should not error")
}