barter-rs / barter-data-rs

NOTE: Barter-Data migrated to Barter monorepo: https://www.github.com/barter-rs/barter-rs
https://github.com/orgs/barter-rs/repositories
MIT License
101 stars 63 forks source link

Exchange_time and received_time are the same #27

Closed yolonir closed 1 year ago

yolonir commented 1 year ago

Hi! I am running this example: https://github.com/barter-rs/barter-data-rs/blob/develop/examples/public_trades_streams.rs

Unfortunately I have rather doubtful results

MarketEvent<OrderBookL1>: MarketEvent { exchange_time: 2023-02-06T17:52:17.056798Z, received_time: 2023-02-06T17:52:17.056798Z, exchange: binance_futures_usd, instrument: Instrument { base: btc, quote: usdt, kind: FuturePerpetual }, kind: OrderBookL1 { last_update_time: 2023-02-06T17:52:17.056798Z, best_bid: Level { price: 23041.9, amount: 0.205 }, best_ask: Level { price: 23042.0, amount: 17.663 } } }

Exchange and receive time are the same, I doubt that it is due to hyper fast benefits of this lib, any suggestions? Is this a bug?

jnatherley commented 1 year ago

Screenshot 2023-02-13 at 19 11 55

Could it be in the nano-seconds @just-a-stream

just-a-stream commented 1 year ago

Hello :)

Thanks for bringing this to my attention. I've improved the situation in barter-data-rs release 0.6.9!

BinanceFuturesUsd now uses the correct timestamp.

However, since the BinanceSpot server does not provide a timestamp for the payload I've had to use the same as received timestamp.

Hope this seems reasonable for you!

Thanks, JustAStream