Tuesday, March 12, 2013

Grails Plugin for Yahoo Finance

I've recently experimented on taking web-services JSON response and automatically putting these into java object/s. So playing around with Yahoo YQL resulted in this Grails open-source plugin. It has been approved recently and is located in github.

Github - ibaralf YahooFinance

After installing the plugin, it gives the user several methods to retrieve company stock statistics as well as stock historical data.

In a service or controller:

You can call the methods available in the YahooFinanceYQLService.
  • yahooFinanceYQLService.quote(String symbols)
  • yahooFinanceYQLService.quote(String symbols, String statistics)
  • yahooFinanceYQLService.getHistoricalQuotes(String symbol, int numberOfDays)
  • yahooFinanceYQLService.getHistoricalQuotes(String symbol, String startDate, String endDate)
  • yahooFinanceYQLService.getHistoricalQuotes(String symbol, Date startDate, Date endDate)
  • yahooFinanceYQLService.availableStats - list of all statistics that can be retrieved.

NOTE: One thing peculiar with Yahoo web-services (especially their finance service), there seems to be 2 different web-services running, first - the Yahoo Query Language YQL and the other web-service that returns CSVs as explained here in gummy-stuff website. The plugin implements both, but ended up using the CSV service since it seems to be more reliable.

* IMPORTANT: PLEASE READ

* I do not guarantee the reliability or availability of the Yahoo web services.
* I am not qualified, licensed, approved or authorized to make any investment recommendations or give any such advice.
* All data and information on this site is based on data from sources that are not under my control.
* I cannot guarantee the accuracy of any of the data, in fact I know of some significant data problems such as, but not limited to, incorrect stock splits that lead to radically incorrect prices.
* No investing decision should be taken based on the information on this site alone, and none of the information here is a recommendation to buy or sell any security!!
* Do the appropriate further analysis and due diligence before investing.
* I make no guarantees whatsoever about future returns using the methods.