Metadata-Version: 2.4
Name: dollarsmore-wire
Version: 0.2.0
Summary: Broker-neutral order-intent wire schema for a producer/consumer Redis-Streams transport
Project-URL: Homepage, https://github.com/dollarsmore/wire
Project-URL: Repository, https://github.com/dollarsmore/wire
Project-URL: Issues, https://github.com/dollarsmore/wire/issues
Author: Robert Krzysztoforski
License-Expression: MIT
License-File: LICENSE
Keywords: orders,redis,schema,trading,wire-protocol
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# wire

A tiny, broker-neutral **order-intent wire schema** for a producer/consumer
transport (Redis Streams or anything else). A strategy process produces
`OrderIntent`s; an executor process consumes them and reports back with
`ResultEvent`s. `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

```bash
pip install dollarsmore-wire
# or
uv add dollarsmore-wire
```

```python
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 `IntentLeg`s,
  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.

## 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

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