[R-SIG-Finance] Trying to Extract Option Quotes with R
Joshua Ulrich
josh.m.ulrich at gmail.com
Sat May 13 15:53:13 CEST 2017
On Fri, May 12, 2017 at 3:39 PM, Robert Sherry <rsherry8 at comcast.net> wrote:
> Joshua and Frank,
>
> Thanks for your responses. I am using version 3.2.2 of R. I
> installed/reinstalled jsonlite and curl. I still get the same problem. I
> then updated my version of quantmod. After doing this, I ran the command:
>
> getOptionChain( "XOM", Exp=NULL )
>
> and I got the message:
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid, :
> object 'contractsymbol' not found
> Since, it is not working for you either, I guess that quantmod has a
> significant bug.
>
This is now fixed on GitHub:
https://github.com/joshuaulrich/quantmod/issues/155
You can install with:
remotes::install_github("joshuaulrich/quantmod")
> Is there a better way to get free option quotes in R?
>
> Thank you,
>
> Bob
>
> On 5/12/2017 2:09 PM, Joshua Ulrich wrote:
>
> On Fri, May 12, 2017 at 1:02 PM, Frank <frankm60606 at gmail.com> wrote:
>
> It looks like some of the dependencies don't load automatically. I was using
> R x64 3.2.2:
>
> They load automatically. They are not *installed* automatically.
>
> 1) Updated my R to the later version
> 2) I installed package jsonlite ("package:"jsonlite"cannot be loaded.")
> 3) I installed package curl ("Error: Required package curl not found. Please
> run: install.packages('curl')"
> 4) I updated to R x64 3.2.5 then R x64 3.3.3 re-installed the above.
>
> I now get
>
> " Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid, :
> object 'contractsymbol' not found"
>
> The complete output is now:
>
> "
> version 3.3.3 (2017-03-06) -- "Another Canoe"
> Copyright (C) 2017 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> library(quantmod)
>
> Loading required package: xts
> Loading required package: zoo
>
> Attaching package: 'zoo'
>
> The following objects are masked from 'package:base':
>
> as.Date, as.Date.numeric
>
> Loading required package: TTR
> Version 0.4-0 included new data defaults. See ?getSymbols.
>
> optData = getOptionChain( "XOM", Exp=NULL )
>
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid, :
> object 'contractsymbol' not found
> Calls: getOptionChain ... <Anonymous> -> with -> with.default -> eval ->
> eval -> data.frame
> Execution halted
>
> I get the same error. It looks like Yahoo changed something so that
> now fromJSON returns an empty list for the put/call tables instead of
> NULL.
>
> -----Original Message-----
> From: R-SIG-Finance [mailto:r-sig-finance-bounces at r-project.org] On Behalf
> Of Robert Sherry
> Sent: Friday, May 12, 2017 11:35 AM
> To: r-sig-finance at r-project.org
> Subject: [R-SIG-Finance] Trying to Extract Option Quotes with R
>
> I executed the following commands in R:
>
> library(quantmod)
> optData = getOptionChain( "XOM", Exp=NULL )
> nrow(optData)
>
> The last command returned NULL. What am I doing wrong?
>
> Bob
>
> _______________________________________________
> R-SIG-Finance at 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.
>
> _______________________________________________
> R-SIG-Finance at 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 2017 | www.rinfinance.com
More information about the R-SIG-Finance
mailing list