nautechsystems/nautilus_trader · error · anyhow::Error

Cancel all algo orders failed

Error message

Cancel all algo orders failed: {}

What it means

Same pattern as cancel-all-orders but for algo (conditional) orders: the endpoint must return code 200, otherwise the adapter bails with the exchange message. Indicates the bulk cancel of all open algo orders for a symbol was rejected.

Solutions

  1. Inspect the msg and treat 'no open algo orders' as success/no-op
  2. Verify symbol matches the account type (USDT-M vs COIN-M)
  3. Confirm API key futures permissions
  4. Retry on transient network/rate-limit errors

Example fix

// before
client.cancel_all_algo_orders(instrument_id)?;
// after
if let Err(e) = client.cancel_all_algo_orders(instrument_id) {
    if !e.to_string().to_lowercase().contains("no open") { return Err(e); }
}
Defensive patterns

Strategy: try-catch

Validate before calling

let open_algos = client.list_open_algo_orders(symbol)?;
if open_algos.is_empty() { return Ok(()); }

Try / catch

match client.cancel_all_algo_orders(instrument_id) { Err(e) if is_no_open_algos(&e) => Ok(()), Err(e) => Err(e), _ => Ok(()) }

Prevention

When it happens

Trigger: Calling cancel_all_algo_orders for a symbol with no active algo orders, wrong symbol, insufficient permissions, or an exchange-side rejection.

Common situations: Defensive bulk cancel when nothing is pending; symbol/venue mismatch; futures API key restrictions.

Related errors


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

Appendix: source

Thrown at crates/adapters/binance/src/futures/http/client.rs:2563

    /// Cancels all open algo orders for a symbol.
    ///
    /// # Errors
    ///
    /// Returns an error if the request fails.
    pub async fn cancel_all_algo_orders(&self, instrument_id: InstrumentId) -> anyhow::Result<()> {
        let symbol = format_binance_symbol(&instrument_id);

        let params = BinanceCancelAllAlgoOrdersParams {
            symbol,
            recv_window: None,
        };

        let response = self.inner.cancel_all_algo_orders(&params).await?;
        if response.code == 200 {
            Ok(())
        } else {
            anyhow::bail!("Cancel all algo orders failed: {}", response.msg);
        }
    }

    /// Cancels multiple orders in a single request (up to 10 orders).
    ///
    /// Each cancel in the batch is processed independently. The response contains
    /// the result for each cancel, which can be either a success or an error.
    ///
    /// # Errors
    ///
    /// Returns an error if the batch exceeds 10 orders or the request fails.
    pub async fn batch_cancel_orders(
        &self,
        cancels: &[BatchCancelItem],
    ) -> BinanceFuturesHttpResult<Vec<BatchOrderResult>> {
        self.inner.batch_cancel_orders(cancels).await
    }

View on GitHub (pinned to 18893faf8b)