Modeling Brokerage Commissions and Taxes with QSTrader Fee Models
Summary
This article describes how QSTrader represents brokerage charges in a backtesting system through a FeeModel class hierarchy. An abstract base interface separates commission, tax, and total-cost calculations, allowing implementations to account for asset type, traded quantity, trade consideration, and broker-specific information such as trade date. Keeping brokerage behavior behind an interface also allows simulated and live brokerage components to fit the same trading logic.
Two simple implementations are presented. ZeroFeeModel returns no commission or tax and provides a baseline for comparing backtests. PercentFeeModel applies fixed commission and tax rates to the absolute traded consideration, so costs remain positive for buys and sells. These models cover only basic cost structures: they omit sliding percentage tiers and do not model slippage or market impact, which the article treats as separate topics. Brokerage schedules can vary by asset class, region, trade size, and date, so the examples are starting points rather than a complete representation of real execution costs. Comparing results across fee assumptions can help assess whether a strategy remains profitable after modeled charges.
Key ideas
- The FeeModel interface separates commission, tax, and total transaction cost calculations.
- Fee calculations can use asset, quantity, trade consideration, and broker context.
- A zero-fee model provides a baseline for comparing backtests with cost assumptions.
- A percentage model charges commission and tax on the absolute trade consideration.
- The simple models omit tiered rates, slippage, and market impact, which can materially affect realized costs.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.