pub fn calculate_maker_taker_commission(
instrument: &InstrumentAny,
last_qty: Quantity,
last_px: Price,
fee_rate: Decimal,
use_quote_for_inverse: Option<bool>,
) -> Result<Money>Expand description
Calculates maker/taker commission from an explicitly resolved fee rate.
This is the single shared arithmetic for notional-based maker/taker fees used by both account calculations and execution fee models. Contract terms (notional and currency) come from the instrument; fee policy (the rate) comes from the account-owned schedule and must already be resolved by the caller.
The fee rate alone decides the commission sign: a positive rate charges and a negative rate rebates, including at a negative price.
ยงErrors
Returns an error if the notional value cannot be calculated, arithmetic overflows, or the commission cannot be represented in the notional currency.