All Projects → alexgolec → Tda Api

alexgolec / Tda Api

Licence: mit
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.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Tda Api

Akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 4,334 (+612.83%)
Mutual labels:  finance, financial-data
Finance Go
📊 Financial markets data library implemented in go.
Stars: ✭ 392 (-35.53%)
Mutual labels:  finance, financial-data
Machine Learning For Trading
Code for Machine Learning for Algorithmic Trading, 2nd edition.
Stars: ✭ 4,979 (+718.91%)
Mutual labels:  trading, finance
Alpha vantage
A python wrapper for Alpha Vantage API for financial data.
Stars: ✭ 3,553 (+484.38%)
Mutual labels:  finance, financial-data
Parity
Open source software platform for trading venues
Stars: ✭ 468 (-23.03%)
Mutual labels:  trading, finance
Flutter Candlesticks
Elegant OHLC Candlestick and Trade Volume charts for @Flutter
Stars: ✭ 318 (-47.7%)
Mutual labels:  finance, financial-data
Example Hftish
Example Order Book Imbalance Algorithm
Stars: ✭ 355 (-41.61%)
Mutual labels:  trading, finance
Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (-57.57%)
Mutual labels:  trading, finance
Quantdom
Python-based framework for backtesting trading strategies & analyzing financial markets [GUI ]
Stars: ✭ 449 (-26.15%)
Mutual labels:  trading, finance
Rqalpha
A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities
Stars: ✭ 4,425 (+627.8%)
Mutual labels:  trading, finance
Riskfolio Lib
Portfolio Optimization and Quantitative Strategic Asset Allocation in Python
Stars: ✭ 305 (-49.84%)
Mutual labels:  trading, finance
Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
Stars: ✭ 5,675 (+833.39%)
Mutual labels:  finance, trading
Deepdow
Portfolio optimization with deep learning.
Stars: ✭ 297 (-51.15%)
Mutual labels:  trading, finance
Go Finance
⚠️ Deprecrated in favor of https://github.com/piquette/finance-go
Stars: ✭ 536 (-11.84%)
Mutual labels:  finance, financial-data
Fx 1 Minute Data
HISTDATA - Full Dataset composed of 68 FX trading pairs / Simple API to retrieve 1 Minute data Historical FX Prices (up to June 2019).
Stars: ✭ 278 (-54.28%)
Mutual labels:  trading, financial-data
Oanda Api V20
OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
Stars: ✭ 325 (-46.55%)
Mutual labels:  trading, finance
juncture
Low latency connectivity to trading venues on the JVM
Stars: ✭ 31 (-94.9%)
Mutual labels:  finance, trading
neural-finance
Neural Network for HFT-trading [experimental]
Stars: ✭ 67 (-88.98%)
Mutual labels:  finance, trading
Stocksharp
Algorithmic trading and quantitative trading open source platform to develop trading robots (stock markets, forex, crypto, bitcoins, and options).
Stars: ✭ 4,601 (+656.74%)
Mutual labels:  trading, finance
Introneuralnetworks
Introducing neural networks to predict stock prices
Stars: ✭ 486 (-20.07%)
Mutual labels:  trading, finance

tda-api: A TD Ameritrade API Wrapper

.. image:: https://img.shields.io/discord/720378361880248621.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2 :target: https://discord.gg/nfrd9gh

.. image:: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dalexgolec%26type%3Dpatrons&style=flat :target: https://patreon.com/alexgolec

.. image:: https://readthedocs.org/projects/tda-api/badge/?version=stable :target: https://tda-api.readthedocs.io/en/stable/?badge=stable

.. image:: https://github.com/alexgolec/tda-api/workflows/tests/badge.svg :target: https://github.com/alexgolec/tda-api/actions?query=workflow%3Atests

.. image:: https://badge.fury.io/py/tda-api.svg :target: https://badge.fury.io/py/tda-api

.. image:: http://codecov.io/github/alexgolec/tda-api/coverage.svg?branch=master :target: http://codecov.io/github/alexgolec/tda-api?branch=master

What is tda-api?

tda-api is an unofficial wrapper around the TD Ameritrade APIs <https://developer.tdameritrade.com/apis>__. It strives to be as thin and unopinionated as possible, offering an elegant programmatic interface over each endpoint. Notable functionality includes:

  • Login and authentication
  • Quotes, fundamentals, and historical pricing data
  • Options chains
  • Streaming quotes and order book depth data
  • Trades and trade management
  • Account info and preferences

How do I use tda-api?

For a full description of tda-api's functionality, check out the documentation <https://tda-api.readthedocs.io/en/stable/>__. Meawhile, here's a quick getting started guide:

Before you do anything, create an account and an application on the TD Ameritrade developer website <https://developer.tdameritrade.com/>__. You'll receive an API key, also known as a Client Id, which you can pass to this wrapper. You'll also want to take note of your callback URI, as the login flow requires it.

Next, install tda-api:

.. code-block:: python

pip install tda-api

You're good to go! To demonstrate, here's how you can authenticate and fetch daily historical price data for the past twenty years:

.. code-block:: python

from tda import auth, client import json

token_path = '/path/to/token.pickle' api_key = '[email protected]' redirect_uri = 'https://your.redirecturi.com' try: c = auth.client_from_token_file(token_path, api_key) except FileNotFoundError: from selenium import webdriver with webdriver.Chrome() as driver: c = auth.client_from_login_flow( driver, api_key, redirect_uri, token_path)

r = c.get_price_history('AAPL', period_type=client.Client.PriceHistory.PeriodType.YEAR, period=client.Client.PriceHistory.Period.TWENTY_YEARS, frequency_type=client.Client.PriceHistory.FrequencyType.DAILY, frequency=client.Client.PriceHistory.Frequency.DAILY) assert r.status_code == 200, r.raise_for_status() print(json.dumps(r.json(), indent=4))

Why should I use tda-api?

tda-api was designed to provide a few important pieces of functionality:

  1. Safe Authentication: TD Ameritrade's API supports OAuth authentication, but too many people online end up rolling their own implementation of the OAuth callback flow. This is both unnecessarily complex and dangerous. tda-api handles token fetch and refreshing for you.

  2. Minimal API Wrapping: Unlike some other API wrappers, which build in lots of logic and validation, tda-api takes raw values and returns raw responses, allowing you to interpret the complex API responses as you see fit. Anything you can do with raw HTTP requests you can do with tda-api, only more easily.

Why should I not use tda-api?

Unfortunately, the TD Ameritrade API does not seem to expose any endpoints around the papermoney <https://tickertape.tdameritrade.com/tools/papermoney -stock-market-simulator-16834>__ simulated trading product. tda-api can only be used to perform real trades using a TD Ameritrade account.

What else?

We have a Discord server <https://discord.gg/nfrd9gh>__! You can join to get help using tda-api or just to chat with interesting people.

Bug reports, suggestions, and patches are always welcome! Submit issues here <https://github.com/alexgolec/tda-api/issues>__ and pull requests here <https://github.com/alexgolec/tda-api/pulls>__.

tda-api is released under the MIT license <https://github.com/alexgolec/tda-api/blob/master/LICENSE>__.

Disclaimer: tda-api is an unofficial API wrapper. It is in no way endorsed by or affiliated with TD Ameritrade or any associated organization. Make sure to read and understand the terms of service of the underlying API before using this package. This authors accept no responsibility for any damage that might stem from use of this package. See the LICENSE file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].