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

Change in API? #36

Open
miked63017 opened this issue Feb 28, 2019 · 9 comments
Open

Change in API? #36

miked63017 opened this issue Feb 28, 2019 · 9 comments
Projects

Comments

@miked63017
Copy link

Describe the bug
Looks like something changed in the websockets, on top of getting this Unknown Client error, I have also experimented manually and found that there are some other odd things going on like not receiving what you subscribe to.

To Reproduce
Run example.py with a symbol to quote

@miked63017
Copy link
Author

ip-192-168-1-194:tastyworks mdonlon$ python example.py
2019-02-28 14:19:52,117 Connecting to url: https://tasty.dxfeed.com/live/cometd
2019-02-28 14:19:52,117 Opening client with connection types ['websocket', 'long-polling'] ...
2019-02-28 14:19:52,422 Connection types supported by the server: ['websocket']
2019-02-28 14:19:52,470 Client opened with connection_type 'websocket'
Traceback (most recent call last):
  File "example.py", line 105, in <module>
    main()
  File "example.py", line 87, in main
    streamer = DataStreamer(tasty_client)
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/tastyworks/streamer.py", line 24, in __init__
    self._setup_connection()
  File "/Users/mdonlon/miniconda3/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
    return future.result()
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/tastyworks/streamer.py", line 92, in _setup_connection
    await cometd_client.subscribe(dxfeed.DATA_CHANNEL)
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/aiocometd/client.py", line 304, in subscribe
    self._verify_response(response)
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/aiocometd/client.py", line 359, in _verify_response
    self._raise_server_error(response)
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/aiocometd/client.py", line 375, in _raise_server_error
    raise ServerError(message, response)
aiocometd.exceptions.ServerError: ('Subscribe request failed.', {'channel': '/meta/subscribe', 'id': '2', 'error': '402::Unknown client', 'successful': False})
Exception ignored in: <function DataStreamer.__del__ at 0x10a9b57b8>
Traceback (most recent call last):
  File "/Users/mdonlon/miniconda3/lib/python3.7/site-packages/tastyworks/streamer.py", line 29, in __del__
AttributeError: 'NoneType' object has no attribute 'close'

@boyan-soubachov
Copy link
Owner

Thanks for reporting this @miked63017 , I will have a look later today.

@boyan-soubachov boyan-soubachov added this to Needs triage in Bugs via automation Mar 1, 2019
@boyan-soubachov boyan-soubachov moved this from Needs triage to High priority in Bugs Mar 1, 2019
@miked63017
Copy link
Author

Hi @boyan-soubachov are you able to get past this? Am I the only one getting these errors?

I thought I had a workaround, I honestly don't recall what I changed because I was using my own scripts that weren't async, but it seems they changes something again, and now I cannot even sniff the traffic properly :-(

Please let me know if you are able to use their websocket api at all, thanks!

@miked63017
Copy link
Author

Also, AFAICT the added some kind of extra SSL/cert mechanism and I am getting connection closed on the websocket

@miked63017
Copy link
Author

And...it randomly started working again. I didn't change any of the code but I was poking around the dxfeed example pages and using javascript injection via chrome dev tools to test my connection.

https://tools.dxfeed.com/webservice/qtable-demo.jsp

Basically I injected my token and the tasty url, then about an hour later I retested my python script since all the data seemed to look good and it just worked. Even more confused now lol

@HyperXewl
Copy link

HyperXewl commented Apr 18, 2020

I was getting this websocket error as well. I was able to fix it by adding a line to the account_events.py file

https://gyazo.com/12448db899e1e8edd89e948795fa8735

@fritol
Copy link

fritol commented Jul 31, 2020

And...it randomly started working again. I didn't change any of the code but I was poking around the dxfeed example pages and using javascript injection via chrome dev tools to test my connection.

https://tools.dxfeed.com/webservice/qtable-demo.jsp

Basically I injected my token and the tasty url, then about an hour later I retested my python script since all the data seemed to look good and it just worked. Even more confused now lol

Hi Mike, is this Boyans API still working for you? (It will help me to know so that I dont spend any more time on it coz I have some troubles already (i filed a bug rep 2)). thx

@miked63017
Copy link
Author

miked63017 commented Jul 31, 2020 via email

@bandwiches
Copy link
Contributor

I saw something along the lines of this literally yesterday (1/25/21). It doesn't seem to be isolated to this package, it seems like it's an issue on the backend. When I saw this yesterday I was just using a mix of aiohttp calls and Postman and I saw it on both platforms.

Symptom: Tastyworks API websocket errors just begin and end randomly.

My Hunch: Pretty sure this is just instability with Tastyworks API

Evidence: It really doesn't matter what language or product/platform you're using, it just seems to start happening randomly. You can swap from Python (requests/aiohttp) to Postman and you'll get the same websocket error. It just seems to happen. I think it may be how they handle their tokens or "sessions".

Further Investigation: I haven't found a way to truly replicate this, so my troubleshooting has been limited to the tiny windows when it happens.

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

No branches or pull requests

5 participants