Friday, April 13, 2018

Goodbye Google, Hello Tiingo!

First, the bad news:

Google Finance no longer provides data for historical prices or financial statements, so we say goodbye to and (#221)  They are now defunct as of quantmod 0.4-13.

Now, the good news:

Thanks to Steve Bronder, getSymbols() can now import data from Tiingo! (#220)  This feature is part of quantmod 0.4-13, which is now on CRAN.  Windows and Mac binaries should be built in a day or two.

Tiingo is a web service that provides tools and data for financial analysis.  They provide daily price history for US stocks and ADRs, Chinese stocks, Mutual Funds, and ETFs.  There is up to 30+ years of history, including raw prices and split/dividend adjusted prices.

All this data is accessible for free, with reasonable symbol and bandwidth limits.  All you need to get started is a one-time registration for an API token.  You should see your API token just above the beginning of the metadata section, after logging in, of course.  Tiingo has a well-documented daily price data API that returns either JSON or CSV.

To get started, install the latest quantmod from CRAN.  Then you call:

  getSymbols("MSFT", src = "tiingo", api.key = "[your key]") 

Where you replace "[your key]" with the API key you receive after registration.  You can use setDefaults() to set your API key one time, and use it for all getSymbols.tiingo() calls.

  setDefaults("getSymbols.tiingo", api.key = "[your key]")

Other notable changes:
  • There is now a getQuote.alphavantage() that allows you to pull real-time quotes from Alpha Vantage.  Thanks to Ethan Smith! (#213, #223)
  • Speaking of Alpha Vantage, getSymbols.av() can now pull weekly and monthly adjusted prices. (#212)
  • The URL in getSymbols.oanda() and getFX() has been updated, so they work again. (#225)
  • no longer errors when a field has no data for all requested tickers. (#208)
  • saveChart() actually saves charts now (#154). Brilliant!