GivenX
GivenX

Reputation: 525

Date parameters for Google Finance API not working

I am trying to pull over end-of-day share prices going back in time. The code below provides exactly what I need but it appears that that the year/month/day parameters do not work.

import requests

params={'q': 'NASDAQ:AAPL', 'expd': 10, 'expm': 3, 'expy': 2018, 'output': 'json'}
response = requests.get('https://finance.google.com/finance', params=params, allow_redirects=False, timeout=10.0)
print(response.content)

The closing price for this is "l" : "178.65" which is the most recent closing price (15 March) and not for 10 March as specified. I am assuming I cannot rely on this service as it is no longer supported by Google but would be good if someone can confirm if I am correct around the dates not working or if I am missing something.

Upvotes: 4

Views: 752

Answers (3)

Loathing
Loathing

Reputation: 5266

Well, up until this morning this used to work:

http://finance.google.com/finance/historical?q=NASDAQ:msft&output=csv&startdate=Mar+15%2c+2018&enddate=Mar+15%2c+2018

I asked two other people to confirm on different ISPs and we all get the same error message:

We're sorry... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now. See Google Help for more information.

Upvotes: 1

Mabus
Mabus

Reputation: 1493

This URL still works:

https://finance.google.co.uk/bctzjpnsun/historical?q=NASDAQ:msft&output=csv&startdate=Mar+15%2c+2018&enddate=Mar+15%2c+2018

I recommend you to make a copy of the data ASAP though, because Google will probably close this other link soon.

Upvotes: 1

Wang Nick
Wang Nick

Reputation: 11

same here: https://finance.google.com/finance/historical?q=AAPL&output=csv

it looks like google close finance api or change path.

Upvotes: 1

Related Questions