tardis-dev / tardis-machine

Locally runnable server with built-in data caching, providing both tick-level historical and consolidated real-time cryptocurrency market data via HTTP and WebSocket APIs
https://docs.tardis.dev/api/tardis-machine
Mozilla Public License 2.0
235 stars 46 forks source link

ws-stream-normalized gives a 10 second delay between timestamp and localTimestamp #16

Closed stocktiger closed 1 year ago

stocktiger commented 1 year ago

Hi, I was wondering if this intended behaviour of there is a way to reduce this delay. I can find this for the other channels (i.e. trade) equally.

e.g.

{"type":"book_snapshot","symbol":"ETHUSDT","exchange":"binance-futures","name":"book_snapshot_10_1s","depth":10,"interval":1000,"bids":[{"price":1558.31,"amount":56.523},{"price":1558.28,"amount":3.154},{"price":1558.25,"amount":0.004},{"price":1558.24,"amount":7.729},{"price":1558.23,"amount":0.211},{"price":1558.22,"amount":0.012},{"price":1558.2,"amount":0.304},{"price":1558.19,"amount":1.491},{"price":1558.17,"amount":0.01},{"price":1558.14,"amount":8.87}],"asks":[{"price":1558.32,"amount":26.934},{"price":1558.36,"amount":7.408},{"price":1558.37,"amount":3.454},{"price":1558.39,"amount":1.578},{"price":1558.41,"amount":6.137},{"price":1558.42,"amount":1.113},{"price":1558.43,"amount":0.008},{"price":1558.44,"amount":26.96},{"price":1558.45,"amount":33.206},{"price":1558.46,"amount":12.835}],"timestamp":"2022-08-22T09:26:51.000Z","localTimestamp":"2022-08-22T09:26:41.004Z"}
thaaddeus commented 1 year ago

it depends where you host it, best to host at AWS Tokyo for Binance exchange.

stocktiger commented 1 year ago

I run the tardis machine locally. Nevertheless, when opening standard websockets directly to exchanges i get at max 300 ms delay. 10 seconds seem way to much. Any suggestions?

thaaddeus commented 1 year ago

you need to compare at the same times.

stocktiger commented 1 year ago

yes, my local machine had a 10second delay. apologies.