nautechsystems/nautilus_trader · error
invalid commission=
Error message
invalid commission='{raw_commission}': {e} What it means
Binance Futures order fill parsing wraps a failure from `Money::from_decimal` when converting the raw commission string of an ORDER_TRADE_UPDATE fill into a Nautilus `Money` value. The underlying `e` typically indicates the amount has more decimal places than the currency's precision allows, or the amount is otherwise unrepresentable (e.g. negative, NaN). The raw string is included so the offending exchange payload can be inspected.
Solutions
- Check the log's `raw_commission` value and compare its decimal places with the currency's precision; round/truncate the commission to currency precision at the adapter boundary if the venue sends extra digits.
- Verify the resolved commission currency (commissionAsset mapped through `order_commission_currency`) is correct — a wrong currency with lower precision causes the rejection.
- If the payload is genuinely malformed, report/disclose the message and skip or reconcile the fill via REST instead of treating it as a code bug.
- Update the local `Currency` precision definition if the venue has changed precision for that asset.
Example fix
// before
let commission = Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid commission='{raw_commission}': {e}"))?;
// after
let amount = amount.round_to_currency_precision(currency); // truncate venue-supplied extra precision
let commission = Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid commission='{raw_commission}': {e}"))?; Defensive patterns
Strategy: validation
Validate before calling
// Rust: check commission fits currency precision before dispatch/handling
fn commission_fits(raw: &str, currency: &Currency) -> bool {
raw.parse::<rust_decimal::Decimal>()
.map(|d| d.scale() <= currency.precision as u32 && d > rust_decimal::Decimal::ZERO)
.unwrap_or(false)
} Prevention
- Keep local Currency precision definitions in sync with Binance asset specs
- Round venue-supplied commissions to currency precision at the adapter boundary
- Monitor for BNB fee-discount fills, which have higher-precision commissions
- Alert on this error and reconcile affected fills via REST user-trades
When it happens
Trigger: A Binance Futures ORDER_TRADE_UPDATE event carries a `commission` field (e.g. "0.00000123" for BNB fee discount) whose decimal precision exceeds the precision of the resolved commission currency, or a malformed/negative value. Raised inside `parse_order_commission`, called from `parse_order_fill_event_fields` during WS fill dispatch.
Common situations: BNB fee-discount commissions with 8+ decimals against a 2-decimal fiat currency; venue sending commission in an asset whose precision disagrees with the local currency definition; a venue schema change or a test/mocked payload with an arbitrary commission string.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- invalid commission=
- invalid fee amount=
- invalid precision
- BinanceFuturesWebSocketClient requires UsdM or CoinM…
- Cannot determine fill quantity: fill_sz=
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/b0837c91bfc19c99.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/websocket/streams/dispatch.rs:765
}
};
Ok((last_qty, last_px, commission_currency, commission))
}
fn parse_order_commission(
order: &OrderUpdateData,
bnfcr_currency: Currency,
) -> anyhow::Result<(Currency, Option<Money>)> {
let currency = order_commission_currency(order, bnfcr_currency);
let Some(raw_commission) = order.commission.as_deref() else {
return Ok((currency, None));
};
let amount = parse_required_decimal(raw_commission, "commission")?;
let commission = Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid commission='{raw_commission}': {e}"))?;
Ok((currency, Some(commission)))
}
fn order_commission_currency(order: &OrderUpdateData, bnfcr_currency: Currency) -> Currency {
order
.commission_asset
.as_ref()
.map_or(bnfcr_currency, |asset| {
normalize_futures_asset(asset.as_str(), bnfcr_currency)
})
}
fn parse_order_terminal_quantities(order: &OrderUpdateData) -> anyhow::Result<(Decimal, Decimal)> {
let original_qty = parse_required_decimal(&order.original_qty, "original_qty")?;
let cumulative_filled_qty =
parse_required_decimal(&order.cumulative_filled_qty, "cumulative_filled_qty")?;
View on GitHub (pinned to 18893faf8b)