Closed viewasia closed 4 years ago
Sorry for my slow reply, and thanks for the report! I can replicate, and will investigate.
R> a <- quantmod::getOptionChain("SPY", "2019/2020")
Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = bid, :
object 'openinterest' not found
Likewise, for symbol 'V', package throws error Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = bid, : object 'volume' not found
Execution: getOptionChain("V", "2019/2020")
I just ran this code, and I can not replicate the issue.
R> tk <- c("SPY", "V", "MSFT", "F")
R> opts <- setNames(lapply(tk, getOptionChain, Exp = "2020"), tk)
R> lapply(opts, names)
$SPY
[1] "Feb.24.2020" "Feb.26.2020" "Feb.28.2020" "Mar.02.2020" "Mar.04.2020"
[6] "Mar.06.2020" "Mar.09.2020" "Mar.11.2020" "Mar.13.2020" "Mar.16.2020"
[11] "Mar.18.2020" "Mar.20.2020" "Mar.23.2020" "Mar.25.2020" "Mar.27.2020"
[16] "Mar.31.2020" "Apr.03.2020" "Apr.17.2020" "May.15.2020" "Jun.19.2020"
[21] "Jun.30.2020" "Jul.17.2020" "Sep.18.2020" "Sep.30.2020" "Oct.16.2020"
[26] "Nov.20.2020" "Dec.18.2020" "Dec.31.2020"
$V
[1] "Feb.28.2020" "Mar.06.2020" "Mar.13.2020" "Mar.20.2020" "Mar.27.2020"
[6] "Apr.03.2020" "May.15.2020" "Jun.19.2020" "Sep.18.2020" "Dec.18.2020"
$MSFT
[1] "Feb.28.2020" "Mar.06.2020" "Mar.13.2020" "Mar.20.2020" "Mar.27.2020"
[6] "Apr.03.2020" "Apr.17.2020" "May.15.2020" "Jun.19.2020" "Jul.17.2020"
[11] "Sep.18.2020" "Dec.18.2020"
$F
[1] "Feb.28.2020" "Mar.06.2020" "Mar.13.2020" "Mar.20.2020" "Mar.27.2020"
[6] "Apr.03.2020" "Jun.19.2020" "Sep.18.2020"
This suggests it was an intermittent problem with the Yahoo Finance servers, so I'm closing this issue.
Description
Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = bid, : object 'openinterest' not found
Expected behavior
Should return option chain given the time frame for specified symbol
Minimal, reproducible example