Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orderbook crosses in book stream #38

Open
GeorgSchneider opened this issue Nov 14, 2020 · 1 comment
Open

Orderbook crosses in book stream #38

GeorgSchneider opened this issue Nov 14, 2020 · 1 comment

Comments

@GeorgSchneider
Copy link

Not an issue, but a question regarding the data quality from Bitfinex: I've noticed that sometimes the raw orderbook stream will send bids that cross the best ask at that point, and vice versa. I'm wondering if you had observed the same issues and how you go about remediating them. For now I'm just removing all crossed quotes from the book when the situation occurs, but it feels like I might not have an accurate representation of the real book.

I've checked that there was indeed no level removal (book.Count == 0) at the crossed price beforehand, so my raw data confirms the issue is happening. So I'm wondering if I might have missed some updates, ie. dropped messages. Would you suggest to always use the server sequence number? In some code comment you write that it should not be required due to TCP transport guarantees. I've also seen the checksum option but it seems heavy-handed and would increase traffic quite a bit.

Thanks for your insights, and really appreciate the high-quality library you're providing!

@Marfusios
Copy link
Owner

Hello @GeorgSchneider,

thanks, glad to hear it.

Does that issue occur like instantionously or only after x minutes/hours?
I would say it shouldn't take place, OB invalidity happens, but it is very rare.

Anyway, I didn't test that raw OB (L3) API extensively yet, always just for a few minutes, and didn't visually spot any cross, but never checked one-by-one response log.

Please check my other library, where I'm constructing an order book structure, whenever the issue occurs also there:
Library: https://github.com/Marfusios/crypto-websocket-extensions
L3 test: https://github.com/Marfusios/crypto-websocket-extensions/blob/master/test_integration/Crypto.Websocket.Extensions.Sample/OrderBookL3Example.cs#L18

Also, beware of the misleading price precision in the data. OB data doesn't always follow their '5 significant digits' rule, because Bitfinex is doing cross book execution.
For example orders from BTC/USD are merged together with BTC/EUR.
Found discussion here: https://www.reddit.com/r/bitfinex/comments/fvrgml/websocket_price_precision/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants