copilot-swe-agent[bot] and genichin
591db7adb7
Fix unmanaged reconciliation review blockers
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-13 02:21:37 +00:00
copilot-swe-agent[bot] and genichin
5a13c0494b
fix: guard unmanaged resolution on authoritative balances
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:29:45 +00:00
Hermes Agent
06c3f06b5d
fix: reconcile KIS correction order chains
2026-09-12 22:12:19 +09:00
copilot-swe-agent[bot] and genichin
f3fbc179b0
fix(kis): collect all parent candidates before child evaluation; boundary case tests
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 13:35:12 +00:00
copilot-swe-agent[bot] and genichin
584e08eb36
fix(execution): bind parent row to request identity before child evaluation; add parent mismatch and race tests
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 13:21:20 +00:00
copilot-swe-agent[bot] and genichin
65df10542b
fix(execution): KIS child cancel identity binding, sanitized logging, PG cancel SQL tests
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 12:06:45 +00:00
copilot-swe-agent[bot] and genichin
f0ac909958
fix(execution): cancel SQL nullable type error, KIS child cancel detection, worker exception logging
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 03:33:38 +00:00
copilot-swe-agent[bot] and genichin
76cde2edd0
feat: persist skipped ledger fills
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 13:23:06 +00:00
copilot-swe-agent[bot] and genichin
8f74c6b67d
chore: address review feedback
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 10:27:49 +00:00
copilot-swe-agent[bot] and genichin
e2c4bbba34
feat: add ledger backfill command
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 10:24:05 +00:00
Hermes Agent
64e4e32f9d
docs: align venue defaults with SOR contract
2026-08-19 13:12:59 +09:00
Hermes Agent
7366cadf03
fix: preserve SOR execution venue separately
2026-08-19 12:48:05 +09:00
Hermes Agent
15aeae6930
fix: converge broker failures without retry
2026-08-19 11:29:26 +09:00
Hermes Agent
843df1d6f1
fix(execution): fail closed on unresolved orders
2026-08-14 15:29:31 +09:00
Hermes Agent
147873cb5d
feat(execution): reconcile timed-out orders safely
2026-08-14 15:15:52 +09:00
Hermes Agent
0fa8f39be9
feat: paginate KIS balance inquiries
2026-08-10 00:11:04 +09:00
jordan
56b35b257b
feat: own current KIS daily fill contract in Core
2026-07-29 21:46:42 +09:00
jordan
611805dcec
fix: close broker uncertainty audit gaps
2026-07-29 17:53:39 +09:00
jordan
0266992238
feat: add bounded KIS account read recovery
2026-07-29 17:40:01 +09:00
jordan
3dd8eefc92
fix: persist uncertain cancel outcomes
2026-07-29 17:17:14 +09:00
jordan
a656350a35
feat: resolve and persist actual order venue
2026-07-29 17:10:32 +09:00
jordan
d6c2e2d28a
fix: reconcile KIS exchange rejections
2026-07-28 13:29:43 +09:00
jordan
24c42d1c92
fix: reconcile ambiguous KIS order submissions
2026-07-28 11:17:06 +09:00
jordan
b72bf9f394
feat: isolate strategy-owned KIS balances
2026-07-27 11:39:07 +09:00
Hermes Agent
216e462df4
fix(broker): enforce operator broker truth boundary
2026-07-15 08:07:21 +09:00
genichin and Claude Fable 5
ee3dc83a93
feat(broker): KIS venue parameterization — OrderRequest.venue + EXCG_ID_DVSN_CD (REQ-117/118, BAT-056)
...
- OrderRequest.venue: str = "KRX" additive 추가 (기존 위치 인수 순서 불변)
- BrokerPort.cancel_order: venue: str = "KRX" 파라미터 추가
- BrokerPort.get_current_price: market: str = "J" 파라미터 추가
- KISBroker.submit_order: EXCG_ID_DVSN_CD=req.venue 항상 명시 전송
- KISBroker.cancel_order: EXCG_ID_DVSN_CD=venue 항상 명시 전송
- KISBroker.get_current_price: FID_COND_MRKT_DIV_CODE=market 파라미터화
- PaperBroker: cancel_order/get_current_price 시그니처 정합 (venue/market 수신·무시)
- poll_fill TR 유지 (TTTC8001R) — NXT 체결 포함 여부 미확인 open item (코드 주석 기록)
- tests/adapters/broker/test_venue.py: REQ-117 AC-1~5 + REQ-118 AC-1~8 신규 17개
- docs: interface-contract.md OrderRequest/BrokerPort 섹션 + change log 추가
- docs: runtime-flows.md venue 전달 경로 명시 + change log 추가
결과: 794 passed, 47 skipped (기존 777+47 대비 신규 17개 추가 전부 통과)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-07-06 23:24:51 +09:00
genichin and Claude Sonnet 4.6
6b066e19cb
feat(bat-054): 그날-시작 KIS 인증정보 양의 경로 주입 — KISBroker reinitialize (REQ-113 AC-2/AC-4, REQ-115 AC-1)
...
BAT-053 스캐폴드에서 연기된 양의 경로 완성:
- KISBroker.reinitialize(credential): app_key/app_secret/account_ref 교체 + L1 token 무효화
- SnapshotScheduler에 kis_reinit_callback 주입 지점 추가; 그날-시작 성공 시 callback 호출
- daemon.py에 _build_kis_reinit_callback() 헬퍼 + SnapshotScheduler 조립 수정
- 신규 테스트 12개 추가: 757 passed / 47 skipped (기존 745 대비 +12, 회귀 0)
안전 불변식 유지:
- credential_fetch_enabled=False(기본) 경로 byte-for-byte 보존
- fail-closed 불변식 미파괴 (reinit 실패 시 entry_allowed 유지)
- AMQP wire 계약 변경 없음
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-28 19:51:48 +09:00
genichin and Claude Opus 4.8
9871008bb6
fix(paper): BAT-039 — paper order seq Redis 영속화 (재시작 멱등 키 충돌 방지, REQ-011/issue #4 )
...
REQ-011 change-req(CHG-20260612-01)→구현→confirm-req-implemented(CHG-20260612-02)
전체 delivery. paper 한정 결정성 버그(프로덕션 무관).
- seq_store.py 신규: SeqStore 포트 + RedisSeqStore(원자 INCR, 재시작 단조·영속)
+ InMemorySeqStore(폴백/테스트). REQ-016 token_cache 패턴 재사용.
- paper.py: optional seq_store 주입. 미주입 시 기존 in-memory 동작 byte-for-byte 유지.
- config.py/daemon.py: TREX_PAPER_REDIS_URL → RedisSeqStore wiring
(key=trex:broker:paper:{instance_key}:order-seq).
- 런타임 Redis 오류는 전파(silent in-memory 폴백 금지 — 버그 재현 방지).
- tests: 재시작 단조성/correlation_id 비충돌/in-memory 폴백/fake redis INCR (5).
434 passed (+5), ruff clean.
REQ-011 Approved→Implemented, BAT-039 release-candidate. issue #4 close.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-12 18:16:11 +09:00
genichin and Claude Opus 4.8
1cf13b060f
feat(broker): BAT-038 — 매도 증권거래세 누락 정정 + fee/tax 단일 정책 지점 (dcy-026/REQ-018, issue #24 )
...
dcy-026 confirm-discovery + REQ-018 change-req(CHG-20260612-01)→구현→
confirm-req-implemented(CHG-20260612-02) 전체 delivery.
- broker_port.py: calculate_tax(side, amount) 신규 + fee/tax 율 env 상수화
(TREX_KIS_FEE_BPS=1.5, TREX_KRX_TAX_SELL_BPS=20.0). 매도 0.2%/매수 0.
- paper.py / kis.py: tax=0.0 하드코딩 3곳 제거 → 정책 함수 호출.
KIS daily-ccld 응답에 fee/tax 필드 부재 → 정책 폴백(향후 정본 우선 훅).
- runtime-flows.md: 체결→ledger fee/tax 산출 흐름 갱신.
- tests: fee/tax 정책 단위 + issue #24 4건 회귀(fee+tax=1,376.9원).
429 passed (+6), ruff clean.
REQ-018 Approved→Implemented, BAT-038 release-candidate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-12 17:57:15 +09:00
genichin and Claude Opus 4.8
4746f74aae
fix(broker): dcy-013 KIS 외부 취소 감지 + 부분 체결 회계 + stale 워치독 (BAT-017)
...
KIS 계좌에서 직접 매도 주문을 취소하면 poll_fill 이 cncl_yn 을 파싱하지 않아
슬롯이 pending_sell 에 영구히 갇히고 죽은 주문을 무한 폴링하던 버그(issue #9 )
정정.
거버넌스: 전부 change-req (신규 REQ 없음, dcy-013 OQ-3).
- REQ-012: KIS poll_fill cncl_yn 파싱 → 외부 취소 감지. FillStatus.cancelled
/is_partial_cancel 추가. 체결 0 취소→cancelled, 부분 체결 후 취소→partial+cancelled
- REQ-013: 집행 _on_partial_cancel — 체결분 원장 1회 + qty 차감(매도 잔여/매수 체결분)
+ holding 복귀 (OQ-1 A안). 전량 취소는 기존 롤백 경로 재사용
- REQ-018: 부분 체결분 원장 1회 기록 (_record_ledger 재사용)
- REQ-031: 잔여 포지션 정합 연계 (slot.qty ↔ 실 잔고, 과매도 방지)
- REQ-014: pending stale 워치독 Alert-only (TREX_PENDING_STALE_THRESHOLD,
WARN+카운터, 상태 미변경) — 취소 감지 누락 backstop
- REQ-015: interface-contract/runtime-flows 정합
전량 취소는 holding 자동 복구(limit_price clear→재매도 시장가, dcy-012 연계).
KIS cncl_yn 실 규약은 운영 검증(미지 값 보수 처리 + 워치독 backstop).
검증: 단위 294 passed/32 skipped, 인프라 게이트(PG+RabbitMQ) 326 passed, ruff clean.
신규 test_kis_cancel(httpx stub) + test_execution_cancel(programmable broker).
BAT-017 release-candidate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 14:11:49 +09:00
genichin and Claude Sonnet 4.6
0082d3b5da
fix(kis): REQ-038 현재가 tr_id 정정 + REL-003 확정 + dcy-008 kill-switch Discovery
...
## REQ-038 CHG-04/05: KIS 시세 tr_id 정정 (FHKST01010100)
- kis.py _tr_price(): TTTC8397R/VTTC8397R → FHKST01010100 (실전/모의 공용)
배포 전 실 KIS LIVE 진단에서 구 tr_id가 rt_cd=1 "없는 서비스 코드"로 거부됨을
확인 — stop-loss/take-profit이 LIVE에서 조용히 미발동하는 결함이었음.
FHKST01010100으로 정정 후 get_current_price('005930')=329000(rt_cd=0) 확인.
- test_kis_price.py: AC-7 테스트 정정 (FHKST01010100 공용 검증)
- REQ-038: CHG-04/05 Change Log 추가, Requirement/AC-7/Notes 정정
- BAT-011 implementation.md: LIVE 검증 및 tr_id 정정 이력 추가
- BAT-011 verification.md: AC-7 evidence를 CHG-04 정정 버전으로 갱신
- docs/srs/index.md: CHG-04/05 Change Log 항목 추가
## REL-003: core 자율 안전 매도 release 문서 생성
- docs/releases/rel-003_20260607_core-autonomous-safety-sell.md 신규 생성
(BAT-010 + BAT-011, app-service profile, Status: confirmed)
- docs/releases/index.md: REL-003 행 추가
## dcy-008: 비상 정지/강제 청산(kill-switch) Discovery 초안
- docs/discovery/dcy-008_20260607_emergency-stop-kill-switch.md 신규 생성
GitHub #3 기반; SlotService.sell() 재사용, 당일 전략 제외 day-scoped
FR 6개, NFR 3개, OQ 4개 (트리거 표면/영속 방식/수동 해제 결정 필요)
- docs/discovery/index.md: dcy-008 행 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-07 10:17:36 +09:00
genichin and Claude Opus 4.8
a30efa8f3b
feat(safety-sell): dcy-007 core 자율 안전 매도 — BAT-010 기반 + BAT-011 트리거
...
dcy-007(core 자율 안전 매도) 전체 delivery. BAT-010 기반 인프라가 미커밋
상태였고 BAT-011 트리거 레이어와 공유 파일에서 섞여 있어 한 커밋으로 묶음.
BAT-010 (REQ-034/035/036/041, release-candidate):
- WatchdogStore(application/watchdog.py) + snapshot RPC 워치독 갱신
- Slot stop_loss_price/take_profit_price 필드 + 004_add_price_thresholds.sql
- SlotService.sell() 자율 매도 내부 경로 + idempotency
- SafetySellConfig env 5종 파싱
BAT-011 (REQ-037/038/039/040/042, release-candidate):
- SafetySellService(application/safety_sell.py): forced_close 만기 / stop-loss·
take-profit KIS polling / 장 마감 강제 청산 + trex-safety-sell 7번째 스레드
- BrokerPort.get_current_price + KIS inquire-price(TTTC8397R/VTTC8397R, stck_prpr)
+ paper stub
- SlotService.update_thresholds() + intent RPC update_thresholds 액션
(부분 갱신/null 해제, 워치독 last_seen_at 리셋)
- baseline 3문서 정합(interface-contract/runtime-flows/project-structure)
거버넌스: REQ-034~042 Implemented 동기화, BAT-010/011 release-candidate,
dcy-007 discovery 포함.
검증: 신규 38 테스트 green, 단위 236 passed/23 skipped,
인프라 게이트(PG+RabbitMQ) 259 passed(마이그레이션 001~004 round-trip 포함),
ruff clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-07 08:32:30 +09:00
genichin
ca757009f5
feat: add portfolio snapshot read layer
2026-06-06 09:33:00 +09:00
genichin and Claude Opus 4.8
13837acc60
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 >
2026-06-04 22:57:31 +09:00
genichin and Claude Opus 4.8
ac6061f510
Deliver BAT-005: KIS token Redis cache (REQ-016, minor-change)
...
Port the trex-orbit Redis token-cache pattern so the KIS access token
survives daemon restarts and is shared across processes, avoiding KIS
token-issuance rate limits. KISBroker._ensure_token now resolves L1
in-memory -> L2 cache -> issue, storing issued tokens back to the cache.
- adapters/broker/token_cache.py: TokenCache protocol + RedisTokenCache
(key trex:broker:kis:{account_ref}:token, token+expiry+app_key suffix
JSON, ex=ttl, best-effort with graceful fallback) + InMemoryTokenCache.
- kis.py: optional token_cache injection.
- runtime config/daemon: TREX_KIS_REDIS_URL wires a RedisTokenCache.
- pyproject: redis>=5.
Verification: 96 passed, ruff clean — cache hit avoids issuance, cache is
shared across instances (restart/multi-process survival), backend errors
fall back to issuance (no regression), and app_key-suffix mismatch
invalidates a stale cache. Tested deterministically with an in-memory
double (no Redis server required). Processed via the minor-change fast
path: REQ-016 -> Implemented, BAT-005 (batch-lite) -> release-candidate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-04 18:44:09 +09:00
genichin and Claude Opus 4.8
97d58318db
Deliver BAT-004: broker execution + KIS adapter + durable handoff
...
Implement REQ-011~015 (dcy-003): the order-execution layer on top of the
BAT-002 slot-core daemon, connecting intents to real orders.
- application: BrokerPort (submit/poll_fill/cancel) + ExecutionService
(claim -> submit -> poll -> transition -> rollback -> reconcile)
- adapters/broker: PaperBroker (deterministic async double) and KISBroker
(KIS Open API: token, order-cash, inquire-daily-ccld, cancel; VTS sandbox
tr_ids; live account gated behind allow_live)
- persistence: option-A execution queue (find_pending_for_dispatch FOR
UPDATE SKIP LOCKED, mark_dispatched idempotency guard, clear_dispatch)
- runtime: background execution loop in the daemon lifespan + startup
reconcile; config selects paper|kis
Verification (real KIS VTS 모의투자 + PostgreSQL): 92 passed, ruff clean,
domain import sweep shows zero broker/web/db deps, buy->holding /
sell->closed / reject->idle, idempotent dispatch (exactly one order),
reconcile after crash creates no duplicate order, KIS sandbox token+submit
round-trip, and a daemon E2E through the background loop. Align the four
baseline docs. BAT-004 -> release-candidate; REQ-011~015 -> Implemented.
KIS live-account go-live, partial-fill accrual, option-B outbox, connection
pooling, and the safety floor remain deferred to follow-up Discoveries.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-04 17:46:17 +09:00