1

I wanted to get historical data for a stock from google finance, how can I get it?

  • One method i know is using **jquery-Ajax** and scrape the whole table, but how will I then save it to my database i.e how will I pass my data to server side(Java servlet) through Jquery then?
CY5
  • 41
  • 1
  • 1
  • 8
  • You might as well get the data using the java servlet instead. – Kevin B Dec 19 '13 at 17:53
  • how can i get it in servlet? – CY5 Dec 19 '13 at 17:54
  • I have no idea, i'm not a java programmer. You should at least attempt to solve this on your own before asking here. All you have to do is send an HTTP request to the api that returns the data, parse the data, then insert into database. – Kevin B Dec 19 '13 at 17:55
  • Are you saying there is no API you can call and you have to scrape? – smk Dec 19 '13 at 17:56
  • @Kevin Google finance has deprecated Google finance Api, now i have only option of scraping, but after scraping and printing on html page how can I save the historical data into my database. – CY5 Dec 19 '13 at 18:03

1 Answers1

0

You can use the info provided here (Other Google Finance features - Exporting historical data) and create a function in PHP (or any other language) to fetch the CSV file, parse it, and save it to your database.

I can provide you with additional info if required.

  • Can i create a function in servlet to fetch the CSV file? – CY5 Dec 19 '13 at 18:07
  • I think you can, even though servlet are not my strongest point. Take a look at this (http://stackoverflow.com/questions/16374899/java-servlet-downloading-file) it might help you. – Vasilis Bankov Dec 19 '13 at 18:15