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.1.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.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmflow_sdk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4dbdf548c091fc4de95fbcd44189f601cc0ff8d004e4bc2f3b37e08d8b17f9c0
MD5 4c5868680ab04229e913416b266d81ba
BLAKE2b-256 8eb784c82e51d40567d2ba80ab052c10307a86a66a50abcb815e71a9980b2519

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmflow_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acac0563b44c8f164a705b79d4cdb3f40bce0988acedf5102877f1e1122e78d0
MD5 c49ba6116e33075192f98fcbe98c7ff0
BLAKE2b-256 bb8e99e427874fd36e0e927fb691ce9eb3641bb79b7cae0b1bedb50573c42c70

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