nautechsystems/nautilus_trader · error

inverse instrument {} has no base currency

Error message

inverse instrument {} has no base currency

What it means

calculate_notional_value for inverse instruments requires a base currency; inverse contracts (e.g. coin-margined futures) are denominated in their base asset. When use_quote_for_inverse is false and the instrument's base_currency() returns None (the instrument model has no base currency defined), this error is raised.

Source

Thrown at crates/model/src/instruments/mod.rs:581

    ///
    /// # Errors
    ///
    /// Returns an error if base-denominated inverse valuation lacks a base currency or positive
    /// price, or if the result cannot be represented as [`Money`].
    #[inline(always)]
    fn try_calculate_notional_value(
        &self,
        quantity: Quantity,
        price: Price,
        use_quote_for_inverse: Option<bool>,
    ) -> anyhow::Result<Money> {
        let use_quote_inverse = use_quote_for_inverse.unwrap_or(false);
        let currency = if self.is_inverse() {
            if use_quote_inverse {
                self.quote_currency()
            } else {
                self.base_currency().ok_or_else(|| {
                    anyhow::anyhow!("inverse instrument {} has no base currency", self.id())
                })?
            }
        } else if self.is_quanto() {
            self.settlement_currency()
        } else {
            self.quote_currency()
        };

        try_notional_value(
            quantity,
            price,
            self.multiplier(),
            self.is_inverse(),
            use_quote_inverse,
            currency,
        )
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass use_quote_for_inverse = Some(true) so quote currency is used instead of the missing base currency.
  2. Check instrument.is_inverse() and base_currency().is_some() before computing notional; skip or route those instruments differently.
  3. Fix the instrument definition so a base currency is provided for the inverse instrument.

Example fix

// before
let notional = instrument.calculate_notional_value(price, qty, None);
// after
let notional = instrument.calculate_notional_value(price, qty, Some(true)); // use quote for inverse
Defensive patterns

Strategy: validation

Validate before calling

let use_quote = instrument.is_inverse() && instrument.base_currency().is_none();
let notional = instrument.calculate_notional_value(price, qty, Some(use_quote));

Try / catch

// Rust
match instrument.try_calculate_notional_value(price, qty, None) {
    Ok(m) => m,
    Err(e) => { log::warn!("notional skipped: {e}"); Money::zero(currency, precision) }
}

Prevention

When it happens

Trigger: Calling calculate_notional_value (default use_quote_for_inverse=false) on an inverse instrument whose type implements base_currency() as None, such as certain synthetic or option-like inverse instruments.

Common situations: Using generic notional/PnL reporting code against an inverse instrument that lacks a base currency, or forgetting to pass use_quote_for_inverse=true for instruments where only the quote currency is meaningful.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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