Skip to main content

Python SDK

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"

Get a key from your account page.

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.

Next steps