R/req_sec_def_opt_params.R
req_sec_def_opt_params.RdUse this function to request the strike prices and expiry dates for options
that are available for a specified underlying contract. While the same
information could be obtained via req_contract_details(),
req_sec_def_opt_param() is not subject to data pacing (throttling) and
is optimized for retreiving strike prices & expiry dates.
req_sec_def_opt_params( underlyingSymbol = "", futFopExchange = "", underlyingSecType = "", underlyingConId = "", channel = NULL )
| underlyingSymbol | Character, length 1. Symbol of the underlying contract, e.g., "AAPL". |
|---|---|
| futFopExchange | Character, length 1. Exchange where fetched options trade, e.g., "NASDAQOM" |
| underlyingSecType | Character, length 1. The type of the underlying security. See SecType in the contract documentation. |
| underlyingConId | Character or numeric, length 1. The |
| channel | One of the following:
|
A 1-row tibble with the following columns:
exchange <chr>: See contract
underlyingConId <numeric>: Unique numeric conId of
underlying contract; See contract
tradingClass <chr>: See contract
multiplier <numeric>: See contract
expirations <list of POSIXt Date Objects>: Expiry dates of
put & call options traded on exchange for the contract whose
conId is passed as argument underlyingConId
expirations <list of Numeric Objects>: Strike prices of put
& call options traded on exchange for the contract whose
conId is passed as argument underlyingConId
Other asset info:
req_contract_details(),
req_matching_symbols()
# Query Option Parameters for IBM Stock ibm_opt_params <- req_sec_def_opt_params( underlyingSymbol = "IBM", underlyingSecType = "STK", underlyingConId = 8314 ) # Print the params: ibm_opt_params#> # A tibble: 1 x 6 #> exchange underlyingConId tradingClass multiplier expirations strikes #> <chr> <dbl> <chr> <dbl> <list> <list> #> 1 NASDAQOM 8314 IBM 100 <date [15]> <dbl [100]># Print just the strike prices: ibm_opt_params$strikes#> [[1]] #> [1] 50.0 55.0 60.0 65.0 70.0 75.0 80.0 81.0 82.0 83.0 84.0 85.0 #> [13] 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 #> [25] 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 #> [37] 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 120.0 121.0 #> [49] 122.0 123.0 124.0 125.0 126.0 127.0 128.0 129.0 130.0 131.0 132.0 133.0 #> [61] 134.0 135.0 136.0 137.0 138.0 139.0 140.0 141.0 142.0 143.0 144.0 145.0 #> [73] 146.0 147.0 148.0 149.0 150.0 152.5 155.0 157.5 160.0 162.5 165.0 167.5 #> [85] 170.0 172.5 175.0 177.5 180.0 182.5 185.0 187.5 190.0 195.0 200.0 205.0 #> [97] 210.0 215.0 220.0 225.0 #>#> [1] 123.5# Print just the expirations: ibm_opt_params$expirations#> [[1]] #> [1] "2020-03-20" "2020-03-27" "2020-04-03" "2020-04-09" "2020-04-17" #> [6] "2020-04-24" "2020-05-01" "2020-05-15" "2020-06-19" "2020-07-17" #> [11] "2020-09-18" "2020-10-16" "2020-12-18" "2021-01-15" "2022-01-21" #>#> [1] "2022-01-21"