td_optionChain: Get Options Chain

Description Usage Arguments Details Value Examples

View source: R/other.R

Description

Search an Option Chain for a specific ticker

Usage

1
2
3
4
5
6
7
8
td_optionChain(
  ticker,
  strikes = 10,
  inclQuote = TRUE,
  startDate = Sys.Date(),
  endDate = Sys.Date() + 360,
  accessToken = NULL
)

Arguments

ticker

underlying ticker for the options chain

strikes

the number of strikes above and below the current strike

inclQuote

set TRUE to include pricing details (will be delayed if account is set for delayed quotes)

startDate

the start date for expiration (should be greater than or equal to today). Format: yyyy-mm-dd

endDate

the end date for expiration (should be greater than or equal to today). Format: yyyy-mm-dd

accessToken

A valid Access Token must be set using td_auth_accessToken. The most recent Access Token will be used by default unless one is manually passed into the function.

Details

Return a list containing two data frames. The first is the underlying data for the symbol. The second item in the list is a data frame that contains the options chain for the specified ticker.

Value

a list of 2 data frames - underlying and options chain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

# Pull all option contracts expiring over the next 6 months
# with 5 strikes above and below the at-the-money price
td_optionChain(ticker = 'SPY',
             strikes = 5,
             endDate = Sys.Date() + 180)


## End(Not run)

rameritrade documentation built on Feb. 22, 2021, 5:07 p.m.