(Python) TD API, pricehistory is returning 15 days of data no matter what I ask for.

While attempting to make an authenticated request for GOOG price history, TD Ameritrade's API will return 4210, 1 minute candles with epoch times beginning at 160. I'm expecting 365 candles, 1 per day, with an epoch starting with 157. The exact same parameters work fine on TD's API information page. In my code, no matter what parameters are in payload, TD returns the same information. It won't even throw an error. It's like payload is being ignored completely and a default query is being made. Pricehistory seems to be the only endpoint that is exhibiting this behaviour. I could work around this by calculating epoch time and inserting as start and end points, but the API should give me what I ask for without having to do that extra work.

url = "https://api.tdameritrade.com/v1/marketdata/GOOG/pricehistory" headers = {"Authorization":"Bearer " + access_token} payload = {"periodType":"year", "period":"1", "frequencyType":"daily", "frequency":"1"} authReply = requests.get(url, headers = headers, data = payload) 

Submitted November 02, 2020 at 10:23PM by FangPiZhuanJia
via https://ift.tt/3oLFDr3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s