{"record":{"id":"a0a6f776f653ec0c","repo":"nautechsystems/nautilus_trader","slug":"ax-does-not-support-reduce-only-orders","errorCode":null,"errorMessage":"AX does not support reduce-only orders","messagePattern":"AX does not support reduce-only orders","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":1919,"sourceCode":"\n    Ok(())\n}\n\nfn validate_order_init_instructions(order_init: &OrderInitialized) -> anyhow::Result<()> {\n    validate_order_instructions(\n        order_init.reduce_only,\n        order_init.quote_quantity,\n        order_init.display_qty.is_some(),\n    )\n}\n\nfn validate_order_instructions(\n    reduce_only: bool,\n    quote_quantity: bool,\n    has_display_qty: bool,\n) -> anyhow::Result<()> {\n    if reduce_only {\n        anyhow::bail!(\"AX does not support reduce-only orders\");\n    }\n\n    if quote_quantity {\n        anyhow::bail!(\n            \"Architect AX adapter cannot encode quote_quantity; submit a base quantity instead\"\n        );\n    }\n\n    if has_display_qty {\n        anyhow::bail!(\"Architect AX adapter cannot encode display_qty iceberg instructions\");\n    }\n\n    Ok(())\n}\n\n// The AX HTTP API documents only a bare 400 with no error schema, so no venue\n// failure can be allowlisted as an unambiguous rejection; those arrive via the\n// orders WS `Rejected` and `CancelRejected` events instead. AX therefore never","sourceCodeStart":1901,"sourceCodeEnd":1937,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/architect_ax/src/execution.rs#L1901-L1937","documentation":"validate_order_instructions bails immediately when the order carries reduce_only=true: AX's order encoding has no reduce-only flag, so the instruction cannot be represented. It is checked both at submit validation (from the live order) and at order-init validation (OrderInitialized event), so reduce-only orders are denied before submission and never reach the venue. The adapter intentionally fails loudly instead of silently dropping the semantics, which would risk over-closing or flipping positions.","triggerScenarios":"factory.market/limit(...).reduce_only(true); strategies with 'close position' helpers that set reduce_only to avoid over-filling; ported code from futures venues (Binance, Bybit) where reduce-only is native.","commonSituations":"Position-management code written for CEX futures adapters; risk frameworks that always flag exit orders as reduce-only.","solutions":["Submit the exit order with reduce_only unset (false) and size it exactly to the open position","Track netting positions yourself (AX is Netting/Margin in this adapter) and only send the delta you intend","Add a pre-submit assertion so reduce-only never reaches the AX client"],"exampleFix":"// before\nlet exit = factory.market(id, opposite_side, qty)\n    .reduce_only(true); // -> AX does not support reduce-only orders\n// after\nlet exit = factory.market(id, opposite_side, position_qty_open);\n// exact size, no flag","handlingStrategy":"validation","validationCode":"fn ax_instructions_ok(reduce_only: bool, quote_qty: bool, display_qty: bool) -> bool {\n    !reduce_only && !quote_qty && !display_qty\n}\ndebug_assert!(ax_instructions_ok(\n    order.is_reduce_only(),\n    order.is_quote_quantity(),\n    order.display_qty().is_some(),\n));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a venue-capability table in your strategy layer (reduce_only=false for AX)","Size exits to the exact open position instead of relying on reduce-only semantics","Write a pre-submit lint that scans outgoing orders for reduce_only/quote_quantity/display_qty on AX instruments"],"tags":["architect-ax","order-validation","reduce-only","position-management","rust"],"backgroundTag":"reduce-only-not-supported","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}