[R-SIG-Finance] Trying to Extract Option Quotes with R

Joshua Ulrich josh.m.ulrich at gmail.com
Fri May 12 20:09:39 CEST 2017


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