joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
822 stars 224 forks source link

GetOptionChain() doesn't work #266

Closed wen7722 closed 5 years ago

wen7722 commented 5 years ago

Hi, I met some problem here that the option info is now inaccessible though I don't need volume data at all. Screen Shot 2019-05-01 at 2 52 56 AM

joshuaulrich commented 5 years ago

Thanks for the report! I can replicate.

getOptionChain("AAPL", Exp = NULL)
# Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = bid,  : 
#   object 'volume' not found
joshuaulrich commented 5 years ago

I ran your example again just now, and it worked. Seems like this may have been an intermittent service disruption with the Yahoo Finance servers.

R> aapl <- quantmod::getOptionChain("AAPL", Exp = NULL)
R> str(aapl)
List of 16
 $ May.03.2019:List of 2
  ..$ calls:'data.frame':   36 obs. of  7 variables:
  .. ..$ Strike: num [1:36] 150 155 160 165 168 ...
  .. ..$ Last  : num [1:36] 61.2 56.1 49 44.2 43.8 ...
  .. ..$ Chg   : int [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Bid   : num [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Ask   : int [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Vol   : int [1:36] 2 1 1 139 1 37 6 37 1 93 ...
  .. ..$ OI    : int [1:36] 183 8 155 157 12 129 60 183 35 476 ...
  ..$ puts :'data.frame':   27 obs. of  7 variables:
  .. ..$ Strike: num [1:27] 150 155 160 162 165 ...
  .. ..$ Last  : num [1:27] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ...
  .. ..$ Chg   : int [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Bid   : num [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Ask   : int [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Vol   : int [1:27] 71 1 4 6 1 9 14 30 69 85 ...
  .. ..$ OI    : int [1:27] 0 0 0 0 0 0 0 0 0 0 ...
joshuaulrich commented 5 years ago

I'm closing this because this appears to be working, and is not something we can fix by changing quantmod.