Skip to content
Prev 11013 / 15274 Next

Possible tradeStats() issue

On 11/20/2012 02:44 PM, Michael Newell wrote:
In the presence of transaction fees, you cannot really have a 
transaction with no P&L, can you?  (leaving aside a gain that precisely 
offsets the fees) so the count of transactions is indeed true.

There are three ways I can think of around this:
- one is to place the fees only on your flattening transactions, 
pretending that you only realize the fees when you exit the position...  
this isn't exactly true, but gets you what you seem to want.
- another would be to patch the function to allow a user-specified 
option to to use Gross rather than Net.
- or use perTradeStats instead, which uses position rather than P&L to 
separate 'trades'.  This function is newer than tradeStats, so perhaps 
the tradeStats function could be modified to use these instead of the 
simple PL>0 method.

Either of the latter two options shouldn't be a large change to the 
code, but I'm not likely to get to it any time soon. Patches Welcome.

Regards,

     - Brian