getOptionChain.orats {quantmod} | R Documentation |
Download Option Chain Data from orats
Description
Function to download option chain data from orats.
Usage
getOptionChain.orats(Symbols, Exp, api.key, dte, delta)
Arguments
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 |
api.key |
A character vector for the key given with an account for
accessing the orats API. If missing, the function will look for an
environment variable |
dte |
A vector of two integers giving a range of expiry dates to subset the results by. |
delta |
A vector of two integers giving a range deltas to subset the results by. |
Details
This function is a wrapper to data-provider specific APIs. By default the data is sourced from yahoo.
Value
For orats, returns A named list containing five data.frames, one
each for calls and puts that follows a similar form to the return
from yahoo, but does not have a Last price and instead has a
Ticker column for multiple ticker requests. The *_extra data.frames
contain additional information from the ‘orats’ API end point
whose definitions are available at the URL in the references.
If more than one expiration was requested, The results will be returned as
a list within list of length length(Exp)
.
Each element of this list will be named with the expiration
month, day, and year (%b.%d.%Y).
If Exp
is set to NULL
, all expirations
will be returned. Not explicitly setting will only
return the front month.
Author(s)
Steve Bronder
References
https://docs.orats.io/datav2-api-guide/data.html#strikes
Examples
## Not run:
# Only the front-month expiry
AAPL.OPT <- getOptionChain("AAPL",
api.key = Sys.getenv("ORATS_API_KEY"))
# All expiries
AAPL.OPTS <- getOptionChain("AAPL", NULL,
api.key = Sys.getenv("ORATS_API_KEY"))
# All 2015 and 2016 expiries
AAPL.2015 <- getOptionChain("AAPL", "2015/2016",
api.key = Sys.getenv("ORATS_API_KEY"))
## End(Not run)