Execution engine
An isolated service that only it holds exchange credentials, accepts structured instructions, and validates every order deterministically.
The execution engine is a separate, isolated service. Only it receives exchange credentials, and it accepts structured instructions, not free-form text— every order is validated deterministically before it leaves.
Structured instruction
strategy_version · exchange · symbol · side · order_type
quantity · limit_price · maximum_slippage · time_in_force
stop_conditions · take_profit_plan · expires_at · approval_idDeterministic validation (before every order)
The engine checks, in code:
- strategy status
- human approval (where required)
- risk limits
- balance
- current liquidity
- spread
- maximum slippage
- market status
- instruction expiry
- duplicate execution
- audit record created
Execution intents
A strategy produces a signal; the risk engine turns it into an approved execution intent; only then does the executor build an order. The intent is immutable after approval — any change requires a brand-new intent.
intent_id · signal_id · risk_decision_id · venue · symbol · side
order_type · quantity · limit_price · stop_price · target_price
maximum_slippage_percent · expires_at
strategy_version · risk_model_versionPrecision & idempotency
Quantities are rounded down to the venue step size, then the planned risk is re-validated on the rounded number:
Every order carries an idempotency key, so a retry, restart or duplicated message can never create a second position:
clawlas:{strategy_id}:{signal_id}:{intent_version}Order lifecycle
Orders move through normalized states. A timed-out request may still have created an order, so the engine never assumes failure — an UNKNOWN state forces reconciliation against client/exchange IDs, open/closed orders and balance changes.
- CREATED → VALIDATEDIntent built and checked
- SUBMITTED → OPENLive on the venue
- PARTIALLY_FILLED → FILLEDFills tracked, remaining quantity updated
- CANCELED · REJECTED · EXPIREDTerminal non-fill states
- UNKNOWN → RECONCILIATION_REQUIREDResolved against the real account — never assumed
The exit engine
Because holding periods are short, exits are continuously evaluated. Triggers include:
- take-profit, trailing stop, maximum loss, maximum holding duration;
- volume collapse, liquidity removal, spread expansion, momentum reversal;
- whale distribution, social momentum reversal, strategy invalidation;
- contract-risk event, exchange incident.