Commit 5fdbb45d authored by Dirk Eddelbuettel's avatar Dirk Eddelbuettel

Import Upstream version 0.10-10

parent 834f99a3
2007-02-11 Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
* DESCRIPTION (Version): New version is 0.10-9.
* DESCRIPTION (Version): New version is 0.10-10.
* R/finance.R (get.hist.quote): Adjust for Yahoo's change its CSV
files to use standard %Y-%m-%d dates.
......
Package: tseries
Version: 0.10-9
Version: 0.10-10
Date: 2007-02-11
Title: Time series analysis and computational finance
Author: Compiled by Adrian Trapletti <a.trapletti@swissonline.ch>
......@@ -9,4 +9,4 @@ Depends: R (>= 2.2.0), quadprog, stats, zoo
Suggests: its
Imports: graphics, stats, utils
License: GPL-2
Packaged: Sun Feb 11 13:35:36 2007; hornik
Packaged: Sun Feb 11 22:50:52 2007; hornik
......@@ -208,23 +208,8 @@ function (instrument = "^gdax", start, end,
stop("this quote is not available")
n <- nrow(x)
## Yahoo currently formats dates as '26-Jun-01', hence need C
## LC_TIME locale for getting the month right.
lct <- Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME", "C")
on.exit(Sys.setlocale("LC_TIME", lct))
dat <- gsub(" ", "0", as.character(x[, 1])) # Need the gsub?
idx <- c(grep(".*-0.", dat), grep(".*-1.", dat))
dat[idx] <- paste(substr(dat[idx], 1, nchar(dat[idx]) - 2),
"20",
substr(dat[idx], nchar(dat[idx]) - 1, nchar(dat[idx])),
sep = "")
dat[-idx] <- paste(substr(dat[-idx], 1, nchar(dat[-idx]) - 2),
"19",
substr(dat[-idx], nchar(dat[-idx]) - 1, nchar(dat[-idx])),
sep = "")
dat <- as.Date(dat, "%Y-%m-%d")
## Yahoo now seems to format dates as %Y-%m-%d.
dat <- as.Date(as.character(x[, 1]), "%Y-%m-%d")
if(!quiet && dat[n] != start)
cat(format(dat[n], "time series starts %Y-%m-%d\n"))
if(!quiet && dat[1] != end)
......@@ -232,8 +217,8 @@ function (instrument = "^gdax", start, end,
if(retclass == "ts") {
jdat <- unclass(julian(dat, origin = as.Date(origin)))
## We need unclass() because 1.7.0 does not allow adding a number
## to a "difftime" object.
## We need unclass() because 1.7.0 does not allow adding a
## number to a "difftime" object.
ind <- jdat - jdat[n] + 1
y <- matrix(NA, nr = max(ind), nc = length(nser))
y[ind, ] <- as.matrix(x[, nser, drop = FALSE])
......
......@@ -90,8 +90,8 @@ if(!inherits(try(open(url("http://quote.yahoo.com")), silent = TRUE),
quote = "Close")
ibm <- get.hist.quote(instrument = "ibm", start = "1998-01-01",
quote = "AdjClose")
% x <- merge(spc, ibm)
% plot(x, main = "IBM vs S&P 500")
x <- merge(spc, ibm)
plot(x, main = "IBM vs S&P 500")
x <- get.hist.quote(instrument = "EUR/USD", provider = "oanda",
start = "2004-01-01")
......
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