tastyware/tastytrade:v9.3
What's Changed
- All event fields from
tastytrade.dxfeed
changed to Pythonic snake_case instead of their previous names, which came directly from the Java documentation and therefore used camelCase.
So this code:
print(quote.eventSymbol)
Becomes:
print(quote.event_symbol)
Candle
,Quote
, andTrade
events fromtastytrade.dxfeed
have lessOptional
fields.
Previously, the streamer would return a lot of "garbage" events that would have to be handled in some way. For example, listening toQuote
events might have looked like this:
from tastytrade.dxfeed import Quote
# ...
async for quote in streamer.listen(Quote):
if quote.bidPrice is not None and quote.askPrice is not None:
quotes.append(quote)
To make things even worse, using the Quote
objects returned down the road led to lots of # type: ignore
s littering the code as type checkers are unable to determine that quotes without crucial properties have already been filtered out:
# type checker will complain as these may be `None`!
mid = quote.bidPrice + quote.askPrice # type: ignore
This mini-release solves these problems by making these fields non-optional, and not returning the events at all if they're missing crucial fields. (For example, Quote
s are pretty much useless without the bid/ask, or Candle
s without OHLC.)
So the above code can be changed to:
from tastytrade.dxfeed import Quote
# ...
async for quote in streamer.listen(Quote):
quotes.append(quote)
and
mid = quote.bid_price + quote.ask_price
Full Changelog: v9.2...v9.3