nautechsystems/nautilus_trader · error · anyhow::Error
`close_position` cannot be combined with `reduce_only` on Bi
Error message
`close_position` cannot be combined with `reduce_only` on Binance
What it means
Binance Futures treats closePosition and reduceOnly as mutually exclusive: closePosition already implies closing the whole position, so combining them is rejected by the venue. The adapter validates this before submission and fails fast with this message.
Source
Thrown at crates/adapters/binance/src/futures/execution.rs:2557
.params
.as_ref()
.and_then(|p| p.get_bool("close_position"))
.unwrap_or(false);
if close_position {
let order_type = order.order_type();
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,View on GitHub (pinned to a4b06ed870)
Solutions
- Set reduce_only=false when using close_position — the flag is redundant for a whole-position close
- Or keep reduce_only and drop close_position, sizing the order to the position manually
Example fix
// before — both flags set // order: reduce_only = true; params: close_position = true // after — close_position implies the reduce // order: reduce_only = false; params: close_position = true
Defensive patterns
Strategy: validation
Validate before calling
// Before submit_order()
let close_position = params.get_bool("close_position").unwrap_or(false);
if close_position {
assert!(!order.is_reduce_only(), "close_position cannot combine with reduce_only");
} Type guard
fn close_position_flags_valid(close_position: bool, reduce_only: bool) -> bool {
!(close_position && reduce_only)
} Try / catch
On this local rejection, rebuild the order with reduce_only=false (close_position already implies the reduce) and resubmit.
Prevention
- Do not apply blanket reduce-only flags to exit orders in risk wrappers
- Test flag combinations for exit orders before deployment
- Keep exit-order parameter sets in one reviewed location
When it happens
Trigger: SubmitOrder where params has close_position=true and the order was built with reduce_only=true.
Common situations: Risk-management wrappers that mark every exit order reduce-only; ported strategies stacking protective flags on close orders.
Related errors
- `close_position` is not supported for order type {order_type
- Binance only supports TrailingOffsetType::BasisPoints, recei
- price_match cannot be combined with post-only orders
- price_match is not supported for order type {order_type:?}
- Order type {order_type:?} requires a trigger price
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/424c46c76658129e.
Report an issue: GitHub.