Returns a list of option chains for a specific underlying instrument. The request must specify an instrument, and can include the month the option expires and to show calls, puts, or both. Values returned include the option pair count and information about each option pair, including the type, call count, symbol, product, date, and strike price.
etrd_option_chain(
symbol = "SPY",
expiryYear = NULL,
expiryMonth = NULL,
expiryDay = NULL,
strikePriceNear = NULL,
noOfStrikes = NULL,
includeWeekly = "false",
skipAdjusted = "true",
optionCategory = NULL,
chainType = NULL,
priceType = NULL,
output = c("df", "list"),
access_tokens = NULL,
etrade_cred = NULL,
sandbox = FALSE
)
The market symbol for the instrument
Indicates the expiry year corresponding to which the optionchain needs to be fetched
Indicates the expiry month corresponding to which the optionchain needs to be fetched
Indicates the expiry day corresponding to which the optionchain needs to be fetched
The optionchians fetched will have strike price nearer to this value
Indicates number of strikes for which the optionchain needs to be fetched
The include weekly options request. Default: false. Can also be true
The skip adjusted request. Default: true. Can also be false
The option category. Default: STANDARD. options include: STANDARD, ALL, MINI
The type of option chain. Default: CALLPUT. Options include: CALL, PUT, CALLPUT
The price type. Default: ATNM. Options include ATNM, ALL
Indicate whether the output should be in the form of a data frame ('df') or list ('list'). Data frame is returned by default.
Access tokens are created using
etrd_auth_access_token
. This entry is not required because
the output is saved and retrieved from R options automatically.
The output created from
etrd_auth_credentials
when a valid ETRADE key and secret have
been passed. This entry is not required because the output is saved and
retrieved from R options automatically.
ETRADE offers a sandbox environment for validating API calls and responses. If using the sandbox environment, this must be set to TRUE in each function called throughout etrader. ETRADE states "Sandbox responses use stored data that's intended to provide typical responses for basic use cases. So the responses you receive will not contain current data, and may not exactly match your requests in other ways." Essentially, the responses will not match the requests entered but successful pull will indicate whether the entry was valid or not.
a list or data frame of options chains
if (FALSE) {
# Get SPY Expirations
etrd_option_chain('SPY')
}