MARKET ENGINE
The market engine is the part of Dexter that turns signed user intent into exchange state.
It decides whether an order may enter, how it is priced, how balances and positions change, and when a market must shift from normal trading into a constrained or defensive posture.
| Engine responsibility | What it covers |
|---|---|
| Front-door control | Signer authorization, signature validity, sequencing, and order-commit policy |
| Pricing | vAMM skew, spread controls, inventory caps, and open-interest pressure |
| Ledger updates | Position size, entry basis, realized PnL, fees, funding carry, and cash movement |
| Market posture | Live, reduced, close-only, session-closed, and halted states |
| Forced routines | Liquidations, bad-debt containment, ADL, and rebalance flows |
#How the live trading path works
Orders do not enter the engine as raw requests.
In production, the account first enables its signer through agent authorization. The order is then submitted as signed IOC flow with a monotonic sequence number, checked against createdAtTs and goodTilTs timing guards, and anchored through the on-chain OrderCommitRegistry before placement because production posture keeps commit guard enabled.
That gives Dexter a narrower front door than a generic order API.
The engine will not price a request until signer policy, monotonic sequencing, timing validity, and required commit evidence all check out.
The production venue also runs in liquidityless vAMM mode.
The engine does not depend on passive maker quotes resting in the book.
It prices flow through skew-sensitive logic, spread controls, inventory limits, and open-interest caps.
When a fill is accepted, ledger state is updated in one path.
Position size, entry basis, realized PnL, fees, funding carry, and account cash all move together.
signer authorized
-> order commit recorded when policy requires it
-> signed IOC order enters runtime
-> admission and pricing checks
-> fill or cancel remainder
-> ledger, fee, and funding updates
-> market posture and publication pipeline
#Market posture, carry, and forced routines
Each market runs inside an explicit state machine.
A market can be live, reduced, close-only, session-closed, or halted.
These are execution rules, not interface labels.
They are driven by reference freshness, session logic, skew pressure, utilization, bad-debt risk, and recovery conditions after a degraded period.
The engine also measures open interest, directional imbalance, and crowding continuously.
That state feeds funding, fee pressure, skew controls, and market caps.
Funding in Dexter is therefore part of the engine's carry model, not just a number displayed after the fact.
The same engine also owns forced reduction paths.
Liquidation checks, insurance-aware bad-debt handling, ADL selection, and rebalance routines stay in the same execution domain as ordinary order processing so stressed behavior remains ordered and deterministic.