backtesting.py
backtesting.py copied to clipboard
Minimum commission per trade
Say I've got a 1.00$ minimum commission + 1% per trade, it doesn't appear to be possible to account for that, beyond just using a the commission=0.01 and ignoring the 1 dollar minimum.
Is such a thing possible?
Additional info
- Backtesting version: 0.2.0
Not possible. This would require an extra parameter, and we have nearly too many of those already, so I'm somewhat disinclined, more leaning to rule-of-thumb/ballpark estimations in that case.
Besides ignoring, I guess you can do accounting for (i.e. slightly increase commission rate for all trades, e.g. commission=.0125).
Do you make many trades where commissions sum to less than the minimum? In that case the relative commission model is completely flawed. But so might be your strategy ... :thinking:
Not possible. This would require an extra parameter, and we have nearly too many of those already, so I'm somewhat disinclined, more leaning to rule-of-thumb/ballpark estimations in that case.
Besides ignoring, I guess you can do accounting for (i.e. slightly increase commission rate for all trades, e.g.
commission=.0125).Do you make many trades where commissions sum to less than the minimum? In that case the relative commission model is completely flawed. But so might be your strategy ... 🤔
This issue is important for the whole repository. Most exchanges for stocks and futures charge a dollar commission, not a percentage like cryptocurrency. I think it's worth potentially adding a minimum commission nominated dollars/euros/etc.
Also, consider that this adds flexibility and enables more accurate backtesting.

I have trouble to understand this phrase
Note, if you wish to account for bid-ask spread, you can approximate doing so by increasing the commission, e.g. set it to 0.0002 for commission-less forex trading where the average spread is roughly 0.2‰ of asking price.
if you set to 0.0002 then it would be 0.02 not 0.2%
0.2% would be 0.002 am i wrong?
@makovez Notice the symbol in "0.2 ‰" is per mille, not per cent. :wink:
Ops sorry. Never seen that symbol before. Now makes sense. Thanks.
so usually commission is around 0.02% of buy price?