[R-SIG-Finance] Period.Unrealized.PL always sums to 0 after a transaction, why? - Blotter/ Quantstrat
Derek Wong
treydog999 at gmail.com
Tue Dec 30 09:50:55 CET 2014
Hi
I have been diving into the workings of blotter just to understand it
better. I have been using the bbands.R demo that is in the quantstrat
project. It is actually a number that will sum with all of the
previous Period.Unrealized.PL to make it sum to 0. Shouldn't the
Period.Unrealized.PL for a bar with a transaction to exit be 0,
assuming you exit at the close price? or in the bbands.R example the
previous day 2007-03-20 close price is 94.50 the next day is 95.36.
Shouldn't 86 be the result not -54? I am not saying the result is
incorrect, I am just trying to figure out the logic behind the
calculations.
To get the portfolio PL sheet run bbands.R from r-forge then
port <- getPortfolio(portfolio.st)
View(port$symbols$IBM$posPL)
sum(port$symbols$IBM$posPL$Period.Unrealized.PL)
Thank you and happy new year.
Derek
More information about the R-SIG-Finance
mailing list