exec(unified): sync local build — kernel_port + dialect §11 + friction §12 + size threading

Lands the /root/dev local increments (share was ENOSPC; now writable) into the canonical repo:
- kernel_port.py: real ExecPort over the DITAv2 kernel (duck-typed; injected to_kernel_intent).
- dialect.py §11: BingX boundary — clientOrderId(H4)/dash/quantize/payload (PostOnly=timeInForce).
- friction.py §12: effective-bps + naive-baseline savings; side-lane journal that can't raise
  (b46ebd2); BingX commission-sign flip. DDL ships with code (register in applier verify-set).
- drive_loop/executor/working: Decimal size threaded through plan/working types (exit size cap).
All pure stdlib+Decimal, mutation-litmus RED on the two load-bearing asserts. 132 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-07-15 08:05:26 +02:00
parent 21419b03d0
commit ec95bd6663
9 changed files with 968 additions and 5 deletions

View File

@@ -65,6 +65,7 @@ class ResubmitPlan:
limit_price: Decimal # ignored when method is TAKER
attempt: int
reduce_only: bool
size: Decimal = Decimal("0") # base qty for the venue (threaded from the request)
# The plan the venue receives is the same shape whether it is an initial submit (executor,
@@ -252,18 +253,20 @@ class DriveLoop:
request_id=f"{base}-{nxt}", base_request_id=base, asset=wo.asset,
side=wo.side, action=wo.action, method=method,
limit_price=wo.limit_price, attempt=nxt, reduce_only=reduce_only,
size=wo.size,
)
def build_working_order(*, request_id: str, base_request_id: str, asset: str, side: Side,
action: Action, limit_price: Decimal, decision: RoutingDecision,
clock: float, ttl_s: float, attempt: int = 0) -> WorkingOrder:
clock: float, ttl_s: float, size: Decimal = Decimal("0"),
attempt: int = 0) -> WorkingOrder:
"""Construct a WorkingOrder, stamping the policy bits the drive loop needs at expiry
(max_reprices / cross_on_expiry) so the loop never imports the brain's decision path."""
return WorkingOrder(
request_id=request_id, base_request_id=base_request_id, asset=asset, side=side,
action=action, limit_price=limit_price, deadline=clock + ttl_s, created=clock,
attempt=attempt,
size=size, attempt=attempt,
meta={"max_reprices": decision.max_reprices,
"cross_on_expiry": decision.cross_on_expiry},
)