Created
July 27, 2018 21:01
-
-
Save akhan118/f59bb06799ce16f20fe01933c7775bc5 to your computer and use it in GitHub Desktop.
Get Access Token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_access_token(self): | |
| #Post Access Token Request | |
| headers = { 'Content-Type': 'application/x-www-form-urlencoded' } | |
| data = { 'grant_type': 'refresh_token', 'refresh_token': self.refresh_token, | |
| 'client_id': self.client_id, 'redirect_uri': 'http://localhost:8080'} | |
| authReply = requests.post('https://api.tdameritrade.com/v1/oauth2/token', headers=headers, data=data) | |
| return authReply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Greetings AKhan118. Thank you for posting your TDAmeritrade python code. I have a friend who's asked me to write a program to automate his transactions on his TDAmeritrade account based on a variety of rules he has using some technical analysis indicators. Rather than reinvent the wheel (not that I could), I was wondering whether your code above is what is used to obtain the TDA authentication token initially? or do you have to contact a TDA broker to obtain the initial auth token? Thanks in advance for any insight you might share.. m