Skip to main content

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, one or more 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.

from_wire is the contract boundary and refuses anything it cannot honour, always with a ValueError so a consumer can dead-letter on one exception type:

  • Money is a JSON string, never a JSON number. {"price": 1.60} would round through binary float and decode as 1.6000000000000000888..., which is what the broker would then be quoted. Strings only, finite, and unsigned (-0.00 is signed).
  • strike and quantity are JSON integers, not floats, strings or booleans: 2.9 must not silently become 2 contracts.
  • quantity sits in QUANTITY_FLOOR..QUANTITY_CEILING (1 to 99), both exported.
  • A LIMIT order carries both price and price_effect; a limit with no limit price is refused rather than passed on as the string "None".
  • v is an integer no greater than WIRE_VERSION.

to_wire enforces the money rule too, so a producer fails on its own bad value instead of learning about it as a dead-letter in another process.

Develop

uv sync
uv run pytest -q
uv run ruff check .
uv run mypy wire tests

Metadata

Release files for dollarsmore-wire 0.5.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 dollarsmore-wire 0.5.0
File Size Uploaded Provenance Actions
dollarsmore_wire-0.5.0.tar.gz 388.8 kB Without provenance Details for dollarsmore_wire-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dollarsmore-wire 0.5.0
File Interpreter ABI Platform Actions
dollarsmore_wire-0.5.0-py3-none-any.whl Python 3 none any Details for dollarsmore_wire-0.5.0-py3-none-any.whl

Total release size: 397.6 kB

Release files / dollarsmore_wire-0.5.0.tar.gz

Download URL dollarsmore_wire-0.5.0.tar.gz
Size 388.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8cab6ec0473245a2191b9a3214306efefbce979af263ad1dbe7656e7509659b1
BLAKE2b-256 checksum
How to use checksums
d22f4f8432d5615ff9adca76d6e4f026f033fbc2264af80edeb4488c93edeeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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}

Release files / dollarsmore_wire-0.5.0-py3-none-any.whl

Download URL dollarsmore_wire-0.5.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c0144cada5bb9329ed0acd891db117794f677a2b7859e8731d0e1857e6e533d
BLAKE2b-256 checksum
How to use checksums
833567b6526a133a76fdbbe377f8fe82fc4de410fd7a983eea39eca04a1426ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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}

Security for dollarsmore-wire 0.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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