barter-data-rs icon indicating copy to clipboard operation
barter-data-rs copied to clipboard

`u64` or `DateTime<Utc>` for the data type of timestamps

Open seongs1024 opened this issue 2 years ago • 3 comments

Would it be better to use u64 datatype for timestamps because of better performance when serde deserializes it?

Candle uses DateTime<Utc> for start_time and end_time for now.

https://github.com/barter-rs/barter-data-rs/blob/f1afec3308e3351e3c155946c9f357be158fd0a5/src/model/mod.rs#L42-L53

seongs1024 avatar Jan 01 '23 12:01 seongs1024

Hey @seongs1024 , potentially!

However even with several of the most high volume markets (eg/ binance_futures btc_usdt) on the same thread, barter-data-rs is not bottle necked.

DateTime<Utc> provides a more type safe way of representing time, as well as additional functionality.

It's definitely possible we'd want to adapt this in the future.

eg/ DateTime<Utc> -> Time where Time is a struct Time(u64)

eg/ end_time would actually become the delta between start_time and end_time, rather than a fully precise DateTime<Utc>.

etc etc.

Out of interest, do you use the candles?

just-a-stream avatar Jan 19 '23 12:01 just-a-stream

Yeah I'm using candles for backtesting!

seongs1024 avatar Jan 19 '23 12:01 seongs1024

I will be using candles for backtesting and hopefully also for live trading in the future.

tobiasfuhlroth avatar Apr 15 '23 22:04 tobiasfuhlroth

Closing this now we've migrated this repo to the new barter-rs monorepo: https://github.com/barter-rs/barter-rs

just-a-stream avatar Jul 12 '24 20:07 just-a-stream