tastytrade: TastytradeError('Connection timed out')

Hey all,

Just came across this lib today, able to retrieve account information with the test code but having issues with data. Not entirely sure how to debug since there’s no real information in the logs to work on.

>>> async def main(session):
...     async with DXFeedStreamer(session) as streamer:
...         await streamer.subscribe(EventType.QUOTE, subs_list)
...         quote = await streamer.get_event(EventType.QUOTE)
...         print(quote)
>>> asyncio.run(main(session))
Task exception was never retrieved
future: <Task finished name='Task-9' coro=<DXFeedStreamer._connect() done, defined at C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\tastytrade\streamer.py:317> exception=TimeoutError()>
Traceback (most recent call last):
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 647, in __await_impl_timeout__
    return await self.__await_impl__()
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 651, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1036, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1418, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 863, in getaddrinfo
    return await self.run_in_executor(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\tastytrade\streamer.py", line 324, in _connect
    async with websockets.connect(  # type: ignore
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 629, in __aenter__
    return await self
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 646, in __await_impl_timeout__
    async with asyncio_timeout(self.open_timeout):
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\async_timeout.py", line 169, in __aexit__
    self._do_exit(exc_type)
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\async_timeout.py", line 252, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "<stdin>", line 2, in main
  File "C:\Users\Joshua\AppData\Local\Programs\Python\Python310\lib\site-packages\tastytrade\streamer.py", line 657, in __aenter__
    raise TastytradeError('Connection timed out')
tastytrade.utils.TastytradeError: Connection timed out

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

I’m getting connection time out now with DXLinkStreamer

We are able to subscribe to Time and Sales with DXLink? I haven’t been able to get it working so that’s why I was using DXFeed…

I believe it’s not supported. However, it appears Tasty never intended for it to be supported in the first place, so it was kind of a “secret bonus” of reverse-engineering the streamer.