amv-dev / yata

Yet Another Technical Analysis library [for Rust]
Apache License 2.0
321 stars 49 forks source link

feat: add rkyv derive for Candle #47

Closed harryagstian closed 1 month ago

harryagstian commented 2 months ago

Added rkyv derive for Candle behind feature gate, allowing the struct to be serialized / deserialized / stored using rkyv.

Using rkyv significantly improved candles load performance for files, which is useful when doing backtesting. I am able to load 232k candles in 2 seconds using rkyv, compared to 28 seconds with serde-json.

Also, minor fix on donchian_channel documentation.

amv-dev commented 1 month ago

I don't see any reason to add such a dependency in the crate.

If you need some specific behavior for Candle, you can choose one of at least two ways:

  1. Create you own Candle. The only requirement here is to implement OHLCV trait for it and it's pretty simple.
  2. Create your own trait which will handle behavior you need and implement it to existing Candle.