nautechsystems/nautilus_trader · error · anyhow::Error

missing positive price for Binance algo order type {:?}

Error message

missing positive price for Binance algo order type {:?}

What it means

Companion of the trigger-price check: for Binance Futures algo order updates of type STOP or TAKE_PROFIT (the limit variants, per requires_algo_limit_price), a positive limit price is mandatory. The parsed price was None (empty, zero, or negative raw string), so the update is rejected rather than turned into a malformed order report.

Source

Thrown at crates/adapters/binance/src/futures/websocket/streams/parse_exec.rs:465

    if trigger_price.is_none() && requires_algo_trigger_price(algo_data.order_type) {
        anyhow::bail!(
            "missing positive trigger_price for Binance algo order type {:?}",
            algo_data.order_type
        );
    }

    Ok(trigger_price)
}

fn parse_algo_limit_price(
    algo_data: &AlgoOrderUpdateData,
    price_precision: u8,
) -> anyhow::Result<Option<Price>> {
    let price = parse_positive_price_at_precision(&algo_data.price, price_precision, "price")?;

    if price.is_none() && requires_algo_limit_price(algo_data.order_type) {
        anyhow::bail!(
            "missing positive price for Binance algo order type {:?}",
            algo_data.order_type
        );
    }

    Ok(price)
}

fn parse_trailing_offset_basis_points(raw: &str) -> Option<Decimal> {
    let rate = parse_required_decimal(raw, "callback_rate").ok()?;
    if rate <= Decimal::ZERO {
        return None;
    }

    rate.checked_mul(Decimal::from(100))
}

fn parse_working_type(working_type: BinanceWorkingType) -> TriggerType {

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Ensure STOP and TAKE_PROFIT orders are always submitted with a strictly positive limit price
  2. Log the computed limit price at submission time to catch zero/negative values from sizing logic before they reach the venue
  3. If the venue legitimately sends these types without a price, capture the raw payload and report upstream as an order-type mapping bug
Defensive patterns

Strategy: validation

Validate before calling

from nautilus_trader.model.objects import Price

def valid_limit(price: Price | None) -> bool:
    return price is not None and price.as_double() > 0

assert valid_limit(order_factory_price), "STOP/TAKE_PROFIT limit orders need a positive limit price"

Prevention

When it happens

Trigger: An algo order update for a STOP or TAKE_PROFIT (limit) order whose price field is missing, "0", or negative, so parse_positive_price_at_precision returned None and the requirement check fails.

Common situations: Submitting a STOP_LIMIT / TAKE_PROFIT_LIMIT style order without a limit price; a strategy computing the limit price to 0 due to a rounding or sizing bug; upstream enum changes misclassifying the order type.

Related errors


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