{"record":{"id":"4149613f879d5391","repo":"nautechsystems/nautilus_trader","slug":"reduce-only-orders-are-not-supported-by-coinbase-a","errorCode":null,"errorMessage":"Reduce-only orders are not supported by Coinbase Advanced Trade","messagePattern":"Reduce-only orders are not supported by Coinbase Advanced Trade","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/http/client.rs","lineNumber":1604,"sourceCode":"/// Coinbase (e.g. STOP_MARKET, IOC LIMIT, missing required field).\n#[allow(clippy::too_many_arguments)]\npub fn build_order_configuration(\n    order_type: OrderType,\n    side: OrderSide,\n    quantity: Quantity,\n    price: Option<Price>,\n    trigger_price: Option<Price>,\n    time_in_force: TimeInForce,\n    expire_time: Option<UnixNanos>,\n    post_only: bool,\n    is_quote_quantity: bool,\n    reduce_only: bool,\n) -> anyhow::Result<OrderConfiguration> {\n    let qty = quantity.as_decimal();\n    let price = price.map(|p| p.as_decimal());\n    let trigger = trigger_price.map(|p| p.as_decimal());\n\n    anyhow::ensure!(\n        !reduce_only,\n        \"Reduce-only orders are not supported by Coinbase Advanced Trade\"\n    );\n\n    match order_type {\n        OrderType::Market => {\n            // Coinbase exposes `market_market_ioc` and `market_market_fok` for\n            // MARKET orders. Nautilus' default GTC is mapped to IOC (mirroring\n            // the Bybit adapter pattern); explicit IOC and FOK are honored;\n            // DAY / GTD are rejected.\n            //\n            // Note: a MARKET order built with TIF=GTC will execute as IOC at\n            // Coinbase. Backtest replays of the same order through the\n            // matching engine treat it differently. Strategies that need\n            // strict backtest/live parity should construct MarketOrders with\n            // TIF=IOC or TIF=FOK explicitly.\n            let params = if is_quote_quantity {\n                MarketParams {","sourceCodeStart":1586,"sourceCodeEnd":1622,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/http/client.rs#L1586-L1622","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Set reduce_only=false and size closing orders explicitly from the open position.","Implement reduce-only behavior at the strategy layer (derive quantity from current position, skip when flat).","Route reduce-only orders to a venue that supports the flag instead of Coinbase.","Handle the error at submission time and fall back to a normal order with position-derived quantity."],"exampleFix":"// before\nlet request = SubmitOrderRequest::new(..., reduce_only=true, ...);\n// after: Coinbase path derives closing quantity from position instead\nlet reduce_only = false;\nlet qty = Quantity::from(open_position_qty.min(requested_qty));\nlet request = SubmitOrderRequest::new(..., qty, reduce_only, ...);","handlingStrategy":"validation","validationCode":"if order.reduce_only {\n    // Coinbase Advanced Trade has no reduce-only flag\n    order.reduce_only = false;\n    order.quantity = Quantity::from(open_position_qty.min(order.quantity));\n}","typeGuard":null,"tryCatchPattern":"match build_order_configuration(order_type, side, qty, price, trigger, tif, expire, post_only, is_quote, reduce_only) {\n    Ok(config) => submit(config),\n    Err(e) if e.to_string().contains(\"Reduce-only\") => submit(build_non_reduce_only_fallback(&position, &order)?),\n    Err(e) => return Err(e),\n}","preventionTips":["Never set reduce_only when targeting the Coinbase adapter.","Derive exit quantities from the current position to emulate reduce-only.","Audit strategy configs ported from other venues for venue-specific flags.","Document venue capability differences in strategy code."],"tags":["coinbase","orders","unsupported-feature","reduce-only"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}