Broker-neutral order-intent wire schema for a producer/consumer Redis-Streams transport
Project description
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-4IntentLegs, order type, price (positive-magnitudeDecimal) with an explicitPriceEffect(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
Decimalplus an explicitPriceEffect; 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dollarsmore_wire-0.4.0.tar.gz.
File metadata
- Download URL: dollarsmore_wire-0.4.0.tar.gz
- Upload date:
- Size: 389.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
716d29ef59fea73f25578bc36ab9212dc6308f421914733a359de24bf4738710
|
|
| MD5 |
3575f5b980c99d8f7cd0042a0b5b0630
|
|
| BLAKE2b-256 |
cc6deac6ad0200ca5771e447116b71eff8b660c68065ea63863fb505ec100c9d
|
File details
Details for the file dollarsmore_wire-0.4.0-py3-none-any.whl.
File metadata
- Download URL: dollarsmore_wire-0.4.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63a27bb50b93d21128984444c076b6fb1b04eb5999a7d06ead247aa90606eae3
|
|
| MD5 |
42cd5e7685ee2f219f59bd1d73a87687
|
|
| BLAKE2b-256 |
0130254755a459bb94882063c503cf161c5c6aa225ddf57699892069a94993f5
|