[R-SIG-Finance] tradeStats vs table.AnnualizedReturns discrepancy

Brian G. Peterson brian at braverock.com
Tue Apr 24 14:48:58 CEST 2012


On Mon, 2012-04-23 at 20:50 -0700, SW wrote:
> I am wondering if anybody can help me to understand why I have a
> strange discrepancy between tradeStats and AnnulaizedReturns output
> for my strategy.
> Here is what I have. I made a simple quantstrat model and as result
> I've got an array of trades which I feed to  tradeStrats function like
> this:
> tstats <- tradeStats(Portfolio=port.name, Symbol=ticker)
> and printout output for tstats shows "Net Profit = 680" positive and
> probably correct number. Then, I run the following 
> rets <- PortfReturns(acct.name)
> table.AnnualizedReturns(rets)
> As result I have "Annualized Return = -0.0053" and it is negative...
> 
> So here is the dilemma: PnL positive, Return negative
> 
> In strategy there is only one account with one ticker and commission
> is not set. No open positions in the end.  (Full code below runs at
> 04/23/2012 in case you want to rerun it. change the total_hist.end
> variable at the top of file to the appropriate date.)
> I would be much obliged for any suggestions. 

You've run into the difference between geometric and simple returns.

> table.AnnualizedReturns(rets,geometric=FALSE)
                            GSPC
Annualized Return         0.0005
Annualized Std Dev        0.1076
Annualized Sharpe (Rf=0%) 0.0042
> 680/initEq
[1] 0.0004791972


So, this looks correct...

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list