Skip to main content

APIs for TD Ameritrade

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tdameritrade-0.2.1.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

tdameritrade-0.2.1-py2.py3-none-any.whl (28.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tdameritrade-0.2.1.tar.gz.

File metadata

  • Download URL: tdameritrade-0.2.1.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tdameritrade-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7ef13cf4bbef50633df3d5e3f263bc6a4a301e4b2ff3397077927a9fae0c709a
MD5 99aabae59ff7fc21d7c4c948781ec232
BLAKE2b-256 fbc156a790c36e702e555a90b9b8ec237c0aca4d9ee79199af4de93c6c0268a0

See more details on using hashes here.

File details

Details for the file tdameritrade-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tdameritrade-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2c51f3887634b617810bc9908d0b7bd70ff6d7b17a2efe6d270d509c9d99c528
MD5 bf16540ebbec52034499f2e2ce20a7c0
BLAKE2b-256 5d1455def97725823a4e01ea2c64ce330e4bf92dffb212c3ced70d2abf248c30

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page