nautechsystems/nautilus_trader · error · anyhow::Error

Missing field ' ' in filter

Error message

Missing field '{field}' in filter

What it means

parse_filter_string extracts a string field from a Binance exchange filter JSON object (e.g. tickSize, stepSize fields of PRICE_FILTER or LOT_SIZE). This error is raised when the field is absent or present but not a JSON string, so the filter cannot be parsed into an instrument.

Solutions

  1. Ensure the filter object actually contains the expected field as a JSON string, matching Binance's exchangeInfo schema.
  2. Check you are calling the right parse function for the filter type (parse_filter_price vs parse_filter_quantity fields).
  3. Update the adapter if Binance changed the filter schema (e.g. switched string fields to numbers).
  4. Log the full filter JSON to see which filter/field is malformed.

Example fix

// before
let filter = json!({"filterType": "PRICE_FILTER"}); // missing tickSize

// after
let filter = json!({"filterType": "PRICE_FILTER", "tickSize": "0.01"});
Defensive patterns

Strategy: validation

Validate before calling

fn filter_has_string(filter: &serde_json::Value, field: &str) -> bool {
    filter.get(field).and_then(|v| v.as_str()).is_some()
}

Try / catch

// match parse_filter_price(&filter, "tickSize") {
//     Ok(p) => p,
//     Err(e) => { log::warn!("skipping symbol, bad filter: {e}"); continue; }
// }

Prevention

When it happens

Trigger: Parsing exchangeInfo filters where the expected field (e.g. 'minPrice', 'tickSize', 'stepSize') is missing from the filter object, or its value is a number rather than a string — common with non-standard filters or schema changes.

Common situations: Binance adding new filter types not handled by the parser; mocked exchangeInfo fixtures missing fields; secondary filter objects (e.g. PERCENT_PRICE fields) passed to the wrong parse function; proxies re-serializing numeric strings as numbers.

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/851ffed9438a9200. Report an issue: GitHub.

Appendix: source

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

    Currency::get_or_create_crypto(code)
}

/// Extracts filter values from Binance symbol filters array.
fn get_filter<'a>(filters: &'a [Value], filter_type: &str) -> Option<&'a Value> {
    filters.iter().find(|f| {
        f.get("filterType")
            .and_then(|v| v.as_str())
            .is_some_and(|t| t == filter_type)
    })
}

/// Parses a string field from a JSON value.
fn parse_filter_string(filter: &Value, field: &str) -> anyhow::Result<String> {
    filter
        .get(field)
        .and_then(|v| v.as_str())
        .map(String::from)
        .ok_or_else(|| anyhow::anyhow!("Missing field '{field}' in filter"))
}

/// Parses a Price from a filter field.
fn parse_filter_price(filter: &Value, field: &str) -> anyhow::Result<Price> {
    let value = parse_filter_string(filter, field)?;
    Price::from_str(&value).map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))
}

/// Parses a Quantity from a filter field.
fn parse_filter_quantity(filter: &Value, field: &str) -> anyhow::Result<Quantity> {
    let value = parse_filter_string(filter, field)?;
    Quantity::from_str(&value)
        .map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))
}

/// Parses the futures `MIN_NOTIONAL` filter into a `Money` value in `currency`.
///
/// Returns `None` when the filter is absent, the `notional` field cannot be

View on GitHub (pinned to 18893faf8b)