nautechsystems/nautilus_trader · error · anyhow::Error
Invalid stepSize of 0
Error message
Invalid stepSize of 0
What it means
Venue-data guard when parsing Binance spot symbol filters: a LOT_SIZE step_size of zero is invalid (quantity quantization would divide by zero) and is rejected after being parsed from the exchange filters.
Solutions
- Skip or exclude the affected symbol from instrument loading
- Re-fetch exchange-info and confirm the filter values are sane
- Use load_ids to load only verified symbols
- Update the adapter if Binance changes how it publishes stepSize
Example fix
// before
let instrument = parse_spot_instrument_json(&json)?;
// after
let step = json["filters"]["stepSize"].as_str().unwrap_or_default();
if step == "0" || step.is_empty() { eprintln!("skip: zero stepSize"); continue; } Defensive patterns
Strategy: validation
Validate before calling
let step = lot_filter["stepSize"].as_str().unwrap_or("0"); if step.parse::<Decimal>().map(|d| d.is_zero()).unwrap_or(true) { skip_symbol(); } Type guard
fn valid_step(f: &serde_json::Value) -> bool { f["stepSize"].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("stepSize") => { warn!("skip: {e}"); None }, Err(e) => return Err(e) } Prevention
- Validate LOT_SIZE fields before instrument construction
- Avoid cached or stale exchange-info snapshots
- Report persistent zero-stepSize symbols to Binance support
When it happens
Trigger: parse_spot_instrument_json_with_fees building a spot instrument when the exchange-info LOT_SIZE.stepSize field is "0".
Common situations: Malformed or placeholder exchange-info entries (often on testnet); corrupt cached exchange info; new symbols published with incomplete filters.
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
- Invalid tickSize of 0
- Binance Futures fill report end time requires start time…
- Binance Futures goodTillDate must be strictly greater than…
- Binance Futures trade limit must not exceed 1000
- Binance instrument filter
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/2b67b5dd96827150.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/common/parse.rs:793
.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)
.price_increment(tick_size)
.size_increment(step_size)
.lot_size(step_size)
.maybe_max_quantity(optional_decimal_quantity(
lot_filter.max_qty.as_deref(),
step_size.precision,
)?)View on GitHub (pinned to 18893faf8b)