av_get | R Documentation |
Get financial data from the Alpha Vantage API
av_get(symbol, av_fun, ...)
symbol |
A character string of an appropriate stock or fund. See parameter "symbol" in Alpha Vantage API documentation. |
av_fun |
A character string matching an appropriate Alpha Vantage "function". See parameter "function" in Alpha Vantage API documentation. |
... |
Additional parameters passed to the Alpha Vantage API. For a list of parameters, visit the Alpha Vantage API documentation. |
The av_fun
argument replaces the API parameter “function” because function is a reserved name in R. All other arguments match the Alpha Vantage API parameters.
There is no need to specify the apikey
parameter as an argument to av_get(). The required method is to set the API key using av_api_key("YOUR_API_KEY").
There is no need to specify the datatype parameter as an argument to av_get(). The function will return a tibble data frame.
Some data sets only return 100 rows by default. Change the parameter outputsize = "full"
to get the full dataset.
Get more than one symbol. The Alpha Vantage API is setup to return one symbol
per API call. Use the tidyquant::tq_get()
API to get multiple symbols.
ForEx "FROM/TO" symbol details. FOREX symbols in the av_get()
function are
supplied in "FROM/TO"
format, which are then parsed in the Alpha Vantage API
into from_currency
and to_currency
API parameters. Usage example:
av_get(symbol = "EUR/USD", av_fun = "FX_DAILY")
Returns a tibble of financial data
av_api_key()
## Not run:
# SETUP API KEY
av_api_key("YOUR_API_KEY")
# ---- 1.0 STOCK TIME SERIES ----
# 1.1 TIME SERIES INTRADAY
av_get("MSFT", av_fun = "TIME_SERIES_INTRADAY", interval = "5min", outputsize = "full")
# 1.2 TIME SERIES DAILY ADJUSTED
av_get("MSFT", av_fun = "TIME_SERIES_DAILY_ADJUSTED", outputsize = "full")
# 1.3 QUOTE ENDPOINTS
av_get("MSFT", av_fun = "GLOBAL_QUOTE")
# ---- 2.0 FOREX ----
# 2.1 CURRENCY EXCHANGE RATES
av_get("EUR/USD", av_fun = "CURRENCY_EXCHANGE_RATE")
# 2.2 FX INTRADAY
av_get("EUR/USD", av_fun = "FX_INTRADAY", interval = "5min", outputsize = "full")
# 2.3. FX DAILY
av_get("EUR/USD", av_fun = "FX_DAILY", outputsize = "full")
# ---- 3.0 TECHNICAL INDICATORS ----
# 3.1 SMA
av_get("MSFT", av_fun = "SMA", interval = "weekly", time_period = 10, series_type = "open")
# ---- 4.0 SECTOR PERFORMANCE ----
# 4.1 Sector Performance
av_get(av_fun = "SECTOR")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.