CommissionBook

class CommissionBook(model: CommissionModel = NoCommission)

Charges and tallies trading commission across a run.

The trading pipeline calls charge on every fill; the returned amount is subtracted from realized PnL so equity, drawdown, and Sharpe reflect the cost, while total/totalFor feed the report's commissionPaid line — the explicit bridge from gross trade PnL to net.

Defaults to NoCommission, so a book that is never given a real model (live, or a backtest with no configured rate) charges nothing and tallies zero.

Constructors

Link copied to clipboard
constructor(model: CommissionModel = NoCommission)

Functions

Link copied to clipboard
fun charge(strategyId: String, symbol: String, quantity: BigDecimal, price: BigDecimal? = null): BigDecimal

Commission for filling quantity lots of symbol under strategyId, at price when the caller knows it (price-based fees need it): tallies it and returns the amount so the caller can deduct it from that fill's realized PnL.

Link copied to clipboard

Total commission charged across all strategies.

Link copied to clipboard
fun totalFor(strategyId: String): BigDecimal

Commission charged under strategyId.