Skip to main content

tdameritrade

Python interface to TD Ameritrade Api

Build Status Coverage License PyPI

Getting Started

Install

Install from pip

pip install tdameritrade

or from source

python setup.py install

Docs

Major changes in the v0.1.0 update to the way tokens are handled.
You will still need the original authentication instructions, but the TDClient now takes the refresh token and client id, not the access token. A new session class handles token expiration and will automatically call a new token as needed.

It is recommended that you store these as environmental variables.

client_id = os.getenv('TDAMERITRADE_CLIENT_ID')
account_id = os.getenv('TDAMERITRADE_ACCOUNT_ID')
refresh_token = os.getenv('TDAMERITRADE_REFRESH_TOKEN')

tdclient = tdameritrade.TDClient(client_id=client_id, refresh_token=refresh_token, account_ids=[account_id])

See the tests\test_client.py file for examples on current usage.

All functionality is available as methods on the TDClient object. For most methods, there is a convenience method to return the result as a pandas DataFrame.

Most data fetching methods accept the symbol as argument. For equities, this is just the ticker.

For different assets, utilize the search and instrument methods to lookup symbols. For options, you can utilize the options method.

Metadata

Release files for tdameritrade 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdameritrade 0.2.1
File Size Uploaded
tdameritrade-0.2.1.tar.gz 28.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tdameritrade 0.2.1
File Interpreter ABI Platform
tdameritrade-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 57.0 kB

Release files / tdameritrade-0.2.1.tar.gz

Download URL tdameritrade-0.2.1.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef13cf4bbef50633df3d5e3f263bc6a4a301e4b2ff3397077927a9fae0c709a
BLAKE2b-256 checksum
How to use checksums
fbc156a790c36e702e555a90b9b8ec237c0aca4d9ee79199af4de93c6c0268a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / tdameritrade-0.2.1-py2.py3-none-any.whl

Download URL tdameritrade-0.2.1-py2.py3-none-any.whl
Size 28.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2c51f3887634b617810bc9908d0b7bd70ff6d7b17a2efe6d270d509c9d99c528
BLAKE2b-256 checksum
How to use checksums
5d1455def97725823a4e01ea2c64ce330e4bf92dffb212c3ced70d2abf248c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page