{"record":{"id":"9da6c99cb520c86c","repo":"nautechsystems/nautilus_trader","slug":"failed-to-preview-aggressive-limit-order-e","errorCode":null,"errorMessage":"Failed to preview aggressive limit order: {e}","messagePattern":"Failed to preview aggressive limit order: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":242,"sourceCode":"            {\n                let preview_result: anyhow::Result<Price> = async {\n                    let symbol = instrument_id.symbol.inner();\n                    let ax_side = AxOrderSide::try_from(order_side)\n                        .map_err(|e| anyhow::anyhow!(\"Invalid order side: {e}\"))?;\n                    let qty_contracts = quantity_to_contracts(quantity)?;\n\n                    let instrument = http_client.get_instrument(&symbol).ok_or_else(|| {\n                        anyhow::anyhow!(\"Instrument {instrument_id} not found in cache\")\n                    })?;\n\n                    let request =\n                        PreviewAggressiveLimitOrderRequest::new(symbol, qty_contracts, ax_side);\n                    let response = http_client\n                        .inner\n                        .preview_aggressive_limit_order(&request)\n                        .await\n                        .map_err(|e| {\n                            anyhow::anyhow!(\"Failed to preview aggressive limit order: {e}\")\n                        })?;\n\n                    if response.remaining_quantity > 0 {\n                        log::warn!(\n                            \"Market order book depth insufficient: \\\n                             filled_qty={} remaining_qty={} for {instrument_id}\",\n                            response.filled_quantity,\n                            response.remaining_quantity,\n                        );\n                    }\n\n                    let limit_price_decimal = response.limit_price.ok_or_else(|| {\n                        anyhow::anyhow!(\n                            \"No liquidity available for market order on {instrument_id}\"\n                        )\n                    })?;\n\n                    let price =","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/architect_ax/src/execution.rs#L224-L260","documentation":"AX has no native market order type; the adapter emulates it by first calling preview_aggressive_limit_order to obtain the take-through price, then submitting an aggressive IOC limit at that price. This error means the preview REST call itself failed; the {e} carries the AxHttpError (network error, 4xx/5xx from the venue, auth token expiry, rate limit). The market order is never submitted.","triggerScenarios":"submit_order(OrderType::Market) when the AX REST endpoint errors on preview: transient network drop, 429 rate limit, expired bearer token mid-session, venue 5xx, or malformed preview request (symbol/quantity rejected).","commonSituations":"Burst of market orders hitting the REST quota; long-running session whose token expired and re-auth raced the preview; venue maintenance window; flaky egress while preview-only traffic is fine on the orders socket.","solutions":["Inspect the wrapped AxHttpError: 429 -> throttle market-order frequency; 401 -> token refresh issue; network -> check egress","Retry the market order after a short backoff (preview failures are often transient); the adapter does not auto-retry the preview","If the error persists, submit an aggressive LIMIT order priced from your own book view instead of relying on emulation","Check the Architect status page/API for ongoing degradation"],"exampleFix":"// before\nself.submit_order(&market_order); // one-shot, preview failure loses the trade\n// after: retry emulation, else fall back to aggressive limit\nmatch self.submit_order(&market_order) {\n    Ok(_) => {}\n    Err(_) if attempt < MAX => { /* backoff, resubmit */ }\n    _ => self.submit_order(&aggressive_limit),\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Around order submission: classify preview failures as transient\nmatch result {\n    Err(err) if err.to_string().contains(\"Failed to preview\") => {\n        // transient REST failure: back off and resubmit once\n        tokio::time::sleep(Duration::from_millis(500)).await;\n        resubmit(order).await\n    }\n    other => other,\n}","preventionTips":["Rate-limit market-order bursts; the preview is one extra REST call per order and counts against quotas","Monitor AX REST 429/5xx rates; prefer LIMIT orders when REST health is degraded","Keep an aggressive-limit fallback path in the strategy for preview outages"],"tags":["architect-ax","market-order","preview","rest-api","rust"],"backgroundTag":"venue-request-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}