An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20080817/e8dc6f38/attachment.pl>
How to get data from different time zones (e.g. USA, EU, Asia) in the same format
3 messages · Bastian Offermann, Gabor Grothendieck
merge.zoo does that:
merge(z1, z2)
See ?merge.zoo
Note that unlike zoo in the core of R which can only merge two objects
at a time merge.zoo
can merge multiple objects so if L is a list of such zoo objects you can write:
do.call("merge.zoo", L)
On Sun, Aug 17, 2008 at 8:19 AM, Bastian Offermann
<bastian2507hk at yahoo.co.uk> wrote:
Hello,
I am currently analyzing market data retrieving data sets from yahoo with
the get.hist.quote function in the Performance Analytics package.
############ Data Import Sheet ##############
ticker<-c("^GSPC", "^GDAXI")
# Time horizon
from <- "1992-01-03" # of type "YYYY-MM-DD"
till <- "2007-12-31"
# Return frequency
freque <- c("d", "w", "m", "y")
fq <- 1 # input 1 for "d", 2 for "w" etc.
# Benchmark
benchmark <- get.hist.quote(ticker[1], start = from, end = till,
compression=freque[fq], quote="Close")
benchmark2 <- get.hist.quote(ticker[2], start = from, end = till,
compression=freque[fq], quote="Close")
Now, both benchmarks are zoo objects with an attached index. Unfortunately,
due to holidays etc both series do neither have identical indices nor the
same length (in most cases, sometimes they do by chance).
I have been trying to address this problem for quite some time now, but
cannot find a solution to it.
The problems arise as I usually store each series in a matrix format where
the rows contain the assets and the columns the respective quotes or returns
for a certain trading interval.
Quote 1 .. Quote 2 .. Quote N
Asset1
Asset 2
..
..
..
Asset N
Etc.
What I ultimately want to do is to match both series, i.e. same time indices
and same length.
Do you have an idea how to overcome this? Thanks in advance.
regards
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
That should be do.call("merge", L) since merge.zoo is not exported. I assume
your objects are all POSIXct with time zones so they are all
internally represented
with respect to GMT anyways. See R News 4/1.
On Sun, Aug 17, 2008 at 8:53 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
merge.zoo does that:
merge(z1, z2)
See ?merge.zoo
Note that unlike zoo in the core of R which can only merge two objects
at a time merge.zoo
can merge multiple objects so if L is a list of such zoo objects you can write:
do.call("merge.zoo", L)
On Sun, Aug 17, 2008 at 8:19 AM, Bastian Offermann
<bastian2507hk at yahoo.co.uk> wrote:
Hello,
I am currently analyzing market data retrieving data sets from yahoo with
the get.hist.quote function in the Performance Analytics package.
############ Data Import Sheet ##############
ticker<-c("^GSPC", "^GDAXI")
# Time horizon
from <- "1992-01-03" # of type "YYYY-MM-DD"
till <- "2007-12-31"
# Return frequency
freque <- c("d", "w", "m", "y")
fq <- 1 # input 1 for "d", 2 for "w" etc.
# Benchmark
benchmark <- get.hist.quote(ticker[1], start = from, end = till,
compression=freque[fq], quote="Close")
benchmark2 <- get.hist.quote(ticker[2], start = from, end = till,
compression=freque[fq], quote="Close")
Now, both benchmarks are zoo objects with an attached index. Unfortunately,
due to holidays etc both series do neither have identical indices nor the
same length (in most cases, sometimes they do by chance).
I have been trying to address this problem for quite some time now, but
cannot find a solution to it.
The problems arise as I usually store each series in a matrix format where
the rows contain the assets and the columns the respective quotes or returns
for a certain trading interval.
Quote 1 .. Quote 2 .. Quote N
Asset1
Asset 2
..
..
..
Asset N
Etc.
What I ultimately want to do is to match both series, i.e. same time indices
and same length.
Do you have an idea how to overcome this? Thanks in advance.
regards
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.