STK10-06 신용잔고 수집·영속화
작업 내용
신용융자 잔고·비중 수직 슬라이스를 구현한다. STK10-03과 동일 패턴, 새 파일만 추가.
- domain:
CreditBalanceEntity,CreditBalanceRepository·CreditBalanceGatewayinterface - infrastructure/krx:
KrxCreditBalanceGatewayImpl— bld 호출·파싱 - infrastructure/mysql:
CreditBalanceRepositoryImpl— 전종목 1회 JDBC 벌크 upsert(INSERT … ON DUPLICATE KEY UPDATE), 행 단위 save 금지
다이어그램
처리 흐름
sequenceDiagram participant DS as MarketFlowDomainService participant Gw as KrxCreditBalanceGatewayImpl participant Client as KrxMdcClient participant Repo as CreditBalanceRepositoryImpl DS->>Gw: fetch(baseDate) Gw->>Client: getJsonData(bld, baseDate) Client-->>Gw: rows Gw-->>DS: List<CreditBalance> DS->>Repo: upsertAll(list)
클래스 의존
flowchart LR Impl[KrxCreditBalanceGatewayImpl] -.implements.-> Gw[CreditBalanceGateway] Impl --> Client[KrxMdcClient] RepoImpl[CreditBalanceRepositoryImpl] -.implements.-> Repo[CreditBalanceRepository]
테스트 케이스
- KRX JSON을 CreditBalance Entity로 파싱한다 (신용잔고·비중 매핑)
- 동일
(symbol, base_date)재적재 시 멱등 upsert된다 - 전종목을 1회 벌크 upsert로 적재한다 (행 단위 save 미사용)
- 빈 응답 시 graceful 처리한다