Commit 0756dc16 authored by Dirk Eddelbuettel's avatar Dirk Eddelbuettel

Import Upstream version 0.10-1

parent 469e8724
2006-05-10 Achim Zeileis <Achim.Zeileis@R-project.org>
* DESCRIPTION (Version): New version is 0.10-1.
2006-05-09 Achim Zeileis <Achim.Zeileis@R-project.org>
* R/finance.R (get.hist.quote)
* man/get.hist.quote.Rd:
handled `method' argument as in download.file(), so
that it can be set via options(download.file.method = "...")
2006-04-07 Achim Zeileis <Achim.Zeileis@R-project.org>
* R/finance.R (get.hist.quote)
* man/get.hist.quote.Rd:
added quiet argument passed on to download.file(), defaults
to FALSE (i.e., previous behaviour)
2005-10-24 Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
* DESCRIPTION (Version): New version is 0.10-0.
......
Package: tseries
Version: 0.10-0
Date: 2005-10-25
Version: 0.10-1
Date: 2006-05-10
Title: Time series analysis and computational finance
Author: Compiled by Adrian Trapletti <a.trapletti@swissonline.ch>
Maintainer: Kurt Hornik <Kurt.Hornik@R-project.org>
......@@ -8,4 +8,4 @@ Description: Package for time series analysis and computational finance
Depends: R (>= 2.2.0), quadprog, zoo
Suggests: its
License: GPL (see file COPYING)
Packaged: Mon Oct 24 21:56:15 2005; hornik
Packaged: Wed May 10 18:11:12 2006; zeileis
......@@ -136,9 +136,10 @@ function(x, pm = mean(x), riskless = FALSE, shorts = FALSE,
get.hist.quote <-
function (instrument = "^gdax", start, end,
quote = c("Open", "High", "Low", "Close"),
provider = c("yahoo", "oanda"), method = "auto",
provider = c("yahoo", "oanda"), method = NULL,
origin = "1899-12-30", compression = "d",
retclass = c("zoo", "its", "ts"))
retclass = c("zoo", "its", "ts"),
quiet = FALSE)
## Added new argument 'compression'.
## May be "d", "w" or "m", for daily weekly or monthly.
## Defaults to "d".
......@@ -155,6 +156,10 @@ function (instrument = "^gdax", start, end,
start <- as.Date(start)
end <- as.Date(end)
if(is.null(method)) {
method <- ifelse(!is.null(getOption("download.file.method")), getOption("download.file.method"), "auto")
}
if(provider == "yahoo") {
url <-
paste("http://chart.yahoo.com/table.csv?s=",
......@@ -174,7 +179,7 @@ function (instrument = "^gdax", start, end,
"&x=.csv",
sep = "")
destfile <- tempfile()
status <- download.file(url, destfile, method = method)
status <- download.file(url, destfile, method = method, quiet = quiet)
if(status != 0) {
unlink(destfile)
stop(paste("download error, status", status))
......@@ -219,9 +224,9 @@ function (instrument = "^gdax", start, end,
substr(dat[-idx], nchar(dat[-idx]) - 1, nchar(dat[-idx])),
sep = "")
dat <- as.Date(dat, "%d-%b-%Y")
if(dat[n] != start)
if(!quiet && dat[n] != start)
cat(format(dat[n], "time series starts %Y-%m-%d\n"))
if(dat[1] != end)
if(!quiet && dat[1] != end)
cat(format(dat[1], "time series ends %Y-%m-%d\n"))
if(retclass == "ts") {
......@@ -269,7 +274,7 @@ function (instrument = "^gdax", start, end,
sep="")
destfile <- tempfile()
status <- download.file(url, destfile, method = method)
status <- download.file(url, destfile, method = method, quiet = quiet)
if(status != 0) {
unlink(destfile)
stop(paste("download error, status", status))
......@@ -296,9 +301,9 @@ function (instrument = "^gdax", start, end,
n <- nrow(x)
dat <- as.Date(x[,1], format = "%m/%d/%Y")
if(dat[1] != start)
if(!quiet && dat[1] != start)
cat(format(dat[1], "time series starts %Y-%m-%d\n"))
if(dat[n] != end)
if(!quiet && dat[n] != end)
cat(format(dat[n], "time series ends %Y-%m-%d\n"))
if(retclass == "ts") {
......
......@@ -8,9 +8,9 @@
\usage{
get.hist.quote(instrument = "^gdax", start, end,
quote = c("Open", "High", "Low", "Close"),
provider = c("yahoo", "oanda"), method = "auto",
provider = c("yahoo", "oanda"), method = NULL,
origin = "1899-12-30", compression = "d",
retclass = c("zoo", "its", "ts"))
retclass = c("zoo", "its", "ts"), quiet = FALSE)
}
\arguments{
\item{instrument}{a character string giving the name of the quote
......@@ -36,7 +36,8 @@ get.hist.quote(instrument = "^gdax", start, end,
implemented. See \url{http://quote.yahoo.com/} and
\url{http://www.oanda.com/} for more information.}
\item{method}{tool to be used for downloading the data. See
\code{\link{download.file}} for the available download methods.}
\code{\link{download.file}} for the available download methods and
the default settings.}
\item{origin}{an R object specifying the origin of the Julian dates, see
above. Defaults to 1899-12-30 (Popular spreadsheet programs
internally also use Julian dates with this origin).}
......@@ -48,6 +49,7 @@ get.hist.quote(instrument = "^gdax", start, end,
should have: can be either \code{"zoo"} (with \code{"Date"} index),
\code{"its"} (with \code{"POSIXct"} index) or \code{"ts"} (with
numeric index corresponding to days since \code{origin}).}
\item{quiet}{logical. Should status messages (if any) be suppressed?}
}
\value{
A time series containing the data either as a \code{"zoo"} series (default),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment