executor.py composes the built parts into one execute(request, snapshot): S-grade fence → router.decide → placer.pre_submit → submit → register working. The initial-submit half that complements DriveLoop's expiry half (analogue of pink_direct.py:1645-1700). Composition rulings encoded + tested: - S2/S3 pain-fence (§15.2): refused WHOLE, loudly, below T14 — never silently sliced. - placer declines (spread gate) → cross ONLY if urgency crosses on expiry; ACQUIRE ABANDONS (a missed entry is free, §4-1). Both mutation-verified RED. - TTL from urgency discipline: PROTECT 2s / ROTATE deadline_ms / ACQUIRE quote-lifetime. contract.py: SGrade enum (S0-S3) + s_grade/parent_request_id fields. _constants: MAKER_QUOTE_TTL_S. FIX (real bug, not just test): drive_loop._is_resolved EXIT was trade_id-based (a PINK artifact — PINK reused the position's trade_id for exits). The agnostic layer never gets the position id, so exit-done is now SIZE-based. Kept ENTER on clientOrderId match. Full exec_unified suite: 94 green, mutation-litmus verified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Unified Execution Layer — the "T" of DITAv2 (spec SPEC_UNIFIED_EXEC_LAYER_20260714.md).
|
|
|
|
Standalone, pure-policy foundation. Contract (§2) + whether-maker Router (§6). Zero I/O,
|
|
zero venue knowledge, zero importers elsewhere yet — adopting it breaks nothing.
|
|
|
|
Not yet wired: the PINK drive-loop port (§7), the venue dialect (§11), telemetry (§12).
|
|
Those bolt on above/below this pure core. Kill switch discipline (UV_SMART_EXEC=0, §2.3
|
|
promise #5) lives at the wiring layer, not here.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from .contract import (
|
|
ExecutionAdvice,
|
|
ExecutionRequest,
|
|
ProtectiveSpec,
|
|
SGrade,
|
|
Side,
|
|
UrgencyClass,
|
|
)
|
|
from .executor import ExecuteResult, ExecuteStatus, UnifiedExecutor
|
|
from .router import ExecutionMethod, RoutingDecision, TtlDiscipline, decide
|
|
|
|
__all__ = [
|
|
"ExecuteResult",
|
|
"ExecuteStatus",
|
|
"ExecutionAdvice",
|
|
"ExecutionMethod",
|
|
"ExecutionRequest",
|
|
"ProtectiveSpec",
|
|
"RoutingDecision",
|
|
"SGrade",
|
|
"Side",
|
|
"TtlDiscipline",
|
|
"UnifiedExecutor",
|
|
"UrgencyClass",
|
|
"decide",
|
|
]
|