Skip to content

betting_combat.execution.executor

executor.py — the one execution (Sam 2026-11-16): every strategy’s plans on every venue its config rows switch on, paper or live, into the ledger. Strategy-free: a strategy hands a Plan (its rule), nothing here knows a fair or a cushion.

Executor one card run's. ``start(plan)``: a decision row per active venue row and the plan
worked there (``Working``); ``skip(...)``: a decision not to trade (why), on every
active row; ``on_trade(market, trade)``: every print of the card (paper fills, a
plan's stop); ``tick(now)``: every second - the configs re-read every ``REREAD_S``
(a kill switch or a row off cancels that row's orders at once), every working plan
brought to its rule, the live orders' fills looked up; ``close()``: everything
cancelled, the ledger written, the settled orders settled
Working one plan on one venue: its market, its resting bid, its fills

At every moment a plan’s rule says what to hold (Limits): live, every offer of our side at or under take is taken at once (an immediate-or-cancel buy at the limit for every contract the cash buys: the market’s offers are the only cap, feedback-fill-the-max), the resting bid is held at bid (a post-only buy for every contract the cash buys; a new price is a cancel and a new order, at most every REQUOTE_S; cancelled before a take, which needs its cash). Paper sends nothing: each print fills by the replay’s rule (paper.match: every contract of a print through our bid or at or under our take), the cash unlimited (a row’s max_contracts the only cap), the fee the venue’s taker fee.

A plan ends at closes, when its fight’s finish is told (over, or a print saying so: stop_on; paper keeps filling cancel_lag_s after it, the cancel’s latency the backtest charges) or its row goes off. Every live send is once: the order row is written submitted before it is sent, never retried; a lost answer is looked up on the venue by our id and closed as error when not found.

Classes

Executor

The card’s execution (module doc).

active

active(strategy: str) -> list[ExecutionConfig]

cancel_everything

cancel_everything() -> None

Every open order of every plan off (the session’s end, a crash’s cleanup).

close

close() -> dict[str, Any]

The card over: every plan ended, the ledger written, the settled orders settled.

flush

flush() -> None

Every spawned piece of work finished (the ledger’s paper rows among them).

on_trade

on_trade(market: Market, trade: Trade) -> None

A print on the card: a stop told; paper fills (now, in the print’s order).

reload

reload() -> None

The configs’ rows; a row gone off or killed has its orders cancelled now.

settings

settings(strategy: str) -> dict[str, dict[str, Any]]

Each active venue row’s strategy settings (the strategy’s execution settings per venue).

skip

skip(strategy: str, bout_id: str, round_idx: int, reason: str, chances: dict[str, Any] | None = None, inputs: dict[str, Any] | None = None, model_version: int | None = None) -> None

A decision not to trade, on every active row of the strategy (the ledger says why).

start

start(plans: Plan | list[Plan], prices: dict[str, Any] | None = None) -> list[Working]

The plans on every active venue row of their strategy (a plan with a venue only there: the strategy’s settings for that venue applied; one without, on every venue); a venue without the plan’s market, or that cannot take live orders now, gets a no-trade decision saying so.

tick

tick(now: dt.datetime) -> None

Every second: the configs (every REREAD_S), each plan to its rule, the live fills (every RECONCILE_S).

Working

One plan on one venue (module doc).