Skip to main content

Broker-neutral order-intent wire schema for a producer/consumer Redis-Streams transport

Project description

wire — a broker-neutral order-intent wire schema

wire

A tiny, broker-neutral order-intent wire schema for a producer/consumer transport (Redis Streams or anything else). A strategy process produces OrderIntents; an executor process consumes them and reports back with ResultEvents. wire is the vendor-free contract both sides agree on: pure stdlib dataclasses with explicit JSON (de)serialisation, no broker, transport, or networking imports.

Install

pip install dollarsmore-wire
# or
uv add dollarsmore-wire
from wire import OrderIntent, ResultEvent, IntentAction, OrderType

The distribution is dollarsmore-wire; the import package is wire.

What's in it

  • OrderIntent — an order command: OPEN / CLOSE / CANCEL, 1-4 IntentLegs, order type, price (positive-magnitude Decimal) with an explicit PriceEffect (DEBIT / CREDIT), time-in-force, correlation id, strategy tag.
  • OpenBracketIntent — an entry plus a pre-staged take-profit as one OTO bracket.
  • ResultEvent — the executor's reply: ACCEPTED / REJECTED / FILLED / CANCELLED / ERROR, broker order id, fill price, detail.
  • Enums: IntentAction, LegAction, OptionType, OrderType, PriceEffect, ResultStatus.

Every type round-trips through .to_wire() / .from_wire() plain dicts, so the transport only ever moves JSON.

Redis-Streams transport (wire.transport)

wire.transport is the shared Redis-Streams envelope both producer and consumer agree on — stream names (orders:intents / :results / :deadletter), the consumer group, and pure encode_* / decode_* helpers that wrap a wire object in a {kind, payload} dict. It has no redis import (stdlib + wire only); the caller drives its own redis client (client.xadd(INTENTS_STREAM, encode_bracket(intent))). Keeping it here stops producer and consumer drifting on the wire format.

Versioning

WIRE_VERSION is stamped into every serialised payload (the v field). Bump it on any breaking change to the wire shape so producer and consumer can detect a mismatch.

Design rules

  • Stdlib only — no third-party dependencies, ever.
  • Money is a positive-magnitude Decimal plus an explicit PriceEffect; never a signed float.
  • Times are ISO 8601 strings on the wire; enums travel by value.

Develop

uv sync
uv run pytest -q
uv run ruff check .

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

dollarsmore_wire-0.3.0.tar.gz (389.8 kB view details)

Uploaded Source

Built Distribution

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

dollarsmore_wire-0.3.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file dollarsmore_wire-0.3.0.tar.gz.

File metadata

  • Download URL: dollarsmore_wire-0.3.0.tar.gz
  • Upload date:
  • Size: 389.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dollarsmore_wire-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4a83c234d34be111c2164b41fab0da7c8dd1d22e3a2c8f12b76b7c75eed925ee
MD5 01396c38911b6b0414b2f97254ef58a4
BLAKE2b-256 fe668918653cbdc3c613bbbd05577990aa728b3269a3f4c5142cb35b2d7e0692

See more details on using hashes here.

File details

Details for the file dollarsmore_wire-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dollarsmore_wire-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dollarsmore_wire-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 705f21884d0978c96abc2520947dd26ce075069a56d5f622b6415b07c0c3cd5c
MD5 7c901f3edea2b8fc19456eb76de941f7
BLAKE2b-256 a09c4e8836e3eea7c67e63679b3ba0c88258a5a975aa41141b95aba41efcd3d3

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