Skip to content

tastyware/tastytrade:v12.0.0

Choose a tag to compare

@Graeme22 Graeme22 released this 05 Feb 19:49
· 5 commits to master since this release
0c6c0b1

What's Changed

For a long time this library was mostly sync, with the streamers being the exception. #168 added async endpoints on top of the existing endpoints, which gave users more flexibility. With this change, I the library moves to async-only.

There are a few reasons for this. First of all, having both sync and async versions of everything resulted in a ton of code duplication. Second, both streamers are (and always have been) async, meaning that almost all users are already implementing at least some async code, so having the separate sync versions makes less sense. Finally, this change allows us to support Trio and clean up the streamer implementation which was hard to reason about and prone to bugs.

  • httpx-ws library replaces websockets, allowing for Trio support. As a consequence of this, reconnect and disconnect functionality is gone (however, this is almost certainly better handled on the user side anyways).
  • Streamers now use httpx-ws websockets and structured concurrency, making them much simpler and easier to reason about (which implies a lower chance of bugs in the future). We also get to use the helpful send_json and receive_json functions instead of wrapping everything in json.dumps/json.loads.
  • Python 3.10 support is dropped as we're now using ExceptionGroups. This would likely have happened soon anyways as the official support lifecycle only goes through October 2026.
  • All previous sync endpoints are now async. All previous async endpoints have been removed (so instead of having endpoints named Account.a_get for async and Account.get for sync, we have a single endpoint named Account.get, which is async).
  • Session token refreshing is smarter: Instead of making users check and refresh themselves, they will auto-refresh before any request if they're close to expiry. Sessions also have an optional async context manager which can be used to ensure cleanup happens.
  • tastytrade.dxfeed.Quote events now have helpful mid_price and micro_price properties calculated from its bid/ask prices.
  • tastytrade.order.OrderAction has a multiplier property which is -1 when it's a "Sell" leg and 1 when it's a "Buy" leg.
  • Test suite now runs on both asyncio and Trio.

Full Changelog: v11.1.0...v12.0.0