SDKs
First-party clients for the DataMaxi+ API. They wrap the same REST and WebSocket endpoints documented in the API reference and use the same API key and prepaid balance. New endpoints may reach the raw API before an SDK release; you can always call them directly over HTTP.
| Language | Package | Full reference |
|---|---|---|
| Python | datamaxi (PyPI) | python.datamaxiplus.com |
| Rust | Bisonai/datamaxi-rust (git) | rust.datamaxiplus.com |
| TypeScript | Not published yet | See TypeScript |
Using an AI agent instead of code? Connect the MCP server: every REST endpoint is available as a tool.
Per-language deep dives (full method reference, type definitions, async/await patterns) live on the dedicated subdomains. The sections below give you enough to install, authenticate, and make a first call without bouncing.
Choosing an SDK
- Python — analysis, research notebooks, trading bots, anything that touches pandas/NumPy. Default choice for most users.
- Rust — low-latency systems, market-makers, anything where allocation and GC matter. Strongly-typed end to end.
- TypeScript — no package yet; call the REST API with
fetch(see TypeScript).
Common patterns
All SDKs follow the same conventions; the language idioms differ but the moving parts don't.
-
API key via env var. Set
DTMX_API_KEYonce and the client picks it up. Constructor-arg auth also works for multi-tenant code. -
Rate-limit handling. SDKs surface HTTP 429 as a typed error with retry-after metadata. Apply your own backoff or use the built-in retry helpers. See REST API › Limits. An HTTP
402means your prepaid balance is empty or expired — top up instead of retrying; see Pricing and billing. -
Pagination. Most list/history endpoints return a tuple of
(page, next_fn)(Python/TS) or(page, cursor)(Rust). Call the next function/cursor to fetch the following page; receiveNone/nullwhen exhausted. -
Errors. All client errors map to a single SDK exception type with the upstream HTTP status, error code, and message preserved. See Errors.
-
Streaming. WebSocket subscriptions are exposed as iterators / async iterators /
Streamimpls — same payload shape as the raw WS API.
Python
Primary client for DataMaxi+. Covers every REST endpoint and every WebSocket stream.
- Full reference: python.datamaxiplus.com
- Source: github.com/Bisonai/datamaxi-python
- Package: pypi.org/project/datamaxi
Install
Requires Python 3.8+.
pip install datamaxi
Auth
The client reads DTMX_API_KEY from the environment, or accepts an explicit api_key= argument.
export DTMX_API_KEY="your_api_key_here"
Copy your key from My page → API keys (open).
First call
from datamaxi.datamaxi import Datamaxi
maxi = Datamaxi(api_key="YOUR_API_KEY") # or omit to read DTMX_API_KEY
candle, get_next = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1h",
)
print(candle[:3])
Symbol format is BASE-QUOTE (note the dash, not a slash). Call get_next() to paginate.
Async vs sync
The current public Python SDK exposes a synchronous client (Datamaxi). Method calls block on the network. For async workloads, wrap calls in asyncio.to_thread() or run the client in an executor.
The full async API surface, if/when it lands, will be documented at python.datamaxiplus.com. Treat the snippet above as the verified shape.
WebSocket streaming
WebSocket access is a separate sub-module. Minimal funding-rate subscription:
from datamaxi.websocket.funding_rate import FundingRateWebsocketClient
ws = FundingRateWebsocketClient(api_key="YOUR_API_KEY")
ws.subscribe(symbols=["BTC-USDT@binance"])
for msg in ws.recv():
print(msg) # {"f": 0.0001, "i": 8, "e": "binance", ...}
Class names and import paths for WebSocket clients can shift between SDK releases. Verify against python.datamaxiplus.com for your installed version. The payload shape (
f,i,e,s, ...) is stable and matches the raw WS API.
Rust
Strongly-typed async client for low-latency consumers.
- Full reference: rust.datamaxiplus.com
- Source: github.com/Bisonai/datamaxi-rust
Install
The crate is not on crates.io; add it from GitHub and pin a commit or tag for reproducible builds.
[dependencies]
datamaxi = { git = "https://github.com/Bisonai/datamaxi-rust" }
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::Datamaxivsdatamaxi::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?);
}
TypeScript
There is no published TypeScript package yet. The API is plain HTTPS + JSON, so fetch works in Node, Deno, Bun and Edge runtimes:
const res = await fetch(
"https://api.datamaxiplus.com/api/v1/funding-rate/latest?exchange=binance&symbol=BTC-USDT",
{ headers: { "X-DTMX-APIKEY": process.env.DTMX_API_KEY! } },
);
if (res.status === 402) throw new Error("Balance empty or expired: top up at https://datamaxiplus.com/dashboard/billing");
if (!res.ok) throw new Error(`DataMaxi+ ${res.status}: ${await res.text()}`);
console.log(await res.json());
Keep the key on the server
Run API calls wherever you can hold the key as a secret: a backend service, a serverless function, an Edge worker. Don't ship the key in a browser bundle: anyone who opens dev tools can read it and spend your balance. Proxy browser requests through your own backend, or fetch on the server (for example in React Server Components) and send the result to the client.
Next steps
- REST endpoints — full catalog
- WebSocket endpoints — streaming
- Pricing and billing
- Rate limits
- Errors