Open cedarburgqt opened 6 months ago
my very superficial understanding of the problem just from looking at tastytrade_sdk/market_data/subscription.py
and inspecting the element types is that the data structure for message['data']
likely changed, and subscription.py
likely needs to be updated accordingly. more detail provided below.
-- edit: An ughly hacky patch to by pass this error is also provided at the end of this post.
--
Sample values for message['data']
https://github.com/tastytrade/tastytrade-sdk-python/blob/master/src/tastytrade_sdk/market_data/subscription.py#L112
is provided below:
sample 1:
['Quote', ['Quote', 'SPX', 0, 0, 0, 0, '', 5646.29, 'NaN', 0, '', 5756.67, 'NaN', 'Quote', 'SPY', 0, 0, 0, 0, 'Q', 567.7, 'NaN', 0, 'Q', 568.25, 'NaN']]
sample 2:
['Candle', ['Candle', 'SPY', 0, 0, 7416879298617405007, 1726876781000, 650831, 1, 568.15, 568.15, 568.15, 568.15, 253.0, 'NaN', 'NaN', 'NaN', 'NaN', 'NaN']]
sample 3:
['Quote', ['Quote', 'BTC/USD:CXTALP', 0, 0, 0, 0, 'Z', 63076.32, 4.0, 0, 'Z', 63500.0, 0.19370079]]
Given above 3 samples, below code block no longer makes sense:
for event in message['data']:
self.__handle_feed_event(event)
since __handle_feed_event
expects event
to be a dict, but both first (str) and second (list of str,int,float) element type is not dict.
--
ugly hacky patch: 80da3331685ace0ce04438b23512c9890592e136...8e0b937eece3da4370b67ec7016a9e5ee9da8db9
sample output from print
using the above huckgly :smile: patch:
for those visiting this issue and wondering what the returned values mean...
Since src/tastytrade_sdk/market_data/subscription.py#L84
did not call self.__send('FEED_SETUP'...
to configure the feed, DXLinkFeed (returns all fields)[https://github.com/tastytrade/tastytrade-api-js/blob/a166b3897c7a0f35c1e95208150131aaebca2e80/README.md?plain=1#L42]!
The name and data type for all fields are available here, sample data and corresponding field names for a Candle
eventType
also provided in below screenshot.
Hello,
I am encountering an issue when attempting to use the sample code provided at https://tastytrade.github.io/tastytrade-sdk-python/tastytrade_sdk.html. In specific, I've taken the code provided for "Streaming Market Data" and made sure to substitute the credentials with my own. The code in question is below:
I receive the following output:
I am able to run the "validate" API route without issue, so I don't see this as being an authentication issue. I'm using Python 3.9 within an Anaconda environment on Windows, but also encountered this same problem running on AWS using Lambda. As far as I can tell this issue began occurring on 2024-04-25.
I've spoken with some other members in the development community and was pointed towards the unofficial library, which seems like it has a patch applied that might address this issue: https://github.com/tastyware/tastytrade/commit/c0e24cfe55abc02f56d565f04316fb2a69b4442c