nautechsystems/nautilus_trader · error · anyhow::Error

Invalid stepSize of 0

Error message

Invalid stepSize of 0

What it means

Companion to the Spot tickSize check: decimal_quantity parses LOT_SIZE.stepSize and the code enforces it is non-zero. A zero step size cannot define quantity precision or valid order increments, so the parse aborts.

Source

Thrown at crates/adapters/binance/src/common/parse.rs:807

        .filters
        .iter()
        .find(|filter| filter.filter_type == "LOT_SIZE")
        .context("Missing LOT_SIZE in symbol filters")?;

    let tick_size = decimal_price(
        price_filter
            .tick_size
            .as_deref()
            .context("Missing PRICE_FILTER tickSize")?,
    )?;
    anyhow::ensure!(!tick_size.is_zero(), "Invalid tickSize of 0");
    let step_size = decimal_quantity(
        lot_filter
            .step_size
            .as_deref()
            .context("Missing LOT_SIZE stepSize")?,
    )?;
    anyhow::ensure!(!step_size.is_zero(), "Invalid stepSize of 0");

    let instrument = CurrencyPair::new(
        InstrumentId::new(
            Symbol::from_str_unchecked(&symbol.symbol),
            Venue::new(BINANCE),
        ),
        Symbol::new(&symbol.symbol),
        get_currency(&symbol.base_asset),
        get_currency(&symbol.quote_asset),
        tick_size.precision,
        step_size.precision,
        tick_size,
        step_size,
        None,
        Some(step_size),
        optional_decimal_quantity(lot_filter.max_qty.as_deref(), step_size.precision)?,
        optional_decimal_quantity(lot_filter.min_qty.as_deref(), step_size.precision)?,
        None,

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Check the live Spot exchangeInfo stepSize for the symbol.
  2. Skip symbols with a zero stepSize during loading.
  3. Refresh cached exchangeInfo data.
  4. Report persistent zero stepSize on an actively trading pair.
Defensive patterns

Strategy: try-catch

Validate before calling

fn spot_step_size_is_valid(symbol: &BinanceSymbolJson) -> bool {
    symbol
        .filters
        .iter()
        .find(|f| f.filter_type == "LOT_SIZE")
        .and_then(|f| f.step_size.as_deref())
        .map(|t| {
            rust_decimal::Decimal::from_str(t)
                .map(|d| !d.is_zero())
                .unwrap_or(false)
        })
        .unwrap_or(false)
}

Try / catch

match parse_spot_instrument_json_with_fees(&symbol, None, None, ts_event, ts_init) {
    Ok(inst) => instruments.push(inst),
    Err(e) if e.to_string().contains("Invalid stepSize of 0") => {
        tracing::warn!(symbol = %symbol.symbol, "zero stepSize, skipping")
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Spot exchangeInfo LOT_SIZE with "stepSize": "0" for the symbol being parsed — placeholder filters or corrupted payloads.

Common situations: Pre-listing symbols; stale caches or fixtures with zeroed filters; venue-side data issues.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16). Data as JSON: /api/errors/2b67b5dd96827150. Report an issue: GitHub.