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 moreIntentLegs, 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.
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 holding a plain decimal literal, never a JSON number.
{"price": 1.60}would round through binary float and decode as1.6000000000000000888..., which is what the broker would then be quoted. Digits with at most one point: no sign, no exponent, no underscores, no surrounding whitespace, soNaN,Infinity,-0.00,1e3and1_0are all refused. - Money sits at or below
MONEY_CEILING(1,000,000, exported). A premium past it is a corrupt print rather than a price, andto_wirerefuses it BEFORE expanding to fixed point:1E+9999999is twelve bytes in and ten megabytes out. strikeandquantityare JSON integers, not floats, strings or booleans:2.9must not silently become 2 contracts.quantitysits inQUANTITY_FLOOR..QUANTITY_CEILING(1 to 99), both exported.- A
LIMITorder carries bothpriceandprice_effect; a limit with no limit price is refused rather than passed on as the string"None". vis an integer no greater thanWIRE_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
uv run ruff check .
uv run mypy wire tests
Metadata
Release files for dollarsmore-wire 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dollarsmore_wire-0.6.0.tar.gz | 389.9 kB | Without provenance | Details for dollarsmore_wire-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dollarsmore_wire-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for dollarsmore_wire-0.6.0-py3-none-any.whl |
Total release size: 399.1 kB
Release files / dollarsmore_wire-0.6.0.tar.gz
| Download URL | dollarsmore_wire-0.6.0.tar.gz |
|---|---|
| Size | 389.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28c84a236791ac259a05044a8a4aa324c8dd4e70b2af5e1cb2eaefbc214d4e1a
|
|
BLAKE2b-256 checksum How to use checksums |
3114913d83a65fdf9017978db6e30109b953488fc4fb5c7fbd2d7171e954b88c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.6.0-py3-none-any.whl
| Download URL | dollarsmore_wire-0.6.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e987432b18dfd31002362437c6f13a4adba0023fe04b52e08a919978182222a
|
|
BLAKE2b-256 checksum How to use checksums |
a32dc9cb5d003981a1f8bcf7ff3d89ba288bc4dbc7b590e0e47d78c832cf9e99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.6.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.