Skip to main content

Python SDK for the mmflow market-data API — REST, SSE streams, and a typed WebSocket client.

Project description

mmflow — Python SDK

Typed Python client for the mmflow market-data API: REST endpoints, SSE streams, and a real-time WebSocket client. The REST + SSE surface is standard-library only; the WebSocket client needs the ws extra.

pip install mmflow-sdk          # REST + SSE (zero dependencies)
pip install "mmflow-sdk[ws]"    # adds MmflowSocket (websockets)

The package name is mmflow-sdk; the import name remains mmflow.

REST + candles

from mmflow import MmflowClient

mm = MmflowClient()

# OHLCV history (normalized to {time, open, high, low, close, volume})
for c in mm.candles("BTC", interval="1m", hours=24):
    print(c["time"], c["close"])

# Cross-venue open interest / funding / liquidations / whales
oi = mm.perps_oi(coins=["BTC", "ETH"], venues=["hl", "binance"])
for row in oi.data:
    print(row["coin"], row.get("oiUsd"))

# Anything else under /api/v1:
resp = mm.get("/quant/density", {"coin": "BTC"})

SSE streams

for ev in mm.stream_trades("BTC"):
    if ev.type == "trade":
        print(ev.data["price"], ev.data["size"])
    elif ev.type == "bye":
        break

Real-time WebSocket

import asyncio
from mmflow import MmflowSocket

async def main():
    sock = MmflowSocket(api_key="YOUR_KEY")
    sock.subscribe("trades", "BTC", lambda payload, meta: print(meta["channel"], payload))
    sock.subscribe("orderbook", "ETH", lambda payload, meta: print(payload))
    await sock.run()      # auto-reconnects; runs until close()

asyncio.run(main())

Channels: trades, orderbook, candles, liquidations, funding, openInterest, markPrice, footprint. Auth, exponential-backoff reconnect, and subscription replay are built in.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mmflow_sdk-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmflow_sdk-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file mmflow_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: mmflow_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for mmflow_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 76c21e7188c6590f50102f8c29cc336680c07616dd0dfd1f53b7e20b28908baa
MD5 16b1013444c255bf7e749b41b839a4f7
BLAKE2b-256 b32744c38042ac1d1f1194afe143ce0a94bcd42f9a861ddc6e24c7b868e955e6

See more details on using hashes here.

File details

Details for the file mmflow_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mmflow_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for mmflow_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e35a4b3313b943d9161860fb2e81907bd834b10f91a797d4777c3b14c49c33e
MD5 50854a106a9cfc06b5cba78feaba84e1
BLAKE2b-256 ab325a64c2648fe95c318a0ae7f2cf243d03fffa0e5dbb5946b654e059785e48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page