ticksupply; rustdoc is hosted on docs.rs.
crates.io
Releases
docs.rs
API reference (rustdoc)
GitHub
Source & changelog
Install
Quick example
Features
- Async-first — every call returns a
Future; pairs with any Tokio runtime - Builder pattern — typed builders for every mutating endpoint with
.send().await? - Cheap to clone —
Clientwraps anArc, shares a connection pool, and isSend + Sync - Automatic retries — exponential backoff on transient errors and 5xx responses
- Auto-pagination —
.stream()returns a TokioStreamthat walks every page - Typed errors — match on
Error::NotFound,Error::RateLimited, etc.; every variant carries therequest_idfromX-Request-Id - Configurable transport — override timeout, retry count, base URL, or inject your own
reqwest::Clientfor proxies / telemetry - Optional types — Cargo features for
chrono(default),time, andrust_decimal - Fully documented —
#![warn(missing_docs)]is enforced; every public item has rustdoc on docs.rs
Configuration
Client::new() reads TICKSUPPLY_API_KEY from the environment. For more control, use the builder:
| Setting | Default | Builder method |
|---|---|---|
| API key | $TICKSUPPLY_API_KEY (required) | .api_key(...) |
| Base URL | https://api.ticksupply.com/v1 | .base_url(...) |
| Timeout | 30 s | .timeout(...) |
| Max retries | 3 | .max_retries(...) |
| User-Agent | ticksupply-rust/<version> | .user_agent(...) |
| HTTP client | internal reqwest::Client | .http_client(...) |
Wire types
The API uses string-encoded primitives to preserve precision across implementations. The crate exposes them as small wrapper types that hold the raw wire form losslessly and convert on demand:| Type | Wire form | Typed accessors |
|---|---|---|
Nanos | i64 nanoseconds, JSON string | .as_i64(); .to_chrono() / .to_time() (under feature) |
Timestamp | RFC 3339 string | .as_str(); .to_chrono() / .to_time() → Result<...> |
Decimal | decimal string | .as_str(); .to_f64() (lossy); .to_decimal() (lossless) |
Nanos carries market-data timestamps (preserves nanosecond precision — f64 would silently round). Timestamp carries control-plane timestamps (creation times, activity spans) and round-trips any RFC 3339 variant the server sends. Decimal carries amounts where float precision matters (currently BillingUsage::export_gb_total).
IntoTimestamp — i64, &str, String, Nanos, plus chrono::DateTime<Utc> (default feature) or time::OffsetDateTime (under time). So you can pass whatever your call site already uses:
Cargo features
Optional types are gated behind Cargo features so you only pay for what you use:| Feature | Default | Effect |
|---|---|---|
chrono | yes | IntoTimestamp accepts chrono::DateTime<Utc>; Timestamp deserializes into one |
time | no | Same, but for time::OffsetDateTime |
rust_decimal | no | Decimal wire values parse losslessly into rust_decimal::Decimal |
i64 nanoseconds (Nanos) and string timestamps:
Versioning & releases
The crate follows SemVer. Pin to a minor range ("0.1") to receive bug fixes; major bumps (0.2, 1.0) may include breaking API changes documented in CHANGELOG.md. Every published version has its own rustdoc snapshot at https://docs.rs/ticksupply/<version>.
Requirements
- Rust 1.75 or newer (edition 2021)
- A Tokio-compatible async runtime
rustlsfor TLS (no system OpenSSL dependency)