[Blotter-commits] r411 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Oct 10 14:05:54 CEST 2010
Author: braverock
Date: 2010-10-10 14:05:53 +0200 (Sun, 10 Oct 2010)
New Revision: 411
Removed:
pkg/blotter/R/calcPosValue.R
pkg/blotter/R/calcRealizedPL.R
pkg/blotter/R/calcTradingPL.R
Log:
- remove three obsolete calc* functions
Deleted: pkg/blotter/R/calcPosValue.R
===================================================================
--- pkg/blotter/R/calcPosValue.R 2010-10-08 13:47:27 UTC (rev 410)
+++ pkg/blotter/R/calcPosValue.R 2010-10-10 12:05:53 UTC (rev 411)
@@ -1,5 +0,0 @@
-`calcPosValue` <-
-function(PosQty, ClosePrice, ConMult=1) {
- PosValue <- PosQty * ClosePrice * ConMult
- return(PosValue)
-}
Deleted: pkg/blotter/R/calcRealizedPL.R
===================================================================
--- pkg/blotter/R/calcRealizedPL.R 2010-10-08 13:47:27 UTC (rev 410)
+++ pkg/blotter/R/calcRealizedPL.R 2010-10-10 12:05:53 UTC (rev 411)
@@ -1,43 +0,0 @@
-`calcRealizedPL` <-
-function(TxnQty, TxnAvgCost, PrevPosAvgCost, PosQty, PrevPosQty, ConMult=1)
-{ # @author Peter Carl
-
- # DESCRIPTION
- # Calculates any realized gain or loss resulting from a transaction
-
- # Inputs
- # TxnQty: total units (shares) of the transaction
- # TxnAvgCost: unit normalized (per share) cost implied by the transaction
- # PrevPosAvgCost: average position cost of the previous position
- # PosQty: total units (shares) of the resulting position
- # PrevPosQty: quantity of the previous position
-
- # Outputs
- # RealizedPL: value of profit or loss realized in a transaction
-
- # 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))
- RealizedPL = 0
-
- # if prev position is negative and position is larger, OR
- # if prev position is positive and position is smaller,
- # then calc RealizedPL
- else
- RealizedPL = TxnQty * ConMult * (PrevPosAvgCost - TxnAvgCost)
-
- return(RealizedPL)
-}
-
-###############################################################################
-# Blotter: Tools for transaction-oriented trading systems development
-# for R (see http://r-project.org/)
-# Copyright (c) 2008-2010 Peter Carl and Brian G. Peterson
-#
-# This library is distributed under the terms of the GNU Public License (GPL)
-# for full details see the file COPYING
-#
-# $Id$
-#
-###############################################################################
Deleted: pkg/blotter/R/calcTradingPL.R
===================================================================
--- pkg/blotter/R/calcTradingPL.R 2010-10-08 13:47:27 UTC (rev 410)
+++ pkg/blotter/R/calcTradingPL.R 2010-10-10 12:05:53 UTC (rev 411)
@@ -1,4 +0,0 @@
-calcTradingPL <- function(PosValue,PrevPosValue,TxnValue) {
- TradingPL <- PosValue - PrevPosValue - TxnValue
- return(TradingPL)
-}
More information about the Blotter-commits
mailing list