{"id":13740305,"url":"https://github.com/alexgolec/tda-api","last_synced_at":"2025-05-14T20:06:14.645Z","repository":{"id":37384094,"uuid":"252843907","full_name":"alexgolec/tda-api","owner":"alexgolec","description":"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. ","archived":false,"fork":false,"pushed_at":"2024-06-16T22:04:20.000Z","size":632,"stargazers_count":1285,"open_issues_count":42,"forks_count":340,"subscribers_count":70,"default_branch":"master","last_synced_at":"2025-04-03T02:59:41.839Z","etag":null,"topics":["automated-trading","finance","financial-data","python3","tdameritrade","trading"],"latest_commit_sha":null,"homepage":"https://tda-api.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexgolec.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"TDAAPI"}},"created_at":"2020-04-03T21:19:12.000Z","updated_at":"2025-04-01T16:17:02.000Z","dependencies_parsed_at":"2023-02-03T07:16:03.982Z","dependency_job_id":"53e29851-7c87-4bc0-8d34-9419558000a9","html_url":"https://github.com/alexgolec/tda-api","commit_stats":{"total_commits":373,"total_committers":24,"mean_commits":"15.541666666666666","dds":"0.18230563002680966","last_synced_commit":"196a46cefd7a311a1ae3823e94cc58643d21ebcc"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexgolec%2Ftda-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexgolec%2Ftda-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexgolec%2Ftda-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexgolec%2Ftda-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexgolec","download_url":"https://codeload.github.com/alexgolec/tda-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161255,"owners_count":21057553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated-trading","finance","financial-data","python3","tdameritrade","trading"],"created_at":"2024-08-03T04:00:46.044Z","updated_at":"2025-04-10T04:54:12.311Z","avatar_url":"https://github.com/alexgolec.png","language":"Python","readme":"TDAmeritrade is now defunct\n===========================\n\nOn May 10th, 2024, Charles Schwab officially turned down the TDAmeritrade \nservice and migrated its last batch of customers to Charles Schwab. With this \nchange, ``tda-api`` and the API that backed it stopped working.\n\nFortunately, a new API is available, and it's quite similar to ``tda-api``.  \nWe've been hard at work on ``schwab-py``, a replacement for ``tda-api``. Here is \nthe `documentation, complete with getting started and migration \nguides \u003chttps://schwab-py.readthedocs.io/en/latest/\u003e`__. If you have any \nquestions, please ask them on our `Discord \nserver \u003chttps://discord.gg/BEr6y6Xqyv\u003e`__\n\nThe old ``tda-api`` project is now defunct, and this repo is provided for \narchival purposes only.\n\n\n``tda-api``: A TD Ameritrade API Wrapper\n----------------------------------------\n\n.. image:: https://img.shields.io/discord/720378361880248621.svg?label=\u0026logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026labelColor=6A7EC2\n  :target: https://discord.gg/BEr6y6Xqyv\n\n.. image:: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dalexgolec%26type%3Dpatrons\u0026style=flat\n  :target: https://patreon.com/TDAAPI\n\n.. image:: https://readthedocs.org/projects/tda-api/badge/?version=latest\n  :target: https://tda-api.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://github.com/alexgolec/tda-api/workflows/tests/badge.svg\n  :target: https://github.com/alexgolec/tda-api/actions?query=workflow%3Atests\n\n.. image:: https://badge.fury.io/py/tda-api.svg\n  :target: https://badge.fury.io/py/tda-api\n\n.. image:: http://codecov.io/github/alexgolec/tda-api/coverage.svg?branch=master\n  :target: http://codecov.io/github/alexgolec/tda-api?branch=master\n\nWhat is ``tda-api``?\n--------------------\n\n``tda-api`` is an unofficial wrapper around the `TD Ameritrade APIs\n\u003chttps://developer.tdameritrade.com/apis\u003e`__. It strives to be as thin and\nunopinionated as possible, offering an elegant programmatic interface over each\nendpoint. Notable functionality includes:\n\n* Login and authentication\n* Quotes, fundamentals, and historical pricing data\n* Options chains\n* Streaming quotes and order book depth data\n* Trades and trade management\n* Account info and preferences\n\nHow do I use ``tda-api``?\n-------------------------\n\nFor a full description of ``tda-api``'s functionality, check out the \n`documentation \u003chttps://tda-api.readthedocs.io/en/latest/\u003e`__. Meawhile, here's \na quick getting started guide:\n\nBefore you do anything, create an account and an application on the\n`TD Ameritrade developer website \u003chttps://developer.tdameritrade.com/\u003e`__.\nYou'll receive an API key, also known as a Client Id, which you can pass to this \nwrapper. You'll also want to take note of your callback URI, as the login flow \nrequires it.\n\nNext, install ``tda-api``:\n\n.. code-block:: python\n\n  pip install tda-api\n\nYou're good to go! To demonstrate, here's how you can authenticate and fetch\ndaily historical price data for the past twenty years:\n\n.. code-block:: python\n\n  from tda import auth, client\n  import json\n\n  token_path = '/path/to/token.json'\n  api_key = 'YOUR_API_KEY@AMER.OAUTHAP'\n  redirect_uri = 'https://your.redirecturi.com'\n  try:\n      c = auth.client_from_token_file(token_path, api_key)\n  except FileNotFoundError:\n      from selenium import webdriver\n      with webdriver.Chrome() as driver:\n          c = auth.client_from_login_flow(\n              driver, api_key, redirect_uri, token_path)\n\n  r = c.get_price_history('AAPL',\n          period_type=client.Client.PriceHistory.PeriodType.YEAR,\n          period=client.Client.PriceHistory.Period.TWENTY_YEARS,\n          frequency_type=client.Client.PriceHistory.FrequencyType.DAILY,\n          frequency=client.Client.PriceHistory.Frequency.DAILY)\n  assert r.status_code == 200, r.raise_for_status()\n  print(json.dumps(r.json(), indent=4))\n\nWhy should I use ``tda-api``?\n-----------------------------\n\n``tda-api`` was designed to provide a few important pieces of functionality:\n\n1. **Safe Authentication**: TD Ameritrade's API supports OAuth authentication, \n   but too many people online end up rolling their own implementation of the \n   OAuth callback flow. This is both unnecessarily complex and dangerous. \n   ``tda-api`` handles token fetch and refreshing for you.\n\n2. **Minimal API Wrapping**: Unlike some other API wrappers, which build in lots \n   of logic and validation, ``tda-api`` takes raw values and returns raw \n   responses, allowing you to interpret the complex API responses as you see \n   fit. Anything you can do with raw HTTP requests you can do with ``tda-api``, \n   only more easily.\n\nWhy should I *not* use ``tda-api``?\n-----------------------------------\n\nAs excellent as TD Ameritrade's API is, there are a few popular features it does \nnot offer: \n\n * Unfortunately, the TD Ameritrade API does not seem to expose any endpoints \n   around the `papermoney \u003chttps://tickertape.tdameritrade.com/tools/papermoney\n   -stock-market-simulator-16834\u003e`__ simulated trading product. ``tda-api`` can \n   only be used to perform real trades using a TD Ameritrade account. Note: \n   trades made through the API appear in thinkorswim and vice versa. \n * The API only supports trading in equities, mutual funds, ETFs, and options \n   (both simple contracts and complex composite positions). Futures and futures \n   options trading is not supported. Some data is provided for futures, but not\n   for futures options.\n * Historical options pricing data is not available. \n\nWhat else?\n----------\n\nWe have a `Discord server \u003chttps://discord.gg/BEr6y6Xqyv\u003e`__! You can join to \nget help using ``tda-api`` or just to chat with interesting people.\n\nBug reports, suggestions, and patches are always welcome! Submit issues\n`here \u003chttps://github.com/alexgolec/tda-api/issues\u003e`__ and pull requests\n`here \u003chttps://github.com/alexgolec/tda-api/pulls\u003e`__.\n\n``tda-api`` is released under the\n`MIT license \u003chttps://github.com/alexgolec/tda-api/blob/master/LICENSE\u003e`__.\n\n**Disclaimer:** *tda-api is an unofficial API wrapper. It is in no way \nendorsed by or affiliated with TD Ameritrade or any associated organization.\nMake sure to read and understand the terms of service of the underlying API \nbefore using this package. This authors accept no responsibility for any\ndamage that might stem from use of this package. See the LICENSE file for\nmore details.*\n","funding_links":["https://patreon.com/TDAAPI"],"categories":["Python","Curated List"],"sub_categories":["Trading \u0026 Backtesting","API Integrations/Connectors"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexgolec%2Ftda-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexgolec%2Ftda-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexgolec%2Ftda-api/lists"}