Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Tracking Backtest Commissions

This is an example of a way to track commissions paid throughout backtests. I found that while a commission model can be specified, there isn't an intuitive way to track them through backtests.

It uses the fact that the order functions return an order ID when they are placed. The individual orders can be asked for using get_order(order_id). It tracks the total commission and the last commission paid.

This should be useful for optimizing things like rebalance frequency. The algo is the MACD /"sell in May and go away" from this post. It works in both minute and daily mode.

Please share any thoughts or alternative ways of going about this.

1 response

Here is the same algorithm tested on minute data, the commissions are higher because it enters and exits the market more often.