nautechsystems/nautilus_trader · error

{e}

Error message

{e}

What it means

The get_last_trades_by_instrument_and_time HTTP call returned Err; request_trades converts the adapter's typed error into anyhow via anyhow::anyhow!(e). This wraps any transport/HTTP/JSON-RPC failure of the trades-by-time endpoint, e.g. rate limiting, bad instrument, or connection issues.

Source

Thrown at crates/adapters/deribit/src/http/client.rs:1288

        let end_ms = end_dt.as_millisecond();
        let ts_init = self.generate_ts_init();
        let mut all_trades = Vec::new();
        let mut paginator = TradePaginator::new(start_ms, end_ms);

        loop {
            let params = GetLastTradesByInstrumentAndTimeParams::new(
                instrument_id.symbol.to_string(),
                paginator.cursor,
                end_ms,
                Some(DERIBIT_HISTORICAL_TRADES_MAX_COUNT),
                Some("asc".to_string()),
            );

            let full_response = self
                .inner
                .get_last_trades_by_instrument_and_time(params)
                .await
                .map_err(|e| anyhow::anyhow!(e))?;

            let response_data = full_response
                .result
                .ok_or_else(|| anyhow::anyhow!("No result in response"))?;

            let ids: Vec<String> = response_data
                .trades
                .iter()
                .map(|t| t.trade_id.clone())
                .collect();
            let timestamps: Vec<i64> = response_data.trades.iter().map(|t| t.timestamp).collect();

            let Some(new_indices) = paginator.advance(&ids, &timestamps, response_data.has_more)
            else {
                break;
            };

            for i in &new_indices {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Log/format the wrapped error to see the underlying Deribit error code and message.
  2. Fix the instrument name passed to request_trades (validate via /public/get_instruments).
  3. Add backoff/rate limiting between paginated trades requests.
  4. Check network/proxy connectivity and that the client targets the right base URL (prod vs testnet).

Example fix

// before
.map_err(|e| anyhow::anyhow!(e))?;
// after
.map_err(|e| anyhow::anyhow!("get_last_trades_by_instrument_and_time({params.instrument_name}): {e}"))?;
Defensive patterns

Strategy: retry

Validate before calling

// validate symbol first
let names: Vec<_> = client.request_instruments(currency, None).await?
    .into_iter().map(|i| i.id.to_string()).collect();
debug_assert!(names.contains(&instrument_name));

Try / catch

for delay in [1s, 5s, 30s] {
    match client.request_trades(id, start, end, None).await {
        Ok(t) => break t,
        Err(e) if is_rate_limited(&e) => { tokio::time::sleep(delay).await; }
        Err(e) => return Err(e),
    }
}

Prevention

When it happens

Trigger: request_trades with an unknown instrument name (Deribit error 11029), too-frequent polling (rate limit 10003), network failure, or HTTP non-200/JSON-RPC error from Deribit.

Common situations: Backfill loops hammering the endpoint and hitting Deribit rate limits; typo'd instrument symbols; testnet/prod endpoint mismatch; expired credentials when using authed endpoints.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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