nautechsystems/nautilus_trader · error · anyhow::Error

price_match cannot be combined with post-only orders

Error message

price_match cannot be combined with post-only orders

What it means

price_match (priceMatch=OPP/OPP1) prices a LIMIT order against the best price on the opposite side of the book; Binance does not allow combining it with post-only. The adapter validates this combination before submission and rejects the order locally.

Source

Thrown at crates/adapters/binance/src/futures/execution.rs:2564

            if !matches!(
                order_type,
                OrderType::StopMarket | OrderType::MarketIfTouched
            ) {
                anyhow::bail!(
                    "`close_position` is not supported for order type {order_type:?} on Binance"
                );
            }

            if order.is_reduce_only() {
                anyhow::bail!("`close_position` cannot be combined with `reduce_only` on Binance");
            }
        }

        if let Some(pm_str) = cmd.params.as_ref().and_then(|p| p.get_str("price_match")) {
            BinancePriceMatch::from_param(pm_str)?;
            let order_type = order.order_type();
            anyhow::ensure!(
                !order.is_post_only(),
                "price_match cannot be combined with post-only orders"
            );
            anyhow::ensure!(
                order_type == OrderType::Limit,
                "price_match is not supported for order type {order_type:?}"
            );
        }

        let lifetime = determine_futures_order_lifetime(
            self.product_type,
            order.order_type(),
            order.time_in_force(),
            order.expire_time(),
            order.is_post_only(),
            self.config.use_gtd,
            self.clock.get_time_ns(),
        )?;

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Remove post_only for orders that use price_match
  2. Or drop price_match and specify an explicit limit price for post-only orders

Example fix

// before — conflicting combination
// order: post_only = true; params: price_match = "OPP"

// after — choose one
// order: post_only = false; params: price_match = "OPP"
Defensive patterns

Strategy: validation

Validate before calling

// Before submit_order()
if params.get_str("price_match").is_some() {
    assert!(!order.is_post_only(), "price_match cannot combine with post-only");
}

Type guard

fn price_match_combinable(has_price_match: bool, post_only: bool) -> bool {
    !has_price_match || !post_only
}

Try / catch

On this local rejection, resubmit with either post_only disabled or the price_match param removed and an explicit limit price set.

Prevention

When it happens

Trigger: SubmitOrder with a price_match param on an order built with post_only=true.

Common situations: Strategies stacking liquidity-provider constraints (post-only) with passive pricing features; config defaults that enable post_only globally while a template adds price_match.

Related errors


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