Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getSymbols.tiingo

Download OHLC Data from Tiingo


Description

Downloads historical or realtime equity price data from https://api.tiingo.com/. Registration is required.

Usage

getSymbols.tiingo(Symbols, env, api.key,
                    return.class="xts",
                    periodicity="daily",
                    adjust=FALSE,
                    from='2007-01-01',
                    to=Sys.Date(),
                    data.type="json",
                    ...)

Arguments

Symbols

a character vector specifying the names of the symbols to be loaded

env

where to create objects (environment)

api.key

the API key issued by Tiingo when you registered (character)

return.class

class of returned object, see Value (character)

periodicity

one of "daily", "weekly", "monthly", or "Annually"

adjust

adjust for dividends and splits? (FALSE)

from

Retrieve data no earlier than this date. (2007-01-01)

to

Retrieve data through this date (Sys.Date())

data.type

either "json" or "csv"

...

additional parameters as per getSymbols

Details

Meant to be called internally by getSymbols only. This method is not meant to be called directly, instead a call to getSymbols("x", src="tiingo") will in turn call this method. It is documented for the sole purpose of highlighting the arguments accepted.

You must register with Tiingo in order to download their data. Register at their web site, https://api.tiingo.com, and you will receive an API key: a short string of alphanumeric characters (e.g., "FU4U"). Provide the API key every time you call getSymbols; or set it globally using setDefaults(getSymbols.tiingo, api.key="yourKey").

Tiingo provides daily, weekly, monthly, and annual data. Use periodicity to select one. This API accessor will return adjusted or unadjusted OHLC as well as split and dividend information.

For daily, weekly, and monthly data, Tiingo says the available data is up to 30 years;

Tiingo provides access to data via two APIs. You can choose the API via the data.type argument. data.type="json", the default, will import data using the JSON API. This API includes additional metadata (e.g. last updated time, timezone, etc) that is not provided via the CSV API.

Value

A call to getSymbols(Symbols, src="tiingo") will create objects in the specified environment, one object for each Symbol specified. The object class of the object(s) is determined by return.class. Presently this may be "ts", "zoo", "xts", or "timeSeries".

Author(s)

Steve Bronder

References

Tiingo documentation available at https://www.tiingo.com

See Also

Examples

## Not run: 
# You'll need the API key given when you registered
getSymbols("IBM", src="tiingo", api.key="yourKey")

# Repeating your API key every time is tedious.
# Fortunately, you can set a global default.
setDefaults(getSymbols.tiingo, api.key="yourKey")
getSymbols("IBM", src="tiingo")

## End(Not run)

quantmod

Quantitative Financial Modelling Framework

v0.4.18
GPL-3
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Wouter Thielen [ctb], Paul Teetor [ctb], Steve Bronder [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.