[R-SIG-Finance] quantmod getOptionChain error on yahoo

Joshua Ulrich jo@h@m@u|r|ch @end|ng |rom gm@||@com
Fri May 3 13:22:20 CEST 2019


On Thu, May 2, 2019 at 6:58 PM Rock Pereira <pereira_rock using hotmail.com> wrote:
>
> I have downloaded option chains daily, for over a year, using a cronjob with Rscript. But a few days ago, I got this error:
>
> "
>
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = bid, : object 'volume' not found
>
> "

This had been reported: https://github.com/joshuaulrich/quantmod/issues/266

I could replicate the issue yesterday, but did not had time to
investigate.  I tried to run the example again today, and it worked.

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 ...


> I'd like some help with this error. My code is below
>
> -------
> library(quantmod)
> symbols <- as.character( read.csv("list_OPTIONS.txt", header=FALSE, sep=",", stringsAsFactors = FALSE)[,1] )
> options <- sapply(symbols, function(s) getOptionChain(s, Exp=NULL, src='yahoo'))
> rdsFilename <- paste0("opt_", format(Sys.Date(),"%Y%m%d"), ".rds")
> saveRDS(options, rdsFilename)
> ------
>
Thanks for the example.  Next time, please provide a reproducible
example that others can run.  We don't have your file
(list_OPTIONS.txt).

> Thanks,
> Rock Pereira
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2019 | www.rinfinance.com



More information about the R-SIG-Finance mailing list