[R-SIG-Finance] TSE ticker problems

Paul Gilbert pgilbert902 at gmail.com
Wed Jul 11 20:57:08 CEST 2012


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 <pgilbert902 at gmail.com> 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
>>
>> _______________________________________________
>> 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.



More information about the R-SIG-Finance mailing list