Skip to content

betting_combat.execution.ledger

ledger.py — the execution’s record (schema ufc: decisions, orders, fills, settlements; the contracts in contracts.ledger), written as it trades.

LedgerFeed the four tables through the feeds' writer (upserts on deterministic ids: a replayed
or relaunched card lands on the same rows); ``settle`` writes each filled order's
settlement once its market's payout is in the catalog (``ufc.markets``)

Classes

LedgerFeed

Bases: Feed

jsonable

jsonable(d: dict[str, Any]) -> dict[str, Any]

A decision’s numbers as JSON (floats, NaN to None).

settle

settle() -> int

Every filled order whose market has paid: its settlement (cost = what the fills paid and their fees). Nothing before the ledger’s first card (its tables not made yet).