Skip to main content

Python SDK for the 3kk0 unified streaming API

Project description

kk0 SDK

A minimal Python client for the 3kk0 unified WebSocket stream.

Quickstart

from kk0 import Stream
import asyncio

async def main():
    async with Stream("wss://api.3kk0.com/stream") as s:
        await s.subscribe(
            channels=["trades"],
            symbols=["SOL/USDT"],
            exchanges=["binance"],
        )
        async for event in s:
            print(event)

asyncio.run(main())

The broker exposes a single /stream websocket: send a subscribe payload with the filters you care about, and the iterator yields every normalized trade, orderbook, heartbeat, or raw message that matches. Include raw=True in the subscribe call to flow through the raw-connector payload (events arrive with type == "raw" and a payload that mirrors the upstream exchange data). Adjust depth and other filters as needed for your workload.

Unified stream schema

Each event received over /stream follows the dataclasses defined in engine/schemas.py. Trade frames (e.g., type == "trade") always include exchange, symbol, ts_event, ts_exchange, price, size, side, and the optional metadata listed there; order book frames carry bids, asks, update_type, depth, sequence, and the derived helpers documented in the same file. Heartbeats carry info, and enabling raw=True adds type == "raw" messages whose payload is built in apps/broker/unified.py to mirror the upstream connector data.

Every exchange connector referenced by the broker (for example engine/connectors/binance.py, engine/connectors/bybit.py, and engine/connectors/hyperliquid.py) normalizes its native JSON into these fields before the broker fans them to clients. Because the SDK simply deserializes whatever JSON the broker sends (Stream.__anext__ just json.loads(...)), you always see the same normalized keys regardless of the exchange you subscribe to.

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

kk0-0.1.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

kk0-0.1.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file kk0-0.1.4.tar.gz.

File metadata

  • Download URL: kk0-0.1.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for kk0-0.1.4.tar.gz
Algorithm Hash digest
SHA256 17bb2b033f01b49f1e2e1445650f9d5900b35030e81741dcc57467229be6892e
MD5 6bb8feec835a1897aa06fb9e228513ad
BLAKE2b-256 c1651fa61cf28ee1700747a9e9bbdce4952b85cc8fef09d6237fa73b7a37d1e3

See more details on using hashes here.

File details

Details for the file kk0-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: kk0-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for kk0-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 90f2ee2cf3acbff1c879a7538d2c92774cefe65b4d72c124b12b022ac62bf8a3
MD5 791e1ee9d7ccd4f54a1eb0c3e1ab7862
BLAKE2b-256 00ee745fef9dbbbbd39c86e7d0861902512135e13331888fec2120c2d65a1be2

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