[R-SIG-Finance] But in quantmod function

Jeff Ryan jeff.a.ryan at gmail.com
Tue Nov 16 09:08:48 CET 2010


Hi Mark/everyone,

On Tue, Nov 16, 2010 at 1:01 AM, Mark Breman <breman.mark at gmail.com> wrote:
> Hi everyone,
>
> Just a thought:
>
> Often these issues in quantmod arise when there is a change in the url at
> the yahoo site (or other data-provider) and quantmod is not updated yet,
> right?

Not all that often is the URL the only issue.  It usually is far more
complicated in terms of markup changes/and parsing logic than that.
That said,

>
> Would it be possible to expose the url quantmod is using for the scraping,
> so when someone discovers an url change it can be altered
> without modifications to the quantmod code.
>

Duncan Murdoch ironically also emailed me over the weekend to ask for
the same thing.  I am not entirely sure that it is going to help much,
but I am working on a more robust version of getSymbols that will
involve something like 'known hosts' and a caching mechanism that
would get updated/check on a regular basis.

Like I said, the URL changes that *fix* things are rare, but Yahoo
does seem to run a variety of servers that would make this approach
viable enough to bother coding.

Best,
Jeff

P.S. Another great place to have OSS R discussions aside from the list
is at R/Finance here in Chicago. In case the CFP missed anyone, we've
got a pretty amazing line-up of keynotes scheduled!  Conversations
over drinks (coffee or beer) are always quite powerful...

http://www.rinfinance.com/

Hoping to see you all in Chicago in April!

> Regards,
>
> -Mark-
>
> 2010/11/16 Joshua Ulrich <josh.m.ulrich at gmail.com>
>
>> Marc,
>>
>> On Mon, Nov 15, 2010 at 9:59 PM, Marc Delvaux <mdelvaux at gmail.com> wrote:
>> > Jeffrey Ryan is the main author and maintainer of quantmod (even if I
>> think
>> > Joshua Ulrich is working on the yahoo scraping code).  Taping
>> help(quantmod)
>>
>> I haven't done anything with the options web-scraping code.
>>
>> > will give you that information (same as for any package).  Quantmod is
>> > hosted on r-forge where you can find more information if needed
>> > https://r-forge.r-project.org/projects/quantmod/ And of course Jeffrey
>> is
>> > active on his mail list.
>> >
>> Actually, Jeff already patched the issue with symbols that start with
>> a carat.  There may be other issues though...
>>
>> Best,
>> --
>> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>>
>>
>> > Author(s)
>> >
>> > Jeffrey A. Ryan
>> >
>> > Maintainer: Jeffrey A. Ryan <jeff.a.ryan at gmail.com>
>> >
>> >
>> > On Mon, Nov 15, 2010 at 7:38 PM, Noah Silverman <noah at smartmediacorp.com
>> >wrote:
>> >
>> >> OK,
>> >>
>> >> Bad example.  But try it for the ticker "^RUT"  (Russel index)
>> >>
>> >> There ARE options:  http://finance.yahoo.com/q/op?s=^RUT+Options
>> >>
>> >> Also options for the S&P mini "^XAP"
>> >> http://finance.yahoo.com/q/op?s=^XSP+Options
>> >>
>> >> getOptionChain("^XSP", NULL)
>> >>
>> >> Error in from:to : NA/NaN argument
>> >>
>> >> I'VE FOUND THE BUG.  But don't know how/where to submit it.
>> >>
>> >> Look carefully at the URLs used by yahoo.
>> >>
>> >> For a stock
>> >>
>> >> For an index
>> >>
>> >> Notice that with an index, the "+options" part is there.  Try calling
>> the
>> >> page without it and it fails.  The current code in quantmod doesn't add
>> >> this.
>> >>
>> >> I think we just need add one line:      Symbols <- paste(Symbols,
>> >> "+options", sep="")
>> >>
>> >> -N
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On 11/15/10 7:03 PM, Cedrick Johnson wrote:
>> >>
>> >>> There are technically SPX cash optns. I am not in front of my comp to
>> look
>> >>> them up but they do exist indeed. SPY and DIA options do exist for the
>> >>> ETF's....
>> >>>
>> >>> -c
>> >>> Sent from my BlackBerryŽ
>> >>>
>> >>> -----Original Message-----
>> >>> From: Marc Delvaux<mdelvaux at gmail.com>
>> >>> Sender: r-sig-finance-bounces at stat.math.ethz.ch
>> >>> Date: Mon, 15 Nov 2010 18:49:35
>> >>> To: Noah Silverman<noah at smartmediacorp.com>
>> >>> Reply-To: mdelvaux at gmail.com
>> >>> Cc:<r-sig-finance at stat.math.ethz.ch>
>> >>> Subject: Re: [R-SIG-Finance] But in quantmod function
>> >>>
>> >>> That is because there are no options on these specific tickers, as you
>> can
>> >>> see by the grayed out "options" link on the corresponding yahoo page.
>> >>>
>> >>> For options on the S&P, you need to use "SPY", and "^DJX" for the DJIA.
>> >>>
>> >>> On Mon, Nov 15, 2010 at 5:06 PM, Noah Silverman<
>> noah at smartmediacorp.com
>> >>> >wrote:
>> >>>
>> >>>  Hi,
>> >>>>
>> >>>> I think I've found a bug in the quantmod library.
>> >>>>
>> >>>> The function "getOptionChain" fails when fetching the chain of an
>> index
>> >>>> (S&P, DJIA, etc.)
>> >>>> (Note:  It works beautifully for options on stocks.)
>> >>>>
>> >>>> chain<- getOptionChain("^GSPC", Exp=NULL)
>> >>>> Error in strsplit(opt, "<tr.*?>")[[1]] : subscript out of bounds
>> >>>>
>> >>>> chain<- getOptionChain("^RUT", Exp=NULL)
>> >>>> Error in from:to : NA/NaN argument
>> >>>>
>> >>>>
>> >>>> Any ideas?
>> >>>>
>> >>>> -N
>> >>>>
>> >>>> _______________________________________________
>> >>>> R-SIG-Finance at stat.math.ethz.ch 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.
>> >>>>
>> >>>>         [[alternative HTML version deleted]]
>> >>>
>> >>> _______________________________________________
>> >>> R-SIG-Finance at stat.math.ethz.ch 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.
>> >>>
>> >>
>> >>
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> >
>> > _______________________________________________
>> > R-SIG-Finance at stat.math.ethz.ch 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 stat.math.ethz.ch 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.
>>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch 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.
>



-- 
Jeffrey Ryan    |    Founder    |    jeffrey.ryan at lemnica.com

www.lemnica.com



More information about the R-SIG-Finance mailing list