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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 11 10:54:37 CEST 2010


Author: braverock
Date: 2010-10-11 10:54:36 +0200 (Mon, 11 Oct 2010)
New Revision: 413

Modified:
   pkg/blotter/R/addTxn.R
Log:
- move GrossTxnRealizedPL calc into addTxns, removing obsolete one-line calcRealizedPL fn

Modified: pkg/blotter/R/addTxn.R
===================================================================
--- pkg/blotter/R/addTxn.R	2010-10-11 00:07:10 UTC (rev 412)
+++ pkg/blotter/R/addTxn.R	2010-10-11 08:54:36 UTC (rev 413)
@@ -118,8 +118,8 @@
         #PrevPosQty     <- getPosQty(pname, Symbol, index(TxnData[row,]))
         PosQty         <- PrevPosQty+TxnQty
         PosAvgCost     <- calcPosAvgCost(PrevPosQty, PrevPosAvgCost, 0, PosQty, ConMult) # lag this over the data?
-        GrossTxnRealizedPL = calcRealizedPL(TxnQty, TxnAvgCost, PrevPosAvgCost, PosQty, PrevPosQty, ConMult)
-        NetTxnRealizedPL = GrossTxnRealizedPL - TxnFee
+		GrossTxnRealizedPL = TxnQty * ConMult * (PrevPosAvgCost - TxnAvgCost)
+		NetTxnRealizedPL = GrossTxnRealizedPL - TxnFee
         PrevPosQty     <- PosQty
         PrevPosAvgCost <- PosAvgCost
         



More information about the Blotter-commits mailing list