Bitculator Data API — Rust SDK
bitculator.com · API documentation · Get an API key
crates.io — bitculator · docs.rs · GitHub
The official Rust SDK for the Bitculator Data API.
Blocking reqwest + serde, generic typed responses, Rust 2021.
Keep your API key server-side. It is a Bearer token with the
data-apiability and is not meant for client-side embedding.
Install
[]
= "1"
= "1" # for the generic Value type used below
Quick start
use ;
use Value;
Prices are decimal strings
Prices, rates, and supplies come back as strings (e.g. "63520.780763913")
to preserve full precision. Decode them into a String (or a big-decimal type) —
never an f64, which silently loses precision.
Parameters
Query parameters are built fluently; keys mirror the API's names (snake_case):
let params = new
.set
.set
.set; // slices become CSV
Pagination
Paginated methods return Page<T>. Read one page, or auto-paginate:
// One page at a time.
let mut page: = client.exchanges.list?;
loop
// Or auto-paginate across every page (each item is a Result).
let page: = client.coins.list?;
for item in page.auto_paging
Errors
Everything returns Result<T, bitculator::Error>. HTTP failures are
Error::Api(ApiError) carrying the { error: { code, message, details } } envelope.
match client.coins.
ApiError predicates: is_auth (401) · is_permission (403) · is_not_found (404) ·
is_validation (422) · is_rate_limited (429) · is_server (5xx). Transport
failures are Error::Timeout and Error::Connection.
Quota
Every response carries X-Quota-* headers, surfaced on the client after each call:
client.coins.?;
let q = client.quota; // Option<Quota> { limit, remaining, reset, raw }
Configuration
let client = builder
.base_url // default
.timeout // default
.max_retries // auto-retry 429/5xx/network; 0 to disable
.build;
Using from async code
The client is blocking. Inside an async runtime (tokio, async-std), reqwest's blocking client panics if called directly — hand the call to a blocking thread instead:
let client = new; // Clone is cheap; move a clone in
let btc: Value = spawn_blocking
.await??;
(With async-std, use async_std::task::spawn_blocking the same way.)
Resources
coins · prices · markets · exchanges · wallets · global_market ·
sentiment · indicators · liquidations · conversion · calculators ·
editorial · alarms · webhooks · meta
Full endpoint reference: https://bitculator.com/en/documentation/api/v1.
License
MIT