{"record":{"id":"51e1af0e0ffc9068","repo":"nautechsystems/nautilus_trader","slug":"e-51e1af","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/http/client.rs","lineNumber":1288,"sourceCode":"        let end_ms = end_dt.as_millisecond();\n        let ts_init = self.generate_ts_init();\n        let mut all_trades = Vec::new();\n        let mut paginator = TradePaginator::new(start_ms, end_ms);\n\n        loop {\n            let params = GetLastTradesByInstrumentAndTimeParams::new(\n                instrument_id.symbol.to_string(),\n                paginator.cursor,\n                end_ms,\n                Some(DERIBIT_HISTORICAL_TRADES_MAX_COUNT),\n                Some(\"asc\".to_string()),\n            );\n\n            let full_response = self\n                .inner\n                .get_last_trades_by_instrument_and_time(params)\n                .await\n                .map_err(|e| anyhow::anyhow!(e))?;\n\n            let response_data = full_response\n                .result\n                .ok_or_else(|| anyhow::anyhow!(\"No result in response\"))?;\n\n            let ids: Vec<String> = response_data\n                .trades\n                .iter()\n                .map(|t| t.trade_id.clone())\n                .collect();\n            let timestamps: Vec<i64> = response_data.trades.iter().map(|t| t.timestamp).collect();\n\n            let Some(new_indices) = paginator.advance(&ids, &timestamps, response_data.has_more)\n            else {\n                break;\n            };\n\n            for i in &new_indices {","sourceCodeStart":1270,"sourceCodeEnd":1306,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/http/client.rs#L1270-L1306","documentation":"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.","triggerScenarios":"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.","commonSituations":"Backfill loops hammering the endpoint and hitting Deribit rate limits; typo'd instrument symbols; testnet/prod endpoint mismatch; expired credentials when using authed endpoints.","solutions":["Log/format the wrapped error to see the underlying Deribit error code and message.","Fix the instrument name passed to request_trades (validate via /public/get_instruments).","Add backoff/rate limiting between paginated trades requests.","Check network/proxy connectivity and that the client targets the right base URL (prod vs testnet)."],"exampleFix":"// before\n.map_err(|e| anyhow::anyhow!(e))?;\n// after\n.map_err(|e| anyhow::anyhow!(\"get_last_trades_by_instrument_and_time({params.instrument_name}): {e}\"))?;","handlingStrategy":"retry","validationCode":"// validate symbol first\nlet names: Vec<_> = client.request_instruments(currency, None).await?\n    .into_iter().map(|i| i.id.to_string()).collect();\ndebug_assert!(names.contains(&instrument_name));","typeGuard":null,"tryCatchPattern":"for delay in [1s, 5s, 30s] {\n    match client.request_trades(id, start, end, None).await {\n        Ok(t) => break t,\n        Err(e) if is_rate_limited(&e) => { tokio::time::sleep(delay).await; }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Apply exponential backoff on Deribit rate-limit errors during backfill","Log the wrapped error's full message — it carries the Deribit error code","Validate instrument names before paginating","Keep requests under Deribit's public-endpoint rate limits (credit-based)"],"tags":["deribit","http","network","api-error"],"backgroundTag":"http-request-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}