Market you're requesting data from is one of the valid options. Request Validationįor certain requests, in a limited fashion, it will help validate your request when possible.įor example, when using the get_movers endpoint, it will automatically validate that the With expired tokens (refresh token or access token). get_quotes ( instruments = ) Features Authentication Workflow SupportĪutomatically will handle the authentication workflow for new users, returning users, and users get_quotes ( instruments = ) # Grab real-time quotes for 'AMZN' (Amazon) and 'SQ' (Square) multiple_quotes = TDSession. login () # Grab real-time quotes for 'MSFT' (Microsoft) msft_quotes = TDSession. TDSession = TDClient ( client_id = '', redirect_uri = '', credentials_path = '' ) # Login to the session TDSession. # Import the client from td.client import TDClient # Create a new session, credentials path is required. Store your tokens in a JSON file located in a folder called Credentials located under Specify the credentials_path as C:\Users\Public\Credentials\td_state.json it would Yourself so that you are aware of where the tokens will be stored. You must specify the credentials_path argument Like your refresh token and access token. Please note, that the credentials_path is a file path that will house the credentials Using the get_quotes endpoint, using your API key.
This example demonstrates how to login to the API and demonstrates sending a request
To upgrade the library run the following command: pip install -upgrade td-ameritrade-python-api The project can be found at PyPI, if you'd like to view the project please use Important: Your account number, an account password, consumer ID, and API key should
Your TD Ameritrade developer account, please refer toĪdditionally, to authenticate yourself using this library, you will need to provide yourĪccount number and password for your main TD Ameritrade account. Redirect URIs are generated from the TD Ameritrade developer portal.