getOptionChain
scrapes the data from Yahoo's webpage. Yahoo only provides data by expiration month, not by the specific day.
You can use the expiry
function in the greeks package to determine which contracts expire on a specific day:
> head(try1$puts[as.Date(expiry(rownames(try1$puts))) == "2014-04-19",])
Strike Last Chg Bid Ask Vol OI
AAPL140419P00200000 200 0.05 0 NA NA 1 37
AAPL140419P00205000 205 0.15 0 NA NA 0 25
AAPL140419P00210000 210 0.35 0 NA NA 0 11
AAPL140419P00215000 215 0.01 0 NA NA 2 9
AAPL140419P00220000 220 0.13 0 NA NA 0 23
AAPL140419P00225000 225 0.80 0 NA NA 0 12
Note that you will have to build and install the greeks package from source yourself.
Or you can grep for the date yourself:
> head(try1$puts[grepl("140419", rownames(try1$puts)),])
Strike Last Chg Bid Ask Vol OI
AAPL140419P00200000 200 0.05 0 NA NA 1 37
AAPL140419P00205000 205 0.15 0 NA NA 0 25
AAPL140419P00210000 210 0.35 0 NA NA 0 11
AAPL140419P00215000 215 0.01 0 NA NA 2 9
AAPL140419P00220000 220 0.13 0 NA NA 0 23
AAPL140419P00225000 225 0.80 0 NA NA 0 12