[Blotter-commits] r177 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 18 17:20:58 CET 2010
Author: braverock
Date: 2010-01-18 17:20:58 +0100 (Mon, 18 Jan 2010)
New Revision: 177
Modified:
pkg/blotter/R/chart.Posn.R
Log:
- fix rounding, add equality test if data is already aligned
Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R 2010-01-18 15:47:56 UTC (rev 176)
+++ pkg/blotter/R/chart.Posn.R 2010-01-18 16:20:58 UTC (rev 177)
@@ -32,8 +32,11 @@
daily = { mult=86400 },
{mult=86400}
)
- n=round(freq$frequency/mult,0)*mult
- Prices=align.time(Prices,n)
+ n=round(freq$frequency,0)*mult
+ if(!all.equal(freq$frequency*mult,round(freq$frequency,0)*mult)) {
+ # if the equality
+ Prices=align.time(Prices,n)
+ }
tzero = xts(0,order.by=index(Prices[1,]))
Trades = Portfolio[[Symbol]]$txn$Txn.Price*Portfolio[[Symbol]]$txn$Txn.Qty
Buys = Portfolio[[Symbol]]$txn$Txn.Price[which(Trades>0)]
More information about the Blotter-commits
mailing list