boyan-soubachov / tastyworks_api

An unofficial, reverse-engineered Python API for tastyworks.
Apache License 2.0
209 stars 79 forks source link

Use aiocometd #31

Closed ppawel closed 5 years ago

ppawel commented 5 years ago

I'm using your library for private purposes, I made some additions already (like handling of candles and order status updates) that I might publish at some point when I separate it from my private code but I am still facing one major problem with the current implementation - connection to the dxfeed frequently (meaning: at least once per 24 hours) is broken, for different reasons. Sometimes it is hanging on sending the handshake message, sometimes the dxfeed server asks to reconnect but that is currently ignored etc. The bottom line is that I stop receiving candles and quotes.

I think a lot of this could be solved by switching to using a proper cometd client like aiocometd instead of doing everything manually. For example, aiocometd seems to handle reconnection advice (like "reconnect": "handshake") and network socket issues correctly.

I just wanted to ask, if I decide to start porting the streamer code to aiocometd, would you accept a PR for such change?

boyan-soubachov commented 5 years ago

That actually sounds like a great idea. I wasn't aware of aiocometd so if it solves the problems you mentioned efficiently, I'd definitely want to switch over to it.

ppawel commented 5 years ago

OK, thanks for the info. Just today I had another issue with the keep-alive thread, not sure why sometimes it stops sending out heartbeats... so I will probably work some time soon on switching to aiocometd.