A TD Ameritrade API client for Python. Includes historical data for equities and ETFs, options chains, streaming order book data, complex order construction, and more.
If you don’t want to create a client and just want to fetch a token, you can use the tda-generate-token.py script that’s installed with the library.
tda-generate-token.py --help
So on my local machine I did pip install tda-api, everything seems fine.
Then I ran tda-generate-token.py --help and the output I get is:
tda-generate-token.py --help
Traceback (most recent call last):
File "/usr/local/bin/tda-generate-token.py", line 6, in <module>
import tda
File "/usr/local/lib/python3.9/site-packages/tda/__init__.py", line 1, in <module>
from . import auth
File "/usr/local/lib/python3.9/site-packages/tda/auth.py", line 4, in <module>
from authlib.integrations.httpx_client import AsyncOAuth2Client, OAuth2Client
File "/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/__init__.py", line 10, in <module>
from .oauth2_client import (
File "/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 3, in <module>
from httpx import AsyncClient, Auth, Client, Request, Response, USE_CLIENT_DEFAULT
ImportError: cannot import name 'USE_CLIENT_DEFAULT' from 'httpx' (/usr/local/lib/python3.9/site-packages/httpx/__init__.py)
I'm reading the guide https://tda-api.readthedocs.io/en/latest/auth.html#fetching-a-token-and-creating-a-client
So on my local machine I did
pip install tda-api
, everything seems fine.Then I ran
tda-generate-token.py --help
and the output I get is:I'm using Python 3.9.7 running on MacOS 11.2.1.