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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 9 18:39:58 CEST 2015


Author: bodanker
Date: 2015-08-09 18:39:58 +0200 (Sun, 09 Aug 2015)
New Revision: 1694

Modified:
   pkg/blotter/R/addTxn.R
Log:
Replace single equal w/double-equal in if statement

This fixes a subtle bug that would not set Gross.Txn.Realized.PL to
zero when the previous position quantity was zero.


Modified: pkg/blotter/R/addTxn.R
===================================================================
--- pkg/blotter/R/addTxn.R	2015-08-09 16:29:59 UTC (rev 1693)
+++ pkg/blotter/R/addTxn.R	2015-08-09 16:39:58 UTC (rev 1694)
@@ -132,7 +132,7 @@
   	# if the previous position is zero, RealizedPL = 0
   	# if previous position is positive and position is larger, RealizedPL =0
   	# if previous position is negative and position is smaller, RealizedPL =0
-  	if(abs(PrevPosQty) < abs(PosQty) | (PrevPosQty = 0))
+  	if(abs(PrevPosQty) < abs(PosQty) | (PrevPosQty == 0))
   		GrossTxnRealizedPL = 0
 	
 	  NetTxnRealizedPL = GrossTxnRealizedPL + txnfees



More information about the Blotter-commits mailing list