Re: [R] get.hist.quote problem yahoo

2007-02-13 Thread Kurt Hornik
>>>>> Rene Braeckman writes:

> I had the same problem some time ago. Below is a function that I
> picked up on the web somewhere (can't remember where; may have been a
> newsletter).  It's based on the tseries function but the difference is
> that this function produces a data frame with a column containing the
> dates of the quotes, instead of a time series object. I had to replace
> "%d-%b-%y" by "%Y-%m-%d" to make it work, probably as you stated
> because the format was changed by Yahoo.

This issue should be taken care of now by a new release of tseries I put
out two days ago.

-k

> Hope this helps.

> Rene

> # --
> # "df.get.hist.quote()" function
> #
> # Based on code by A. Trapletti (package tseries)
> #
> # The main difference is that this function produces a data frame with
> # a column containing the dates of the quotes, instead of a time series
> # object.
> df.get.hist.quote <- function (instrument = "ibm",
>start, end,
>quote = c("Open","High", "Low",
> "Close","Volume"),
>provider = "yahoo", method = "auto") 
> {
> if (missing(start)) 
> start <- "1970-01-02"
> if (missing(end)) 
> end <- format(Sys.time() - 86400, "%Y-%m-%d")
> provider <- match.arg(provider)
> start <- as.POSIXct(start, tz = "GMT")
> end <- as.POSIXct(end, tz = "GMT")
> if (provider == "yahoo") {
> url <- paste("http://chart.yahoo.com/table.csv?s=";, instrument, 
> format(start, "&a=%m&b=%d&c=%Y"), format(end,
> "&d=%m&e=%d&f=%Y"), 
> "&g=d&q=q&y=0&z=", instrument, "&x=.csv", sep = "")
> destfile <- tempfile()
> status <- download.file(url, destfile, method = method)
> if (status != 0) {
> unlink(destfile)
> stop(paste("download error, status", status))
> }
> status <- scan(destfile, "", n = 1, sep = "\n", quiet = TRUE)
> if (substring(status, 1, 2) == "No") {
> unlink(destfile)
> stop(paste("No data available for", instrument))
> }
> x <- read.table(destfile, header = TRUE, sep = ",")
> unlink(destfile)
> nser <- pmatch(quote, names(x))
> if (any(is.na(nser))) 
> stop("This quote is not available")
> n <- nrow(x)
> lct <- Sys.getlocale("LC_TIME")
> Sys.setlocale("LC_TIME", "C")
> on.exit(Sys.setlocale("LC_TIME", lct))
> dat <- gsub(" ", "0", as.character(x[, 1]))
> dat <- as.POSIXct(strptime(dat, "%Y-%m-%d"), tz = "GMT")
> if (dat[n] != start) 
> cat(format(dat[n], "time series starts %Y-%m-%d\n"))
> if (dat[1] != end) 
> cat(format(dat[1], "time series ends   %Y-%m-%d\n"))
 
> return(data.frame(cbind(Date=I(format(dat[n:1],"%Y-%m-%d")),x[n:1,nser]),row
> .names=1:n))
>   }
> else stop("Provider not implemented")
> } 

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Daniele Amberti
> Sent: Friday, February 09, 2007 5:22 AM
> To: r-help
> Subject: [R] get.hist.quote problem yahoo

> I have functions using get.hist.quote() from library tseries.

> It seems that something changed (yahoo) and function get broken.

> try with a simple

> get.hist.quote('IBM')

> and let me kow if for someone it is still working.

> I get this error:
> Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series
> starts %Y-%m-%d\n")) : 
> missing value where TRUE/FALSE needed

> Looking at the code it seems that before the format of dates in yahoo's cv
> file was not iso.
> Now it is iso standard year-month-day

> Anyone get the same problem?


> --
> Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
> http://click.libero.it/infostrada9feb07

> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] get.hist.quote problem yahoo

2007-02-09 Thread Rene Braeckman
I had the same problem some time ago. Below is a function that I picked up
on the web somewhere (can't remember where; may have been a newsletter).
It's based on the tseries function but the difference is that this function
produces a data frame with a column containing the dates of the quotes,
instead of a time series object. I had to replace "%d-%b-%y" by "%Y-%m-%d"
to make it work, probably as you stated because the format was changed by
Yahoo.

Hope this helps.

Rene

# --
# "df.get.hist.quote()" function
#
# Based on code by A. Trapletti (package tseries)
#
# The main difference is that this function produces a data frame with
# a column containing the dates of the quotes, instead of a time series
# object.
df.get.hist.quote <- function (instrument = "ibm",
   start, end,
   quote = c("Open","High", "Low",
"Close","Volume"),
   provider = "yahoo", method = "auto") 
{
if (missing(start)) 
start <- "1970-01-02"
if (missing(end)) 
end <- format(Sys.time() - 86400, "%Y-%m-%d")
provider <- match.arg(provider)
start <- as.POSIXct(start, tz = "GMT")
end <- as.POSIXct(end, tz = "GMT")
if (provider == "yahoo") {
url <- paste("http://chart.yahoo.com/table.csv?s=";, instrument, 
format(start, "&a=%m&b=%d&c=%Y"), format(end,
"&d=%m&e=%d&f=%Y"), 
"&g=d&q=q&y=0&z=", instrument, "&x=.csv", sep = "")
destfile <- tempfile()
status <- download.file(url, destfile, method = method)
if (status != 0) {
unlink(destfile)
stop(paste("download error, status", status))
}
status <- scan(destfile, "", n = 1, sep = "\n", quiet = TRUE)
if (substring(status, 1, 2) == "No") {
unlink(destfile)
stop(paste("No data available for", instrument))
}
x <- read.table(destfile, header = TRUE, sep = ",")
unlink(destfile)
nser <- pmatch(quote, names(x))
if (any(is.na(nser))) 
stop("This quote is not available")
n <- nrow(x)
lct <- Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME", "C")
on.exit(Sys.setlocale("LC_TIME", lct))
dat <- gsub(" ", "0", as.character(x[, 1]))
dat <- as.POSIXct(strptime(dat, "%Y-%m-%d"), tz = "GMT")
if (dat[n] != start) 
    cat(format(dat[n], "time series starts %Y-%m-%d\n"))
if (dat[1] != end) 
cat(format(dat[1], "time series ends   %Y-%m-%d\n"))
 
return(data.frame(cbind(Date=I(format(dat[n:1],"%Y-%m-%d")),x[n:1,nser]),row
.names=1:n))
  }
else stop("Provider not implemented")
} 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Daniele Amberti
Sent: Friday, February 09, 2007 5:22 AM
To: r-help
Subject: [R] get.hist.quote problem yahoo

I have functions using get.hist.quote() from library tseries.

It seems that something changed (yahoo) and function get broken.

try with a simple

get.hist.quote('IBM')

and let me kow if for someone it is still working.

I get this error:
Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series
starts %Y-%m-%d\n")) : 
missing value where TRUE/FALSE needed

Looking at the code it seems that before the format of dates in yahoo's cv
file was not iso.
Now it is iso standard year-month-day

Anyone get the same problem?


--
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada9feb07

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] get.hist.quote problem yahoo

2007-02-09 Thread Daniele Amberti
I have functions using get.hist.quote() from library tseries.

It seems that something changed (yahoo) and function get broken.

try with a simple

get.hist.quote('IBM')

and let me kow if for someone it is still working.

I get this error:
Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series starts 
%Y-%m-%d\n")) : 
missing value where TRUE/FALSE needed

Looking at the code it seems that before the format of dates in yahoo's cv file 
was not iso.
Now it is iso standard year-month-day

Anyone get the same problem?


--
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada9feb07

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] get.hist.quote problem yahoo

2007-02-09 Thread Daniele Amberti
I have functions using get.hist.quote() from library tseries.

It seems that something changed (yahoo) and function get broken.

try with a simple

get.hist.quote('IBM')

and let me kow if for someone it is still working.

I get this error:
Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series starts 
%Y-%m-%d\n")) : 
missing value where TRUE/FALSE needed

Looking at the code it seems that before the format of dates in yahoo's cv file 
was not iso.
Now it is iso standard year-month-day

Anyone get the same problem?


--
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada9feb07

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] get.hist.quote problem yahoo

2007-02-09 Thread Daniele Amberti
I have functions using get.hist.quote() from library tseries.

It seems that something changed (yahoo) and function get broken.

try with a simple

get.hist.quote('IBM')

and let me kow if for someone it is still working.

I get this error:
Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series starts 
%Y-%m-%d\n")) : 
missing value where TRUE/FALSE needed

Looking at the code it seems that before the format of dates in yahoo's cv file 
was not iso.
Now it is iso standard year-month-day

Anyone get the same problem?


--
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada9feb07

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] get.hist.quote

2007-01-04 Thread BBands
On 1/4/07, BBands <[EMAIL PROTECTED]> wrote:
> Odd behavior from get.hist.quote this AM.

Now working, must have been a Yahoo! issue.

jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] get.hist.quote

2007-01-04 Thread BBands
Odd behavior from get.hist.quote this AM.

"""
> get.hist.quote('sunw')
trying URL 
'http://chart.yahoo.com/table.csv?s=sunw&a=0&b=02&c=1991&d=0&e=03&f=2007&g=d&q=q&y=0&z=sunw&x=.csv'
Content type 'text/csv' length unknown
opened URL
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .
downloaded 189Kb

Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time
series starts %Y-%m-%d\n")) :
missing value where TRUE/FALSE needed
>
"""
Indentical for 2.4.0 on SuSE 10.1 and 2.4.1 on Win XP.

jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


RE: [R] get.hist.quote

2004-03-03 Thread Manoj - Hachibushu Capital
In tseries package. You might have to download & install the package If
library(tseries) doesn't work. 

HTH

Manoj

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erin Hodgess
Sent: Thursday, March 04, 2004 2:53 AM
To: [EMAIL PROTECTED]
Subject: [R] get.hist.quote

Dear R People:

Here is a silly one:
Where is get.hist.quote, please?

Thanks,
Erin
mailto: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] get.hist.quote

2004-03-03 Thread Erin Hodgess
Dear R People:

Here is a silly one:
Where is get.hist.quote, please?

Thanks,
Erin
mailto: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Robert W. Baer, Ph.D.
> > 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?
>
> I suggest, you study first one of the beginners manuals of the R
> environment: http://cran.r-project.org/manuals.html
> Then you would easily see that, e.g., x[,"Close"] gives you the series
> of closing prices, time(x) gives you the series of times and so on...

Some things you could do to investigate the object (besides printing it
out):
str(x)
class(x)
mode(x)
structure(s)

Rob

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Heywood, Giles
If you wish to 'skip' (i.e. not interpolate) weekends in its, you could use
the following:

prices <- priceIts(instrument="ongc.ns")
plot(union(prices,newIts(start=start(prices),end=end(prices))),interp="none"
)

- Giles

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Dirk 
> Eddelbuettel
> Sent: 03 March 2004 16:02
> To: Ajay Shah
> Cc: r-help
> Subject: Re: [R] get.hist.quote - is great, but am I missing 
> something?
> 
> 
> 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 LowClose  
> >  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
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


** 
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Adrian Trapletti
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)


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?


It depends what you want to do. But it all behaves as it is documented. 
Since the object returned by get.hist.quote is a multivariate time 
series (class "mts") plot.mts is called. As documented, the times are 
given in Julian dates since 1899-12-30. Therefore the "horrible" 
annotation.

If you would like a more user-friendly plot, try plotOHLC(x).

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?
I suggest, you study first one of the beginners manuals of the R 
environment: http://cran.r-project.org/manuals.html
Then you would easily see that, e.g., x[,"Close"] gives you the series 
of closing prices, time(x) gives you the series of times and so on...

--
Ajay Shah Consultant
[EMAIL PROTECTED] Department of Economic Affairs
http://www.mayin.org/ajayshah Ministry of Finance, New Delhi

best
Adrian
--
Dr. Adrian Trapletti
Trapletti Statistical Computing
Wildsbergstrasse 31, 8610 Uster
Switzerland
Phone & Fax : +41 (0) 1 994 5631
Mobile : +41 (0) 76 370 5631
Email : mailto:[EMAIL PROTECTED]
WWW : http://trapletti.homelinux.com
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Dirk Eddelbuettel
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 LowClose  
>  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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Gabor Grothendieck

Here are a number of options:

plotOHLC(x)   # in tseries package

or 

require(chron)
x <- get.hist.quote( your.symbol, origin = chron(0) )
tt <- chron( time( x ) )
plot(tt, x[,"Close"])

or

# using tt and x just calculated
require(zoo)
plot(zoo(x,tt))

or 

see Giles' post on his its package


---
Date:   Wed, 3 Mar 2004 15:25:14 +0530 
From:   Ajay Shah <[EMAIL PROTECTED]>
To:   r-help <[EMAIL PROTECTED]> 
Subject:   [R] get.hist.quote - is great, but am I missing something? 

 
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)

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?

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?

-- 
Ajay Shah Consultant
[EMAIL PROTECTED] Department of Economic Affairs
http://www.mayin.org/ajayshah Ministry of Finance, New Delhi

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Heywood, Giles
If you use priceIts() in package 'its' (Irregular Time Series), you get
similar functionality, and the labelling etc in plot() recognizes the
calendar.  You can also do further calendar-based extractions, etc.

- Giles

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Ajay Shah
> Sent: 03 March 2004 09:55
> To: r-help
> Subject: [R] get.hist.quote - is great, but am I missing something?
> 
> 
> 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)
> 
> 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?
> 
> I was not able to understand the object returned by get.hist.quote. If
> I say:
> 
> > summary(x)
>   Open High LowClose  
>  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?
> 
> -- 
> Ajay Shah   Consultant
> [EMAIL PROTECTED]  Department of Economic Affairs
> http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 


** 
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-03-03 Thread Ajay Shah
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)

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?

I was not able to understand the object returned by get.hist.quote. If
I say:

> summary(x)
  Open High LowClose  
 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?

-- 
Ajay Shah   Consultant
[EMAIL PROTECTED]  Department of Economic Affairs
http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html