nautechsystems/nautilus_trader · error · anyhow::Error

Cannot parse Kraken Futures instrument '{symbol}': {field} {

Error message

Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision {precision}, but this build supports at most {FIXED_PRECISION}; enable the 'high-precision' Cargo feature and rebuild

What it means

Identical condition to the high-precision variant: a Kraken Futures instrument field requires more decimal precision than FIXED_PRECISION supports. This arm is compiled when the 'high-precision' Cargo feature is NOT enabled and appends the actionable instruction to enable that feature and rebuild. The parse aborts rather than silently truncating the value.

Source

Thrown at crates/adapters/kraken/src/common/parse.rs:471

fn check_futures_precision(
    symbol: &str,
    field: &str,
    value: impl Display,
    precision: u32,
) -> anyhow::Result<()> {
    if precision <= u32::from(FIXED_PRECISION) {
        return Ok(());
    }

    #[cfg(feature = "high-precision")]
    anyhow::bail!(
        "Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision \
         {precision}, but this build supports at most {FIXED_PRECISION}"
    );

    #[cfg(not(feature = "high-precision"))]
    anyhow::bail!(
        "Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision \
         {precision}, but this build supports at most {FIXED_PRECISION}; enable the \
         'high-precision' Cargo feature and rebuild"
    );
}

fn parse_price(value: &str, field: &str) -> anyhow::Result<Price> {
    Price::from_str(value).map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))
}

fn parse_quantity(value: &str, field: &str) -> anyhow::Result<Quantity> {
    Quantity::from_str(value).map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))
}

/// Returns a currency from the internal map or creates a new crypto currency.
///
/// Uses [`Currency::get_or_create_crypto`] to handle unknown currency codes,
/// which automatically registers newly listed Kraken assets.

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Enable the feature and rebuild: cargo build -p nautilus-kraken --features high-precision.
  2. If the feature cannot be enabled, skip/blacklist that instrument so parse_futures_instrument is not called for it.
  3. Confirm the exact precision required from the Kraken Futures instruments API response to decide whether the feature is truly needed.

Example fix

// before
let adapter = KrakenFuturesAdapter::new();
// after (Cargo.toml)
[dependencies]
nautilus-kraken = { version = "...", features = ["high-precision"] }
Defensive patterns

Strategy: validation

Validate before calling

let decimals = field_value.split('.').nth(1).map(|f| f.len()).unwrap_or(0);
assert!(decimals <= FIXED_PRECISION, "{} needs precision {}; rebuild with --features high-precision", symbol, decimals);

Try / catch

if let Err(e) = parse_futures_instrument(...) {
    if e.to_string().contains("'high-precision'") {
        log::warn!("skipping {symbol}: rebuild with high-precision feature");
        return Ok(None);
    }
    return Err(e);
}

Prevention

When it happens

Trigger: parse_futures_instrument -> check_futures_precision encounters a symbol with a field (tick size, price, size) whose decimal precision exceeds FIXED_PRECISION while the crate is built without feature = "high-precision".

Common situations: Default/debug builds of the Kraken Futures adapter used against instruments with sub-default tick granularity; teams unaware the adapter gates extra precision behind a cargo feature.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


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