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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 22 18:42:53 CET 2010


Author: braverock
Date: 2010-12-22 18:42:52 +0100 (Wed, 22 Dec 2010)
New Revision: 506

Modified:
   pkg/blotter/R/updatePosPL.R
Log:
- apply patch for NA ConMult from Wolfgang Wu , < wobwu22 <at> yahoo <dot> de >

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2010-12-21 15:36:36 UTC (rev 505)
+++ pkg/blotter/R/updatePosPL.R	2010-12-22 17:42:52 UTC (rev 506)
@@ -90,10 +90,13 @@
 	tmpPL$Pos.Qty <- ifelse(is.na(tmpPL$Pos.Qty) & !is.na(tmpPL$Pos.Qty.1), tmpPL$Pos.Qty.1, tmpPL$Pos.Qty)
 	#tmpPL$Pos.Qty <- ifelse(is.na(tmpPL$Pos.Qty) & !is.na(lagPosQty), tmpPL$Pos.Qty.1, tmpPL$Pos.Qty)
 	tmpPL$Pos.Qty <- na.locf(tmpPL$Pos.Qty)
-
+    
+    
+    #TODO check for instrument multiplier rather than doing all this messing around, if possible.
 	tmpPL$Con.Mult.1 <- na.locf(tmpPL$Con.Mult.1)
 	tmpPL$Con.Mult.1 <- ifelse(is.na(tmpPL$Con.Mult) & !is.na(tmpPL$Con.Mult.1) , tmpPL$Con.Mult.1, tmpPL$Con.Mult)
 	tmpPL$Con.Mult <- na.locf(tmpPL$Con.Mult)
+    tmpPL$Con.Mult <- na.locf(tmpPL$Con.Mult, fromLast=TRUE) # carry NA's backwards too, might cause problems with options contracts that change multiplier
 	tmpPL$Con.Mult <- ifelse(is.na(tmpPL$Con.Mult) ,1, tmpPL$Con.Mult)
 	
 	tmpPL$Pos.Avg.Cost.1 <- na.locf(tmpPL$Pos.Avg.Cost.1)



More information about the Blotter-commits mailing list