Copy your broker's actual schedule, per share, per contract or a percentage of value, with its minimum and maximum per order, and charge it on every fill, entries and exits both. For a strategy that trades small orders often, the minimum per order is usually what matters most, and a flat per-share rate without it understates the cost.
The common shapes
| Schedule | Charged as | Typical of |
|---|---|---|
| Per share, with a minimum and a cap | max(min, min(qty × rate, cap × value)) | US stock brokers on their direct-access plans |
| Per contract, per side | contracts × rate | Futures and options |
| Percentage of value | qty × price × rate | Crypto exchanges, many non-US stock brokers |
| Zero commission | 0, cost moves into the spread | Retail stock and ETF apps |
Exchange, clearing and regulatory fees often sit on top. Your broker's pricing page lists all of them; a backtest should charge their sum.
A worked example
At $0.005 a share with a $1 minimum per order, 50 shares cost $1.00, not the $0.25 that the per-share rate alone gives. A strategy that makes 500 round trips of 50 shares a year sends 1,000 orders and pays $1,000 in commissions, against $250 without the minimum. On a $10,000 account that difference alone is 7.5% a year.
Zero commission is not zero cost
Commission-free brokers are paid through order routing, and their fills can sit further from the midpoint. Model them with a wider spread or more slippage. See how realistic slippage and spread need to be.
How Reamer Research handles it
Reamer Research charges commission per unit, on both legs or only on opens or closes (commission_mode), and per ticker through ticker_config, so per-share and per-contract schedules are a setting. Minimums, caps and percentage schedules are applied from the fill log after the run. This function strategy is charged both ways:
import reamer_research as rr
def on_bar(d):
if d.close[0] == 0:
return None
up = d.close[-1] > d.close[-12:].mean()
if d.position() == 0 and up:
return rr.buy_market(50)
if d.position() > 0 and not up:
return rr.close_position()
def broker_fee(fill, rate=0.005, minimum=1.00, cap=0.01):
value = fill['qty'] * fill['price']
return max(minimum, min(fill['qty'] * rate, cap * value))
flat = rr.backtest(on_bar, 'data/SPY_5min.bin', lookback=12,
spread=0.01, commission_per_unit=0.005)
fills = flat.json()['trade_log']
charged = sum(f['fees'] for f in fills)
actual = sum(broker_fee(f) for f in fills)
print(f'{len(fills)} fills: per-share only {charged:.2f}, with minimum {actual:.2f}')
print(f'net {flat.net_pnl:.2f} -> {flat.net_pnl + charged - actual:.2f}')
trade_log has one row per fill with its price, quantity and the fees the engine charged, so any schedule, including a percentage (fill['qty'] * fill['price'] * rate) or tiered monthly rates, is a function of it. Per-contract futures fees go straight into ticker_config={'ES': {'commission_per_unit': 2.25}}. The same rule could be a class or a configured object.
Limits to know
- The engine's built-in commission is per unit. A minimum, a cap or a percentage is computed from
trade_logas above, which leaves fills unchanged; only an equity-dependent rule such as sizing from the account balance would see the difference. - Evaluation Mode runs 30 days or 50,000 bars of one ticker. Enough to compare schedules on your own strategy.
A $20 month includes the full kit, so you can run your strategy under your broker's real schedule and cancel if it does not fit.