nautechsystems/nautilus_trader · error

Coinbase Advanced Trade does not publish mark prices; cannot

Error message

Coinbase Advanced Trade does not publish mark prices; cannot subscribe for {} (cmd.instrument_id)

What it means

Coinbase Advanced Trade publishes no live mark price for its perpetuals on WebSocket or REST; the settlement_price field is the prior daily settlement and diverges from a live index. subscribe_mark_prices therefore rejects all mark-price subscriptions explicitly rather than returning misleading synthesized data.

Source

Thrown at crates/adapters/coinbase/src/data/mod.rs:607

        self.spawn_command(async move {
            if let Err(e) = ws
                .subscribe(CoinbaseWsChannel::MarketTrades, &[wire_id])
                .await
            {
                log::error!("Failed to subscribe to trades: {e:?}");
            }
        });

        Ok(())
    }

    fn subscribe_mark_prices(&mut self, cmd: SubscribeMarkPrices) -> anyhow::Result<()> {
        // Coinbase Advanced Trade does not publish a live mark price for its
        // perpetuals on either WS or REST. `settlement_price` is the prior
        // daily settlement and drifts from the live index, so synthesizing a
        // mark from it would be misleading. Reject explicitly so callers
        // failing this subscription know why.
        anyhow::bail!(
            "Coinbase Advanced Trade does not publish mark prices; \
             cannot subscribe for {}",
            cmd.instrument_id
        )
    }

    fn subscribe_index_prices(&mut self, cmd: SubscribeIndexPrices) -> anyhow::Result<()> {
        self.deriv_polls.subscribe_index(cmd.instrument_id);
        Ok(())
    }

    fn subscribe_funding_rates(&mut self, cmd: SubscribeFundingRates) -> anyhow::Result<()> {
        self.deriv_polls.subscribe_funding(cmd.instrument_id);
        Ok(())
    }

    fn subscribe_instrument_status(
        &mut self,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Do not subscribe to mark prices on Coinbase; compute marks from mid/last trade prices locally
  2. Disable mark-price subscriptions for this venue in your strategy/config
  3. If a mark is required, approximate it from the order book mid and document the drift risk
  4. File or track an upstream request for Coinbase to publish a live mark price

Example fix

// before
client.subscribe_mark_prices(mark_cmd)?; // always fails on Coinbase

// after
if client.is_coinbase() {
    // derive mark from book mid instead
    let mark = book.best_bid_price.midpoint(book.best_ask_price);
} else {
    client.subscribe_mark_prices(mark_cmd)?;
}
Defensive patterns

Strategy: fallback

Validate before calling

// skip mark-price subscriptions on Coinbase
let supports_marks = !matches!(venue, Venue::Coinbase(_));

Try / catch

match client.subscribe_mark_prices(cmd).await {
    Err(e) if e.to_string().contains("does not publish mark prices") => {
        // fall back to book-mid mark estimation
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling subscribe_mark_prices on the Coinbase execution/data client for any instrument_id, typically for CFM perpetual products.

Common situations: Running a funding/mark-price-dependent strategy on Coinbase perps after porting from Binance/Bybit; a generic risk module that subscribes to mark prices on every venue.

Related errors


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