1

I am trying to download financial data of companies. I have used getFin() quite a lot without encountering any problem.

Right now, I am unable to download any data and when I use e.g. this code (and basically any other valid symbol instead of "AAPL"):

getFin("AAPL")

I get the following error message:

Error in download.file(paste(google.fin, Symbol, sep = ""), quiet = TRUE,  : 
cannot open URL 'http://finance.google.com/finance?fstype=ii&q=AAPL'
In addition: Warning message:
In download.file(paste(google.fin, Symbol, sep = ""), quiet = TRUE,  :
cannot open URL 'http://finance.google.com/finance?fstype=ii&q=AAPL': HTTP status was '403 Forbidden'

However, if I try to access the website http://finance.google.com/finance?fstype=ii&q=AAPL via a browser, I have no problem with accessing the website.

So why am I unable to download data with getFin() in RStudio all of the sudden?

Pat Amat
  • 23
  • 7

1 Answers1

0

Have you tried clearing your cache or going incognito and accessing the URL?

Assuming you are on a linux server and using PHP you could try updating your PHP version it should be on the Google finance api documentation

  • I am on Windows machine and have not cleared cache yet. Well, it is working again after a few minutes. Could this problem have encountered due to fact, that I used url.exists to check accessibility of several symbols (and eventually urls) and hence google prevented me from "misusing" the service? – Pat Amat Jan 02 '17 at 22:21
  • It could potentially be that, google is known to be a bit quick to penalise people for misusing services a simple code error can stop your web apps from working,have a look in the documentation to try and diagnose it so you will know for next time, glad you got it fixed Pat! – Harry-Robinson Jan 02 '17 at 22:25
  • I am thinking about using `Sys.sleep()`. I am just wondering how many seconds I should apply after what number of requests. – Pat Amat Jan 02 '17 at 22:40
  • Try duplicating the website onto another domain and hosting account and experimenting on it, that would be the best way to find the boundaries google have set, it's a shot In the dark but that would be the best way to find out, good luck!!!! – Harry-Robinson Jan 02 '17 at 22:45
  • Well, I am encountering this problem once again. The only difference is that instead of `HTTP status was '403 Forbidden'` I get `HTTP status was '503 Service Unavailable'`. – Pat Amat Jan 02 '17 at 22:48
  • Yeah it definitely looks like a penalty, Try dropping google an email and duplicating the site and testing it on another domain name, if it works first time it's a Google penalty if it doesn't work it will be a code error – Harry-Robinson Jan 02 '17 at 22:53