Phase 4 — Execution
Code review of qgtm_execution/, daemon order path, reconciliation.
Architecture
Signal → ComplianceGateway → RiskManager.check_signal → OMS.submit → AlpacaBroker
↓ ↓
portfolio_state wired (2026-05) _record_tca (post-fill)
Strengths (verified 2026-05-17)
| Area |
Evidence |
| TCA wired |
oms.py _record_tca after fills; logs tca_result + audit |
| Fill prices |
broker.py parses filled_avg_price from Alpaca |
| Pre-trade compliance |
Macro + intraday + hygiene paths pass _build_compliance_portfolio_state |
| Spread filter |
MAX_TRADEABLE_SPREAD_BPS=25 drops illiquid names pre-signal |
| Reconciliation |
Every daemon cycle; tests in test_reconcile_drill.py |
| Wrapper netting |
PRIMARY_BY_ALIAS avoids GLD/SGOL churn |
Gaps
| Gap |
Severity |
Fix |
Advanced algos (algos.py Iceberg/POV/IS) |
P2 |
No production call sites — use for >$1M slices |
| Arrival price quality |
P1 |
Confirm current_price at signal time ≠ stale bar |
| Futures execution |
P0 for GC/SI mandate |
Book trades ETFs; futures execution path unclear |
| TCA persistence |
P2 |
Logs only — add daily TCA rollup table / parquet |
| Partial fill handling |
P1 |
Review OMS cancel/replace on timeout |
| Slippage model vs live |
P1 |
Compare TCA bps distribution to DEFAULT_SLIPPAGE_BPS |
Failure handling
| Failure |
Behavior |
| Broker down |
Orders fail; reconciliation drift; alerts via Telegram (dedup PR #73) |
| DMS trip |
Watchdog flatten; 300s timeout |
| SIGTERM |
Daemon main() handler — graceful shutdown path (2026-05 #68) |
| Kill switch |
Tiered FLATTEN; 2-person reset |
TCA acceptance tests (add)
- Paper order →
tca_result log with arrival_cost_bps finite.
- Daily
make daily includes median slippage by symbol.
- Reject rate by
INTRADAY_COMPLIANCE_REJECTED < 5% of intents.
90-day roadmap
| Week |
Deliverable |
| 1 |
TCA daily rollup script + dashboard panel |
| 2 |
Participation-rate cap on intraday notional |
| 3 |
Futures broker adapter spike (if capital > $25M) |