Files
trex-core/docs/batches/bat-005_20260604_kis-token-redis-cache/index.md
T
genichinandClaude Opus 4.8 c8174e8bb6 docs(release): REL-001 released → feedback-captured (BAT-001~008 released)
운영자(Hermes Agent) 실 환경 배포 evidence(revision 71faa23, host 86ba33f2997a,
broker=kis LIVE, 2026-06-06T11:18:16Z) 반영:
- Release Execution Evidence 기재(배포 facts + app-service profile checks +
  동일 revision 71faa23 pre-deploy 게이트 재현 보강).
- Rollback Outcome 의미 정정: 운영자 보고 "rollback yes"는 배포 롤백이 아니라
  휴장일(현충일) KIS 거절에 따른 slot pending_buy→idle 정상 복구(매수 거부 경로 smoke 성공).
- capture-release-feedback: release feedback-captured 전환,
  포함 batch BAT-001~008 released 전환.
- 잔여(차기 거래일 실증): ledger flush(fill→ledger), 마이그레이션 명시 로그,
  포지션 정합/warning 마스킹 결과 로그 — Feedback Handoff 기록.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 00:26:08 +09:00

1.4 KiB

BAT-005: KIS 토큰 Redis 캐시 (minor-change)

  • Status: released
  • Profile: batch-lite
  • Source Discovery: dcy-003 (REQ-012 운영 견고성 보완)
  • Included REQ: REQ-016
  • Excluded REQ: 없음

Summary

  • REQ-016 단일 저위험 Integration 요구사항을 minor-change 로 처리. KISBroker 에 선택적 Redis 토큰 캐시(L1 인메모리 → L2 Redis → 발급)를 더해 재기동/다중 프로세스 토큰 생존 + rate-limit 회피. orbit Redis 캐시 패턴 이식.

Scope

  • In Scope:
    • TokenCache 추상화 + RedisTokenCache(redis.from_url, 키 trex:broker:kis:{account_ref}:token, app_key suffix 안전, ex=ttl) + 테스트용 인메모리 더블.
    • KISBroker _ensure_token 3-레벨 + graceful fallback. config TREX_KIS_REDIS_URL + daemon wiring. pyproject redis 의존.
    • 캐시 히트/공유/폴백/suffix 단위테스트.
  • Out of Scope:
    • 다른 캐시 백엔드(PG/파일), 토큰 외 응답 캐시.

Documents

Notes

  • minor-change: 기존 BrokerPort 뒤 토큰 캐시 계층 추가, 외부 인터페이스·슬롯 흐름 불변. design 불요.
  • 실 Redis 없을 때도 graceful fallback → 단일 데몬 회귀 없음. 테스트는 인메모리 캐시 더블로 결정적 검증(실 Redis 서버 불요).