gmosx / kraken-sdk-rust

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

Make `OrderBookTier` derive `Serialize` #25

Closed gitmalong closed 11 months ago

gitmalong commented 11 months ago

For testing purposes it would be handy if OrderBookTier derives Serialize so one can quickly get some test data from a real OrderBookTier.

gitmalong commented 11 months ago

Make PairInfo derive Clone would also be useful.

e.g. now I can only derive a reference from HashMap<String, PairInfo>

fn find_asset_pair(&self, symbol_a: &str, symbol_b: &str) -> Option<&PairInfo> {
    self.asset_pairs.values().find(|pair| {
        pair.base == symbol_a && pair.quote == symbol_b
            || pair.base == symbol_b && pair.quote == symbol_a
    })
}
gmosx commented 11 months ago

Hm, I will add those temporarily, but probably I should make serialization of api types an optional feature of the crate, in a future PR.