-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sync/async functionality for all requests (#168)
* add async * add async tests * add docs, fix a couple tests * lint * use py3.8
- Loading branch information
Showing
30 changed files
with
2,178 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
sync/async | ||
========== | ||
|
||
After creating a session (which is always initialized synchronously), the rest of the API endpoints implemented in the SDK have both sync and async implementations as of version 9.0. | ||
|
||
Let's see how this looks: | ||
|
||
.. code-block:: python | ||
from tastytrade Account, Session | ||
session = Session(username, password) | ||
# using sync implementation | ||
accounts = Account.get_accounts(session) | ||
The async implementation is similar: | ||
|
||
.. code-block:: python | ||
from tastytrade Account, Session | ||
session = Session(username, password) | ||
# using async implementation | ||
accounts = await Account.a_get_accounts(session) | ||
That's it! All sync methods have a parallel async method that starts with `a_`. | ||
|
||
.. note:: | ||
Please note that two modules, `tastytrade.backtest` and `tastytrade.streamer`, only have async implementations. But for everything else, you can use what you'd like! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,15 @@ build-backend = "hatchling.build" | |
|
||
[project] | ||
name = "tastytrade" | ||
version = "8.5" | ||
description = "An unofficial SDK for Tastytrade!" | ||
version = "9.0" | ||
description = "An unofficial, sync/async SDK for Tastytrade!" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
license = {file = "LICENSE"} | ||
authors = [ | ||
{name = "Graeme Holliday", email = "[email protected]"}, | ||
] | ||
|
||
dependencies = [ | ||
"fake-useragent>=1.5.1", | ||
"httpx>=0.27.2", | ||
"pandas-market-calendars>=4.4.1", | ||
"pydantic>=2.9.2", | ||
|
@@ -29,11 +27,10 @@ Documentation = "https://tastyworks-api.readthedocs.io/en/latest" | |
dev-dependencies = [ | ||
"mypy>=1.11.2", | ||
"pytest>=8.3.3", | ||
"pytest-asyncio>=0.24.0", | ||
"pytest-aio>=1.5.0", | ||
"pytest-cov>=5.0.0", | ||
"ruff>=0.6.7", | ||
"types-pytz>=2024.2.0.20240913", | ||
"types-requests>=2.32.0.20240914", | ||
"ruff>=0.6.9", | ||
"types-pytz>=2024.2.0.20241003", | ||
] | ||
|
||
[tool.setuptools.package-data] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.