Skip to main content

Immix Python SDK

The Python SDK for the Immix API: REST, the market-data stream and the trading socket.

pip install immix_sdk

The package installs as immix_sdk and imports as immix. It needs Python 3.10 or newer. The API reference and guides are at docs.immix.xyz.

Use

from immix import Immix, MarketData
from immix.dataframe import to_frame  # needs pandas, which you install yourself
from immix.market_data import TradeEvent

# REST: there is no public REST environment yet, so the base URL is the one your onboarding gave you.
client = Immix(base_url="https://…", token=token)
me = client.users.get_me()

# A write mints its own Idempotency-Key when you name none, and an order is named by order_id.
client.orders.cancel(order_id="7185994167554")

# A list response as a DataFrame: money exact, timestamps UTC datetimes, enums by name.
orders = to_frame(client.orders.list())

# Market data: the public socket by default. The token goes in an `auth` message after
# connecting, never in the handshake. The stream reconnects and resubscribes by itself, and
# yields `Reconnected` where the gap is.
async def stream() -> None:
    async with MarketData(token=token) as md:
        await md.subscribe("trade.OKX@BTC/USDT")
        async for frame in md:
            ...
  • Money is a decimal string. immix.to_decimal and immix.format_decimal cross to and from Decimal exactly, and never through a float. A REST write's money parameters (qty, price, a policy's …_amount) take a Decimal or an int too, sent in plain notation (Decimal("1E-7") as "0.0000001"); a float is refused before anything is sent.
  • A write mints its own key. Every write takes an Idempotency-Key, and one is minted per call when you name none. The SDK's own retries resend it, so they cannot act twice. Name your own (immix.new_idempotency_key() mints one) when you may retry the write yourself, or retry under the key a failed write went out under: its exception carries it, as idempotency_key. An asyncio timeout is asyncio's exception, not the write's, so name the key when you bound a write's time. On orders.submit the key is the order's clientOrderId, so name either one.
  • An order is named by order_id, the platform's id on every order row: orders.get(order_id=…), orders.cancel(order_id=…). REST cannot cancel by client_order_id; the trading socket's cancel_order takes either.
  • Rows as DataFrames. immix.dataframe.to_frame takes a list response, one row, or rows. Money columns are exact Decimals (money="float" reads floats, for a plot), epoch-nanosecond columns are UTC datetimes, and enums are their names. pandas is not a dependency: pip install pandas.

Development

How this repository changes and how a version ships: DEVELOPING.md.

License

MIT. See LICENSE.

Metadata

Release files for immix-sdk 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for immix-sdk 0.4.0
File Size Uploaded
immix_sdk-0.4.0.tar.gz 269.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for immix-sdk 0.4.0
File Interpreter ABI Platform
immix_sdk-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 863.0 kB

Release files / immix_sdk-0.4.0.tar.gz

Download URL immix_sdk-0.4.0.tar.gz
Size 269.9 kB
Tags Source
SHA-256 checksum
How to use checksums
594c6a9fca4d0be8dd4fb272ff386919e2532365601527c418901cd61175e823
BLAKE2b-256 checksum
How to use checksums
282298f60d358beec688a23e5b95d124cd974fa83a25d49340ed4f1bf15d20ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / immix_sdk-0.4.0-py3-none-any.whl

Download URL immix_sdk-0.4.0-py3-none-any.whl
Size 593.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c178d2884e3635325740bbf776b4d58e3a81fd2d0821bcd0bb6c23d2d48c358f
BLAKE2b-256 checksum
How to use checksums
dec6dd03b1540c72a634388fd7bfe8c35611b6ad9ce9abad7163deb3c1cab7b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page