Implement BAT-006: portfolio-hub ledger integration (REQ-017~019)

- REQ-017: LedgerPort contract (application/ledger_port.py) + portfolio-hub
  adapter + in-memory stub (adapters/ledger/), TREX_PORTFOLIO_HUB_* config
- REQ-018: fill→ledger recording in execution loop; FillStatus carries
  execution_id (deterministic synth) + fee; paper/kis adapters updated
- REQ-019: ledger outbox + retry worker (application/ledger_outbox.py),
  correlation_id idempotency, outcome vocabulary; 002_create_ledger_outbox.sql
- Tests: in-memory/portfolio-hub ledger, execution ledger hook, outbox,
  domain import sweep

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 22:57:31 +09:00
co-authored by Claude Opus 4.8
parent 6277d610ea
commit 13837acc60
20 changed files with 1224 additions and 15 deletions
+9
View File
@@ -29,3 +29,12 @@ TREX_KIS_ALLOW_LIVE=false
# Optional: Redis URL for KIS token cache (restart / multi-process survival, REQ-016).
# Unset => in-memory token cache only.
TREX_KIS_REDIS_URL=
# --- portfolio-hub ledger (REQ-017/018/019, BAT-006) ---
# When TREX_PORTFOLIO_HUB_BASE_URL is set, fills are recorded via the HTTP
# adapter; otherwise the daemon uses an in-memory ledger (no external writes).
TREX_PORTFOLIO_HUB_BASE_URL=
TREX_PORTFOLIO_HUB_TOKEN=
TREX_PORTFOLIO_HUB_TIMEOUT=5
# Ledger outbox writer tick interval (seconds).
TREX_LEDGER_INTERVAL_SEC=1.0