TD Amertrade Brokerage Setup - pattertj/LoopTrader GitHub Wiki

One-Time TD Ameritrade Setup

Using TD Ameritrade with LoopTrader requires a few steps outside of LoopTrader to get going:

  1. Have a TD Ameritrade brokerage account
  2. Setup a TD Ameritrade Developer account

After these three steps are completed, your TD Ameriprise account should be ready for LoopTrader.

Application Configuration

td-ameritrade-python-api Setup

Connecting to TD Ameritrade from LoopTrader leverages the td-ameritrade-python-api project. You will need to complete two steps for this package:

  1. Installation
  2. Authentication Workflow

LoopTrader Setup

The required configuration parameters should be set up in LoopTrader's config.yaml.

# TD Ameritrade Broker Variables
tdabroker:
   individual:
      clientid: ""
      account: ""
      url: ""
      credentials: ""
   ira:
      clientid: ""
      account: ""
      url: ""
      credentials: ""

This file should be renamed to "config.yaml" and updated with the values for your account.

  • "individual"/"ira" in the sample file can be renamed to whatever you would like to call your brokerage account setups. It should match the id you specify in main.py for your brokerage components.
  • clientid is a 32 character code from your TD Ameritrade Developer Account
  • account is your account number to trade against
  • url is the redirect specified during the setup of your TD Ameritrade Developer Account
  • credentials is a file path that will house the credentials like your refresh token and access token.