How to work with Google Finance?

I want to develop a small application in order to automatically get the stock price of Google Finance and save it on my local machine for future analysis.

Can someone tell me how to start?

I know some C #. Would it be suitable for this purpose?

Thanks in advance.

+6
google-finance
Jul 17 2018-12-12T00:
source share
3 answers

The Google Finance Gadget API has been officially deprecated since October 2012 , but as of April 2014 it is still active:

http://www.google.com/finance/info?q=NASDAQ:ADBE

Please note that if your application is for public consumption, the use of the Google Finance API is against the Google Terms of Service .

This gives a JSON response, which can be parsed using a simple JSON parser in C # after chopping the first two characters ('//').

To download historical data again, you can use the Google API.

http://www.google.com/finance/historical?q=NASDAQ:ADBE&startdate=Jan+01%2C+2009&enddate= August + 2% 2C + 2012 & exit = CSV

issues CSV prices at the end of the day, starting from the start date to the end. Use a simple CSV parser to get meaningful data from this storage on your db. However, this format = csv does not work for multiple exchanges.

+13
Aug 02 2018-12-12T00:
source share

If you want to download historical data, you can use the Google Finance API (which still works since May 2016). You do not need to specify an end date, it will automatically retrieve data from the start date (or later, if the shares are not trading) until the last full transaction date:

http://www.google.com/finance/historical?q=NASDAQ:AAPL&startdate=Jan+01%2C+2000&output=csv

Keep in mind that the Google Finance APIs are for personal use only. I offer you my terms of service.

If you just want to download the latest date (which may be useful for updating the local db), you can use the googlefinance library developed by Hongtao Cai:

https://pypi.python.org/pypi/googlefinance

+3
May 13 '16 at 15:47
source share

I just implemented this with PHP. This may be helpful.

<?php echo readGoogle('AAPL', 'Aug+21%2C+2017', 'Aug+22%2C+2017'); function readGoogle($ticker, $startDate, $endDate) { $fp = fopen("http://finance.google.com/finance/historical?q=".$ticker."&startdate=".$startDate."&enddate=".$endDate."&output=csv", 'r'); if (FALSE === $fp) return 'Can not open data.'; $buffer = ''; while (!feof($fp)) $buffer .= implode(',', (array)fgetcsv($fp, 5000)); fclose($fp); return $buffer; } ?> 
+2
Aug 22 '17 at 15:19
source share



All Articles