gmosx / kraken-sdk-rust

A Rust SDK for working with Kraken APIs
Apache License 2.0
23 stars 14 forks source link

Fix type for trade and ohlc and add impl for Public client #44

Closed hard-money closed 6 months ago

gmosx commented 6 months ago

I am a bit confused, the example here shows that an array (vec) is returned:

https://docs.kraken.com/websockets-v2/#trade

Is the example outdated? It even mentions:

"Multiple trades may be batched in a single message"

hard-money commented 6 months ago

Hi gmosx,

I noticed that serde wasn't deserializing the JSON when I trying it. I think that since TradeData already is a Vec, that the Vec inside TradeEvent is one too many.

pub type TradeData = Vec<Trade>;

pub type TradeEvent = Event<Vec<TradeData>>;

This fix works in my local repo, thought I'd share it upstream. Thanks for the making this sdk public gmosx.

gmosx commented 6 months ago

Ah you are right! My bad, I will merge. Thanks again for this PR!