Files
genichinandClaude Opus 4.8 2f57aad7b2 feat(config): expose paper broker tuning via env (REQ-010 AC-5, BAT-009)
Wire the existing PaperBroker scenario knobs (fill_after_polls /
qty_per_poll / reject_symbols) to daemon env so REQ-011 AC-2 e2e
scenarios (delayed / partial / reject) can be reproduced by a daemon
restart. Unset == prior PaperBroker() behaviour, byte-for-byte (no
regression).

- config.py: PaperBrokerConfig + from_env parsing (TREX_PAPER_*)
- daemon.py: _build_broker injects config.paper into PaperBroker
- .env.example: document the 3 paper tuning keys (paper-only, e2e)
- tests: paper broker defaults + env tuning parsing

SDLC: REQ-010 CHG-20260606-01 (AC-5 added) / -02 (Implemented);
BAT-009 batch-lite release-candidate; REL-001 feedback handoff records
pre-deployment e2e observations incl. event-publisher idle-drop and
paper correlation_id collision (GitHub #4, #5).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 16:49:51 +09:00

59 lines
2.7 KiB
Bash

# trex-core slot-core daemon configuration (copy to .env; .env is gitignored).
# Real OS environment variables take precedence over values in .env.
# --- Core (required) ---
# psycopg DSN for the PostgreSQL single-writer store.
TREX_POSTGRESQL_DSN=dbname=trex_core host=/var/run/postgresql
# --- Daemon (optional, defaults shown) ---
TREX_TOTAL_SLOTS=10
# Background execution loop tick interval (seconds).
TREX_EXECUTION_INTERVAL_SEC=1.0
# --- Broker selection (REQ-011/012/013) ---
# 'paper' (deterministic test double, default) | 'kis' (real KIS Open API)
TREX_BROKER=paper
# --- Paper broker tuning (only when TREX_BROKER=paper; for e2e scenarios) ---
# Unset == immediate full fills, no rejects (default production-like behaviour).
# TREX_PAPER_FILL_AFTER_POLLS=0 # polls before fills begin (delayed fill)
# TREX_PAPER_QTY_PER_POLL= # filled qty per poll (partial fill); empty => fill all at once
# TREX_PAPER_REJECT_SYMBOLS= # comma-separated symbols to reject (rollback path)
# --- KIS broker (only when TREX_BROKER=kis) ---
# 모의투자(sandbox): https://openapivts.koreainvestment.com:29443
# 실계좌(live, 실자금): https://openapi.koreainvestment.com:9443 (requires TREX_KIS_ALLOW_LIVE=true)
TREX_KIS_BROKER_BASE_URL=https://openapivts.koreainvestment.com:29443
TREX_KIS_BROKER_TIMEOUT=5
TREX_KIS_BROKER_APP_KEY=
TREX_KIS_BROKER_APP_SECRET=
TREX_KIS_BROKER_ACCOUNT_REF=12345678-01
# Gate for real-account trading. Leave unset/false to stay on 모의투자.
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
# --- Snapshot scheduler (REQ-030, BAT-008) ---
# Daily snapshot refresh time (KST, 24h HH:MM). The scheduler also runs once on
# daemon boot regardless of this time.
TREX_SNAPSHOT_SCHEDULE_KST=07:30
# Scheduler tick interval (seconds) — how often it checks whether the schedule
# time has passed. 60s is plenty for a once-a-day refresh.
TREX_SNAPSHOT_TICK_SEC=60
# --- RabbitMQ transport (REQ-022, BAT-007) ---
# trex-core ↔ 전략 모듈 통신은 RabbitMQ(AMQP) 메시지 기반 (HTTP /v1 API 는 제거됨).
# 미설정이면 데몬은 InMemoryTransport stub 으로 기동(개발/CI 용; 전략과 통신 불가).
TREX_RABBITMQ_URL=
TREX_RABBITMQ_TIMEOUT=5