nautechsystems/nautilus_trader · error · anyhow::Error

Invalid tickSize of 0

Error message

Invalid tickSize of 0

What it means

A spot symbol's PRICE_FILTER contains a tickSize of 0, which cannot represent a valid price increment; the adapter rejects the instrument because all price rounding logic depends on a positive tick size.

Solutions

  1. Skip or exclude the affected symbol from instrument loading
  2. Verify the raw exchange-info entry for the symbol and report/update if Binance fixed it
  3. Refresh exchange-info data and retry
  4. Use load_ids to load only known-good symbols

Example fix

// before
client.request_instruments();  // loads all symbols incl. bad tickSize
// after
if exchange_info_tick_size(symbol) == "0" { eprintln!("skip {symbol}: zero tickSize"); continue; }
Defensive patterns

Strategy: validation

Validate before calling

let tick = price_filter["tickSize"].as_str().unwrap_or("0"); if tick.parse::<Decimal>().map(|d| d.is_zero()).unwrap_or(true) { skip_symbol(); }

Type guard

fn valid_tick(f: &serde_json::Value) -> bool { f["tickSize"].as_str().and_then(|s| s.parse::<Decimal>().ok()).map_or(false, |d| !d.is_zero()) }

Try / catch

match build_instrument(&sym) { Ok(i) => Some(i), Err(e) if e.to_string().contains("tickSize") => { warn!("skip: {e}"); None }, Err(e) => return Err(e) }

Prevention

When it happens

Trigger: parse_spot_instrument_json_with_fees building a spot instrument when the exchange-info PRICE_FILTER.tickSize field is "0" (or numerically zero).

Common situations: Binance exchange-info anomalies for newly listed or special symbols; testnet data with placeholder filters; mock/recorded responses with zeroed filter values.

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


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

Appendix: source

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

    let price_filter = symbol
        .filters
        .iter()
        .find(|filter| filter.filter_type == "PRICE_FILTER")
        .context("Missing PRICE_FILTER in symbol filters")?;
    let lot_filter = symbol
        .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::builder()
        .instrument_id(InstrumentId::new(
            Symbol::from_str_unchecked(&symbol.symbol),
            Venue::new(BINANCE),
        ))
        .raw_symbol(Symbol::new(&symbol.symbol))
        .base_currency(get_currency(&symbol.base_asset))
        .quote_currency(get_currency(&symbol.quote_asset))
        .price_precision(tick_size.precision)
        .size_precision(step_size.precision)

View on GitHub (pinned to 18893faf8b)