[Blotter-commits] r1236 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 3 14:03:25 CET 2012


Author: braverock
Date: 2012-11-03 14:03:24 +0100 (Sat, 03 Nov 2012)
New Revision: 1236

Modified:
   pkg/blotter/R/chart.Posn.R
Log:
- force index class to POSIXct to avoid incompatible method errors on < compare

Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R	2012-11-03 12:02:52 UTC (rev 1235)
+++ pkg/blotter/R/chart.Posn.R	2012-11-03 13:03:24 UTC (rev 1236)
@@ -44,7 +44,7 @@
     Sells = Portfolio$symbols[[Symbol]]$txn$Txn.Price[which(Trades<0)]
 
     Position = Portfolio$symbols[[Symbol]]$txn$Pos.Qty
-    if(first(index(Prices))<first(index(Position))) Position<-rbind(xts(0,order.by=first(index(Prices)-1)),Position)
+    if(as.POSIXct(first(index(Prices)))<as.POSIXct(first(index(Position)))) Position<-rbind(xts(0,order.by=first(index(Prices)-1)),Position)
     Positionfill = na.locf(merge(Position,index(Prices)))
     
     CumPL = cumsum(Portfolio$symbols[[Symbol]]$posPL$Net.Trading.PL)



More information about the Blotter-commits mailing list