danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 733 forks source link

Websocket empty? #361

Closed pmaji closed 9 months ago

pmaji commented 5 years ago

Hey all,

We use your package (ever since GDAX) as part of this whale watching app. Recently, we noticed that the websockets were just coming back empty. Is this something you're aware of?

noah222 commented 5 years ago

what feed are you using? I've been using the 'matches' feed and have had no lapse in data. Be aware that there was recently an issue with bitcoin and the bitcoin market was halted for a few hours. When this happens there are no trades and the feed is empty. I do resubscribe often because the feed drops out quite regularly, then you are sure to get the next trade when it happens.

pmaji commented 5 years ago

I don't know exactly what 'matches' feed means in this case, but I think we're using the same data. We're only using cases where the message is matched. You can see the small snippet of code that I'm referring to here.

It is doing better today, so maybe it was partially the btc problem you mentioned, but it appears that I am needing to resubscribe far more often than I was a few months ago...

noah222 commented 5 years ago

I use my own script for managing a connection to the feed data, and the subscription message is:

message = { "type": "subscribe", "channels": [{"name": "matches", "product_ids": ["ETH-USD"]}] }

I resubscribe every minute or after several message time outs, just in case. It feels totally redundant but not missing data is worth it, especially when in the middle of trades. The only time I missed data in the last month was when my power went out :)

pmaji commented 5 years ago

Appreciate your sharing that. Sharing with my co-contributor: @theimo1221

mcardillo55 commented 3 years ago

Are you still seeing this @pmaji ?

pmaji commented 3 years ago

Yes @mcardillo55 -- off of master @ https://github.com/pmaji/crypto-whale-watching-app

mcardillo55 commented 3 years ago

Are you trying to get the code in gdax_book.py to work? And which version of cbpro are you using?

I recommend using the version from git (trying to get it updated on PyPi, but you canpip install git+https://github.com/danpaquin/coinbasepro-python.git for now)

WebsocketClient now requires channels. See https://github.com/danpaquin/coinbasepro-python/commit/646e99bbb1e883e47cbbbb8d1d8096a8f467c1aa for the changes you'll need to make to get gdax_book.py working again. I'm not sure if this is directly the root of the issue, but seems like a good place to start.