getOptionChain | R Documentation |
Function to download option chain data from data providers.
getOptionChain(Symbols, Exp = NULL, src="yahoo", ...)
Symbols |
The name of the underlying symbol. Source ‘yahoo’ only allows for a single ticker while source ‘orats’ can return multiple tickers. |
Exp |
One or more expiration dates, NULL, or an ISO-8601 style string.
If |
src |
Source of data. One of ‘yahoo’ or ‘orats’ with a default of ‘yahoo’. |
... |
Additional parameters. |
This function is a wrapper to data-provider specific APIs. By default the data is sourced from yahoo.
A named list containing two data.frames, one
for calls and one for puts. If more than one
expiration was requested, this two-element list
will be contained within list of length length(Exp)
.
Each element of this list will be named with the expiration
month, day, and year (for Yahoo sourced data).
If Exp
is set to NULL
, all expirations
will be returned. Not explicitly setting will only
return the front month.
Jeffrey A. Ryan, Joshua M. Ulrich, Steve Bronder
https://finance.yahoo.com, https://docs.orats.io/datav2-api-guide/data.html#strikes
getOptionChain.orats
## Not run:
# Only the front-month expiry
AAPL.OPT <- getOptionChain("AAPL")
# All expiries
AAPL.OPTS <- getOptionChain("AAPL", NULL)
# All 2015 and 2016 expiries
AAPL.2015 <- getOptionChain("AAPL", "2015/2016")
# Using orats backend
NFLX.AAPL.2021 <- getOptionChain(c("NFLX", "AAPL"), "2021", src = "orats",
api.key = Sys.getenv("ORATS_API_KEY"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.