Skip to main content

Rust SDK

Strongly-typed async client for low-latency consumers.

▸ Full reference: rust.datamaxiplus.com ▸ Crate: crates.io/crates/datamaxi

Install

Add the crate to Cargo.toml. Pin to the latest published version.

[dependencies]
datamaxi = "*"
tokio = { version = "1", features = ["full"] }

The client is async and expects a Tokio runtime.

Auth

The client reads DTMX_API_KEY from the environment, or accepts an explicit key in the constructor.

export DTMX_API_KEY="your_api_key_here"

First call

use datamaxi::Datamaxi;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Datamaxi::new(std::env::var("DTMX_API_KEY")?);

let candles = client
.cex()
.candle("binance", "BTC-USDT", "1h")
.await?;

println!("{:#?}", candles);
Ok(())
}

Exact module path (datamaxi::Datamaxi vs datamaxi::client::Client) and the method-chaining surface (.cex().candle(...)) may differ in the published crate. Verify against rust.datamaxiplus.com for your installed version. The endpoint coverage and the symbol format (BASE-QUOTE) are stable across SDKs.

WebSocket streaming

Streams are exposed as Stream-impl types you can poll inside any async task:

// pseudo-shape, see rust.datamaxiplus.com for exact API
let mut stream = client.ws().funding_rate(&["BTC-USDT@binance"]).await?;
while let Some(msg) = stream.next().await {
println!("{:?}", msg?);
}

Next steps