nautechsystems/nautilus_trader · error

Quote-denominated quantities are not supported; quantity mus

Error message

Quote-denominated quantities are not supported; quantity must be denominated in the base token

What it means

This adapter requires the order quantity to be denominated in the base token of the trading pair; quote-denominated quantities (e.g. spend 1000 USDC) are not supported because the swap math is computed from the base amount. is_quote_quantity() returning true aborts the swap preparation.

Source

Thrown at crates/adapters/blockchain/src/execution/client.rs:1566

        let instrument_id = order.instrument_id();
        let pool = self.resolve_pool(&instrument_id)?;

        if order.order_type() != OrderType::Market {
            anyhow::bail!(
                "Unsupported order type {}; only Market is supported",
                order.order_type()
            );
        }

        if !matches!(order.order_side(), OrderSide::Buy | OrderSide::Sell) {
            anyhow::bail!(
                "Unsupported order side {}; only Buy and Sell are supported",
                order.order_side()
            );
        }

        if order.is_quote_quantity() {
            anyhow::bail!(
                "Quote-denominated quantities are not supported; quantity must be denominated in the base token"
            );
        }

        let fee = pool
            .fee
            .ok_or_else(|| anyhow::anyhow!("Pool {instrument_id} has no fee tier"))?;
        let fee = U24::try_from(fee)
            .map_err(|_| anyhow::anyhow!("Pool {instrument_id} fee {fee} exceeds uint24"))?;

        let base_token = pool.get_base_token();
        let quote_token = pool.get_quote_token();
        let quote_currency = Currency::new_checked(
            &quote_token.symbol,
            quote_token.decimals,
            0,
            &quote_token.name,
            CurrencyType::Crypto,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Convert the desired quote amount to a base-token quantity (divide by current price) and set the order quantity in base units.
  2. Change the strategy/position sizing configuration to emit base-denominated quantities for this venue.

Example fix

// before
order.set_quantity(Quantity::new(1000.0, 2)); // 1000 quote units
client.submit_order(cmd, &order)?;
// after
let price = latest_mid_price(instrument_id);
let base_qty = 1000.0 / price;
order.set_quantity(Quantity::new(base_qty, base_token.decimals));
client.submit_order(cmd, &order)?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust
if order.is_quote_quantity() {
    // convert to base before submitting
    let base_qty = quote_qty / current_price(instrument_id);
    order.set_quantity(Quantity::new(base_qty, base_decimals));
}

Prevention

When it happens

Trigger: submit_order called with an order whose quantity is expressed in the quote currency (order.is_quote_quantity() == true), typically when the strategy sets a quote-currency size or uses a 'notional' quantity mode.

Common situations: Porting a strategy that sizes positions in quote currency (USD value) to this adapter; risk sizing modules that emit notional quantities; misconfigured order factories defaulting to quote quantity.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/a4e6e95d0ae1f323. Report an issue: GitHub.