|
I have been having trouble retrieving some TSE series from yahoo:
> require("quantmod") > getSymbols("BMO.TO", dbname="yahoo") works but > getSymbols("COS.TO", dbname="yahoo") appears to have worked but has actually failed: > str(COS.TO) An 'xts' object of zero-width It seems to be getting the header, but no data. I have also tried with Google Finance: > getSymbols("TSE:COS", dbname="google") Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : cannot open URL 'http://chart.yahoo.com/table.csv?s=TSE:COS&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=TSE:COS&x=.csv' In addition: Warning message: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : cannot open: HTTP status was '404 Not Found' I'm not sure if I have the syntax correct for indicating an exchange on google. Does anyone have suggestions? Thanks, Paul _______________________________________________ [hidden email] 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. |
|
Hi Paul,
Are you sure you're not looking for the src= argument of getSymbols()? Best, Michael On Wed, Jul 11, 2012 at 12:49 PM, Paul Gilbert <[hidden email]> wrote: > I have been having trouble retrieving some TSE series from yahoo: > >> require("quantmod") >> getSymbols("BMO.TO", dbname="yahoo") > > works but > >> getSymbols("COS.TO", dbname="yahoo") > > appears to have worked but has actually failed: > >> str(COS.TO) > An 'xts' object of zero-width > > It seems to be getting the header, but no data. I have also tried with > Google Finance: > >> getSymbols("TSE:COS", dbname="google") > Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, > : > cannot open URL > 'http://chart.yahoo.com/table.csv?s=TSE:COS&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=TSE:COS&x=.csv' > In addition: Warning message: > In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : > cannot open: HTTP status was '404 Not Found' > > I'm not sure if I have the syntax correct for indicating an exchange on > google. Does anyone have suggestions? > > Thanks, > Paul > > _______________________________________________ > [hidden email] 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. _______________________________________________ [hidden email] 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. |
|
In reply to this post by Paul Gilbert-2
I don't have a good answer, but "dbname" is not an argument for either
getSymbols or getSymbols.yahoo. It's pretty clear that you meant to use src="yahoo" and src="google" Note that the error that you got from getSymbols("TSE:COS", dbname="google") shows that it couldn't find http://chart.yahoo.com/.... That's because it's using the default value of src="yahoo" which means getSymbols.yahoo is being called. Anyway, if you go into the source of getSymbols.yahoo, and change yahoo.URL <- "http://chart.yahoo.com/table.csv? To yahoo.URL <- "http://ichart.finance.yahoo.com/table.csv?" Then it will work. But, I have no idea whether this will work for other symbols. > getSymbols("COS.TO", src='yahoo' [1] "COS.TO" > head(COS.TO) COS.TO.Open COS.TO.High COS.TO.Low COS.TO.Close COS.TO.Volume 2007-01-02 32.61 33.00 32.20 32.39 368500 2007-01-03 31.88 32.00 30.15 30.16 1654000 2007-01-04 29.75 29.75 28.50 28.87 1905400 2007-01-05 29.10 29.56 28.47 28.89 2521000 2007-01-08 29.38 29.49 28.50 28.60 1361300 2007-01-09 28.05 28.15 27.50 27.85 1703500 COS.TO.Adjusted 2007-01-02 24.12 2007-01-03 22.46 2007-01-04 21.50 2007-01-05 21.52 2007-01-08 21.30 2007-01-09 20.74 HTH, Garrett On Wed, Jul 11, 2012 at 12:49 PM, Paul Gilbert <[hidden email]> wrote: > I have been having trouble retrieving some TSE series from yahoo: > >> require("quantmod") >> getSymbols("BMO.TO", dbname="yahoo") > > works but > >> getSymbols("COS.TO", dbname="yahoo") > > appears to have worked but has actually failed: > >> str(COS.TO) > An 'xts' object of zero-width > > It seems to be getting the header, but no data. I have also tried with > Google Finance: > >> getSymbols("TSE:COS", dbname="google") > Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, > : > cannot open URL > 'http://chart.yahoo.com/table.csv?s=TSE:COS&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=TSE:COS&x=.csv' > In addition: Warning message: > In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : > cannot open: HTTP status was '404 Not Found' > > I'm not sure if I have the syntax correct for indicating an exchange on > google. Does anyone have suggestions? > > Thanks, > Paul > > _______________________________________________ > [hidden email] 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. _______________________________________________ [hidden email] 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. |
|
My bad. Indeed the examples should have been:
> getSymbols("BMO.TO", src="yahoo") > getSymbols("COS.TO", src="yahoo") > getSymbols("TSE:COS", src="google") They lost something in translation from my code. The problem is not resolved by this correction, however the yahoo retrieval is fixed by the getSymbols.yahoo URL change suggested. The google retrieval still causes problems: > getSymbols("TSE:COS", src="google") Error in download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", : cannot open URL 'http://finance.google.com/finance/historical?q=TSE:COS&startdate=Jan+01,+2007&enddate=Jul+11,+2012&output=csv' In addition: Warning message: In download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", : cannot open: HTTP status was '404 Not Found' > Any further suggestions appreciated. Thanks, Paul On 12-07-11 02:06 PM, G See wrote: > I don't have a good answer, but "dbname" is not an argument for either > getSymbols or getSymbols.yahoo. It's pretty clear that you meant to > use src="yahoo" and src="google" > > Note that the error that you got from > getSymbols("TSE:COS", dbname="google") > shows that it couldn't find http://chart.yahoo.com/.... > > That's because it's using the default value of src="yahoo" which means > getSymbols.yahoo is being called. > > Anyway, if you go into the source of getSymbols.yahoo, and change > > yahoo.URL <- "http://chart.yahoo.com/table.csv? > To > yahoo.URL <- "http://ichart.finance.yahoo.com/table.csv?" > > Then it will work. But, I have no idea whether this will work for > other symbols. > >> getSymbols("COS.TO", src='yahoo' > [1] "COS.TO" >> head(COS.TO) > COS.TO.Open COS.TO.High COS.TO.Low COS.TO.Close COS.TO.Volume > 2007-01-02 32.61 33.00 32.20 32.39 368500 > 2007-01-03 31.88 32.00 30.15 30.16 1654000 > 2007-01-04 29.75 29.75 28.50 28.87 1905400 > 2007-01-05 29.10 29.56 28.47 28.89 2521000 > 2007-01-08 29.38 29.49 28.50 28.60 1361300 > 2007-01-09 28.05 28.15 27.50 27.85 1703500 > COS.TO.Adjusted > 2007-01-02 24.12 > 2007-01-03 22.46 > 2007-01-04 21.50 > 2007-01-05 21.52 > 2007-01-08 21.30 > 2007-01-09 20.74 > > HTH, > Garrett > > On Wed, Jul 11, 2012 at 12:49 PM, Paul Gilbert <[hidden email]> wrote: >> I have been having trouble retrieving some TSE series from yahoo: >> >>> require("quantmod") >>> getSymbols("BMO.TO", dbname="yahoo") >> >> works but >> >>> getSymbols("COS.TO", dbname="yahoo") >> >> appears to have worked but has actually failed: >> >>> str(COS.TO) >> An 'xts' object of zero-width >> >> It seems to be getting the header, but no data. I have also tried with >> Google Finance: >> >>> getSymbols("TSE:COS", dbname="google") >> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, >> : >> cannot open URL >> 'http://chart.yahoo.com/table.csv?s=TSE:COS&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=TSE:COS&x=.csv' >> In addition: Warning message: >> In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : >> cannot open: HTTP status was '404 Not Found' >> >> I'm not sure if I have the syntax correct for indicating an exchange on >> google. Does anyone have suggestions? >> >> Thanks, >> Paul >> >> _______________________________________________ >> [hidden email] 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. _______________________________________________ [hidden email] 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. |
|
I don't think google provides that data in a nice format (i.e. CSV)
If you go to http://www.google.com/finance/historical?q=NYSEARCA:SPY you can see that on the right side of the page there is a section called "Export" with a link called "Download to spreadsheet" However, if you go the analogous page for COS, there is no such link. http://www.google.com/finance/historical?q=TSE:COS On Wed, Jul 11, 2012 at 1:57 PM, Paul Gilbert <[hidden email]> wrote: > My bad. Indeed the examples should have been: > >> getSymbols("BMO.TO", src="yahoo") >> getSymbols("COS.TO", src="yahoo") >> getSymbols("TSE:COS", src="google") > > They lost something in translation from my code. The problem is not resolved > by this correction, however the yahoo retrieval is fixed by the > getSymbols.yahoo URL change suggested. > > The google retrieval still causes problems: > >> getSymbols("TSE:COS", src="google") > Error in download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", > : > cannot open URL > 'http://finance.google.com/finance/historical?q=TSE:COS&startdate=Jan+01,+2007&enddate=Jul+11,+2012&output=csv' > In addition: Warning message: > In download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", : > > cannot open: HTTP status was '404 Not Found' >> > > Any further suggestions appreciated. > > Thanks, > Paul > > _______________________________________________ [hidden email] 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. |
|
In reply to this post by Paul Gilbert-2
On http://finance.yahoo.com/q/hp?s=COS.TO ,
the link to Historical Prices has no data. Probably why you only get headers. >>> getSymbols("COS.TO", src="yahoo") _______________________________________________ [hidden email] 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. |
|
But... I see plenty of data there... including a link to "Download to
Spreadsheet" http://ichart.finance.yahoo.com/table.csv?s=COS.TO&d=6&e=11&f=2012&g=d&a=7&b=13&c=1996&ignore=.csv On Wed, Jul 11, 2012 at 2:39 PM, Doug Edmunds <[hidden email]> wrote: > On http://finance.yahoo.com/q/hp?s=COS.TO , > the link to Historical Prices has no data. > > Probably why you only get headers. > > >>>> getSymbols("COS.TO", src="yahoo") > > _______________________________________________ > [hidden email] 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. _______________________________________________ [hidden email] 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. |
|
The format that getSymbols uses internally is:
http://chart.yahoo.com/table.csv?s=COS.TO&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=COS.TO&x=.csv Which somehow doesn't resolve to the data in this instance. I'll investigate. Thanks, Jeff On Wed, Jul 11, 2012 at 2:42 PM, G See <[hidden email]> wrote: > But... I see plenty of data there... including a link to "Download to > Spreadsheet" > http://ichart.finance.yahoo.com/table.csv?s=COS.TO&d=6&e=11&f=2012&g=d&a=7&b=13&c=1996&ignore=.csv > > On Wed, Jul 11, 2012 at 2:39 PM, Doug Edmunds <[hidden email]> wrote: >> On http://finance.yahoo.com/q/hp?s=COS.TO , >> the link to Historical Prices has no data. >> >> Probably why you only get headers. >> >> >>>>> getSymbols("COS.TO", src="yahoo") >> >> _______________________________________________ >> [hidden email] 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. > > _______________________________________________ > [hidden email] 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 [hidden email] www.lemnica.com www.esotericR.com _______________________________________________ [hidden email] 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. |
|
In reply to this post by Paul Gilbert-2
Paul,
Although, changing the yahoo URL seemed to work to get yahoo's data for COS.TO, beware that there is a 4+ month gap in their data in 2012. tail(COS.TO) COS.TO.Open COS.TO.High COS.TO.Low COS.TO.Close COS.TO.Volume 2012-02-22 23.25 23.61 23.23 23.61 1473800 2012-02-23 23.68 23.75 23.41 23.62 1560800 2012-02-24 23.74 23.96 23.62 23.66 1639300 2012-02-27 23.60 23.60 23.26 23.34 1261100 2012-02-28 23.34 23.70 23.27 23.34 2038900 2012-07-11 19.13 19.59 18.92 19.40 1286400 COS.TO.Adjusted 2012-02-22 23.61 2012-02-23 23.62 2012-02-24 23.66 2012-02-27 23.34 2012-02-28 23.34 2012-07-11 23.34 Garrett On Wed, Jul 11, 2012 at 1:57 PM, Paul Gilbert <[hidden email]> wrote: <snip> > however the yahoo retrieval is fixed by the > getSymbols.yahoo URL change suggested. _______________________________________________ [hidden email] 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. |
|
In reply to this post by Jeffrey Ryan-2
Jeff
I've switched back and forth between chart.yahoo.com and ichart.finance.yahoo.com. Some things seem to fail on one or the other. I made yahoo.URL an argument so I could pass it, and looped through a list trying the second if the first failed. Currently BBD.B.TO fails with both, but it worked on the default URL yesterday. I'm pausing for 2 seconds between each retrieval, so I don't think yahoo should be blocking me. In addition, I had not noticed the gap that Garrett just pointed out. Paul On 12-07-11 04:07 PM, Jeffrey Ryan wrote: > The format that getSymbols uses internally is: > > http://chart.yahoo.com/table.csv?s=COS.TO&a=0&b=01&c=2007&d=6&e=11&f=2012&g=d&q=q&y=0&z=COS.TO&x=.csv > > Which somehow doesn't resolve to the data in this instance. I'll investigate. > > Thanks, > Jeff > > On Wed, Jul 11, 2012 at 2:42 PM, G See <[hidden email]> wrote: >> But... I see plenty of data there... including a link to "Download to >> Spreadsheet" >> http://ichart.finance.yahoo.com/table.csv?s=COS.TO&d=6&e=11&f=2012&g=d&a=7&b=13&c=1996&ignore=.csv >> >> On Wed, Jul 11, 2012 at 2:39 PM, Doug Edmunds <[hidden email]> wrote: >>> On http://finance.yahoo.com/q/hp?s=COS.TO , >>> the link to Historical Prices has no data. >>> >>> Probably why you only get headers. >>> >>> >>>>>> getSymbols("COS.TO", src="yahoo") >>> >>> _______________________________________________ >>> [hidden email] 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. >> >> _______________________________________________ >> [hidden email] 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. > > > _______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
