nautechsystems/nautilus_trader · error · anyhow::Error

Reduce-only orders are not supported by Coinbase Advanced Tr

Error message

Reduce-only orders are not supported by Coinbase Advanced Trade

What it means

This error is raised by `build_order_configuration` when an order is submitted with `reduce_only = true`. Coinbase Advanced Trade's order API has no reduce-only flag, so the adapter refuses to build an `OrderConfiguration` for reduce-only requests instead of silently ignoring the flag. This guarantees position-reducing semantics are not silently lost when porting strategies from exchanges that support reduce-only.

Source

Thrown at crates/adapters/coinbase/src/http/client.rs:1604

/// Coinbase (e.g. STOP_MARKET, IOC LIMIT, missing required field).
#[allow(clippy::too_many_arguments)]
pub fn build_order_configuration(
    order_type: OrderType,
    side: OrderSide,
    quantity: Quantity,
    price: Option<Price>,
    trigger_price: Option<Price>,
    time_in_force: TimeInForce,
    expire_time: Option<UnixNanos>,
    post_only: bool,
    is_quote_quantity: bool,
    reduce_only: bool,
) -> anyhow::Result<OrderConfiguration> {
    let qty = quantity.as_decimal();
    let price = price.map(|p| p.as_decimal());
    let trigger = trigger_price.map(|p| p.as_decimal());

    anyhow::ensure!(
        !reduce_only,
        "Reduce-only orders are not supported by Coinbase Advanced Trade"
    );

    match order_type {
        OrderType::Market => {
            // Coinbase exposes `market_market_ioc` and `market_market_fok` for
            // MARKET orders. Nautilus' default GTC is mapped to IOC (mirroring
            // the Bybit adapter pattern); explicit IOC and FOK are honored;
            // DAY / GTD are rejected.
            //
            // Note: a MARKET order built with TIF=GTC will execute as IOC at
            // Coinbase. Backtest replays of the same order through the
            // matching engine treat it differently. Strategies that need
            // strict backtest/live parity should construct MarketOrders with
            // TIF=IOC or TIF=FOK explicitly.
            let params = if is_quote_quantity {
                MarketParams {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set reduce_only=false and size closing orders explicitly from the open position.
  2. Implement reduce-only behavior at the strategy layer (derive quantity from current position, skip when flat).
  3. Route reduce-only orders to a venue that supports the flag instead of Coinbase.
  4. Handle the error at submission time and fall back to a normal order with position-derived quantity.

Example fix

// before
let request = SubmitOrderRequest::new(..., reduce_only=true, ...);
// after: Coinbase path derives closing quantity from position instead
let reduce_only = false;
let qty = Quantity::from(open_position_qty.min(requested_qty));
let request = SubmitOrderRequest::new(..., qty, reduce_only, ...);
Defensive patterns

Strategy: validation

Validate before calling

if order.reduce_only {
    // Coinbase Advanced Trade has no reduce-only flag
    order.reduce_only = false;
    order.quantity = Quantity::from(open_position_qty.min(order.quantity));
}

Try / catch

match build_order_configuration(order_type, side, qty, price, trigger, tif, expire, post_only, is_quote, reduce_only) {
    Ok(config) => submit(config),
    Err(e) if e.to_string().contains("Reduce-only") => submit(build_non_reduce_only_fallback(&position, &order)?),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Submitting any order (submit order request) with reduce_only set to true — e.g. a strategy using reduce-only exits ported from Binance/Bybit/OKX — when routed to the Coinbase Advanced Trade adapter via `build_order_configuration`.

Common situations: Cross-venue strategies that set reduce_only on exit orders; configuration templates copied from another exchange adapter; risk overlays that automatically mark closing orders reduce-only.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/4149613f879d5391. Report an issue: GitHub.