PPaste!

LoL.py

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
import datetime
import dateutil
import sys
import tda

API_KEY = 'XXXXXX@AMER.OAUTHAP'
REDIRECT_URI = 'http://localhost:8080/'
TOKEN_PATH = 'ameritrade-credentials.json'

try:
    client = auth.client_from_token_file(TOKEN_PATH, API_KEY)

except FileNotFoundError:
    from selenium import webdriver

    with webdriver.Chrome() as driver:
        client = auth.client_from_login_flow(driver, API_KEY, redirect, TOKEN_PATH)

response = client.get_quote("AAPL")
print(response.json())