[Blotter-commits] r280 - pkg/RTAQ/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Mar 8 10:08:34 CET 2010
Author: jonathan
Date: 2010-03-08 10:08:34 +0100 (Mon, 08 Mar 2010)
New Revision: 280
Modified:
pkg/RTAQ/R/aggregate.R
pkg/RTAQ/R/volatility.R
Log:
Modified: pkg/RTAQ/R/aggregate.R
===================================================================
--- pkg/RTAQ/R/aggregate.R 2010-03-04 13:37:09 UTC (rev 279)
+++ pkg/RTAQ/R/aggregate.R 2010-03-08 09:08:34 UTC (rev 280)
@@ -76,12 +76,21 @@
##k indicates the number of periods to aggregate over
ts2 = aggregatets(ts, FUN=previoustick, on, k);
+ #adjustmet correct opening price
date = strsplit(as.character(index(ts))," ")[[1]][1]
realopen = "09:30:00";
a = as.timeDate(paste(date,realopen));
b = xts(ts[1],a);
+ ts3 = c(b,ts2);
- ts3 = c(b,ts2);
+ ##adjustment for correct closing price:
+ realclose = "16:00:00";
+ aa = as.timeDate(paste(date,realclose));
+ condition = index(ts3) < aa;
+ ts3=ts3[condition];
+ bb = xts(ts[length(ts)],aa);
+ ts3 = c(ts3,bb);
+
return(ts3);
}
Modified: pkg/RTAQ/R/volatility.R
===================================================================
--- pkg/RTAQ/R/volatility.R 2010-03-04 13:37:09 UTC (rev 279)
+++ pkg/RTAQ/R/volatility.R 2010-03-08 09:08:34 UTC (rev 280)
@@ -187,7 +187,7 @@
}
}
-tresholdcov = function(ts) {
+thresholdcov = function(ts) {
n=dim(ts)[1]; #number of observations
delta = 1/n;
rbpvars = apply(ts,2,FUN=RBPVar); #bipower variation per stock
@@ -196,12 +196,9 @@
condition = ts>tresmatrix;
ts[condition] = 0;
cov = RCov(ts);
-
return(cov);
}
-
-
#Realized Correlation (RCor)
RCor = function(ts){
ts = na.locf(ts,na.rm=FALSE);
More information about the Blotter-commits
mailing list