[R] get.hist.quote - is great, but am I missing something?

Dirk Eddelbuettel edd at debian.org
Wed Mar 3 17:02:10 CET 2004


On Wed, Mar 03, 2004 at 03:25:14PM +0530, Ajay Shah wrote:
> I find it's just great to be able to say:
> 
>   library(tseries)
>   x <- get.hist.quote(instrument="ongc.ns")
> 
> and it gets a full time-series of the stock price of the symbol
> ongc.ns from Yahoo quote.
> 
> However, once my hopes have been raised by such beauty :-) I get
> disappointed when I do
> 
> > plot(x)

a) use  plotOHLC(x), not plot(), PlotOHLC is also in tseries.

b) install the its package which has a variant of get.hist.quote
   and plots that too (though it doesn;t skip weekends)
   
> and the annotation is horrible! The x axis is not labelled as
> dates. The default plot method for get.hist.quote should be better,
> no?

So are you intending to contribute one?  
 
> I was not able to understand the object returned by get.hist.quote. If
> I say:
> 
> > summary(x)
>       Open             High             Low            Close      
>  Min.   : 397.0   Min.   : 407.3   Min.   :395.1   Min.   :398.4  
>  1st Qu.: 494.2   1st Qu.: 501.4   1st Qu.:482.7   1st Qu.:490.4  
>  Median : 614.9   Median : 622.7   Median :600.7   Median :610.0  
>  Mean   : 615.6   Mean   : 627.1   Mean   :599.7   Mean   :611.9  
>  3rd Qu.: 690.5   3rd Qu.: 707.4   3rd Qu.:676.2   3rd Qu.:691.5  
>  Max.   :1000.0   Max.   :1000.0   Max.   :930.0   Max.   :944.9  
>  NA's   :  88.0   NA's   :  88.0   NA's   : 88.0   NA's   : 88.0  
> 
> there is no mention of a 'time' variable. And, I'm unable to extract
> (say) a vector of closing prices - e.g. if I say:
> 
> > closingprices <- x$Close
> > print(closingprices)
> NULL
> 
> I guess I'm not understanding the object that get.hist.quote makes. In
> general, what are R facilities for discovering what a given object is?

class(x)
str(x)
...

Hth, Dirk

-- 
The relationship between the computed price and reality is as yet unknown.  
                                             -- From the pac(8) manual page




More information about the R-help mailing list