sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.08k stars 2.21k forks source link

depth vs. diff #631

Open g3g3n3 opened 3 years ago

g3g3n3 commented 3 years ago

regarding the websocket depth data... (@depth vs @depth levels): is all of the information in the diff stream already in the depth stream? i'm thinking of saving some of this data for research at a later date, is there an advantage to having one or the other? do i need both to "reconstruct" the depthbook activity in a historical "simulated" live trade scenario? I'm a little unclear as to how they differ. Does the diff stream simply exclude redundant levels? It's not clear how this works, could someone direct me to a good source? I've sent a message on telegram but no response.

aitorsm commented 3 years ago

Yes, it is as long as you're using only 20 levels of the orderbook. The advantage of using diff is that you can only store the updates every timestamp and reconstruct the full book whenever you want.

mrwonderfulness commented 3 years ago

Thanks for your reply. How would you go about setting up the starting an archive, since it is a diff, would the snapshot be the first entry in the archive? i guess my concern is getting the wrong snapshot and then have the diff adding to the wrong starting values.

Also, are there any advantages to collecting the full depth ( i.e. not the diff)? I realize it would mean storing more data but perhaps it is better? If not, why would it even be available? Cheers.