FRENESDE

Commissions

Fees are set with cerebro.broker.setcommission(commission=0.001): here 0.1% of the amount of each order, on buys as well as sells.
A round trip (buy then sell) therefore pays fees twice. At 0.1% per order, a position must gain more than 0.2% just to cover its fees.
Fees are not the only cost: slippage, the gap between expected and obtained price, comes on top. Backtrader simulates it for example with cerebro.broker.set_slippage_perc(0.0005), i.e. 0.05%.
In notify_trade(), trade.pnl is the gross result and trade.pnlcomm the result net of commissions: compare them to see what your fees cost.

Examples

Key terms

Commission
Fee paid to the broker on each order
Round trip
A buy followed by the matching sell
Slippage
Gap between the expected price and the price actually obtained
pnlcomm
A trade’s result after commissions
Take the mission on Doji Academy

← Back to the index