Meant to be called internally by getSymbols
only.
This method is not meant to be called directly, instead
a call to getSymbols("x", src="av")
will
in turn call this method. It is documented for the
sole purpose of highlighting the arguments accepted.
You must register with Alpha Vantage in order to download their data,
but the one-time registration is fast and free.
Register at their web site, https://www.alphavantage.co/,
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.av, api.key="yourKey")
.
The Alpha Vantage site provides daily, weekly, monthly, and intraday data.
Use periodicity
to select one.
Note that intraday data will includes today's data (delayed) if downloaded
while the market is open, which is pretty cool.
Set adjusted=TRUE
to include a column of closing prices adjusted for
dividends and stock splits (available only for daily, weekly, and monthly data).
The intraday data is provided as a sequence of OHLC bars.
Use the interval
argument to determine the "width" of the bars:
1 minute bars, 5 minutes bars, 15 minutes bars, etc.
By default Alpha Vantage returns the 100 most-recent data points (output.size="compact"
).
Set output.size="full"
to obtain the entire available history.
For daily, weekly, and monthly data, Alpha Vantage says the available data is up to 20 years;
for intraday data, the available history is the most recent 10 or 15 days.
Be forewarned that downloading full
data requires more time than compact
data, of course.
Alpha Vantage 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.