Implement the following plan: RANK 메뉴 급등/급락 데이터 미표시 수정 및 Request Validation 추가 Context…
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
Implement the following plan:
RANK 메뉴 급등/급락 데이터 미표시 수정 및 Request Validation 추가
Context
RANK 메뉴의 급등/급락 탭에서 데이터가 표시되지 않는 버그가 있음. 원인은
fetcher.py에서 Kiwoom API (ka10019 가격급등락요청)를 호출할 때 잘못된 파라미터를 전달하기 때문. 또한 해당 API 메서드에Literal타입 기반 request validation이 없어 이런 실수를 컴파일/런타임에 잡지 못함.수정 사항
1.
_domestic_stock_info.py- Literal 타입 validation 추가파일:
packages/cluefin-openapi/src/cluefin_openapi/kiwoom/_domestic_stock_info.py:365-398get_price_volatility메서드의 파라미터를str→Literal[...]로 변경 (공식문서 기준):pythondef get_price_volatility( self, mrkt_tp: Literal["000", "001", "101", "201"], flu_tp: Literal["1", "2"], tm_tp: Literal["1", "2"], tm: str, trde_qty_tp: Literal["00000", "00010", "00050", "00100", "00150", "00200", "00300", "00500", "01000"], stk_cnd: Literal["0", "1", "3", "5", "6", "7", "8"], crd_cnd: Literal["0", "1", "2", "3", "4", "7", "9"], pric_cnd: Literal["0", "1", "2", "3", "4", "5", "8"], updown_incls: Literal["0", "1"], stex_tp: Literal["1", "2", "3"], cont_yn: Literal["Y", "N"] = "N", next_key: str = "", ) -> KiwoomHttpResponse[DomesticStockInfoPriceVolatility]:docstring도 Literal 타입이 반영되도록 업데이트:
crd_cnd에7:신용융자E군추가stex_tp에3:통합추가
2.
fetcher.py- 잘못된 파라미터 수정파일:
apps/cluefin-desk/src/cluefin_desk/data/fetcher.py:251-263파라미터 현재 (잘못됨) 수정 이유 tm_tp"0""1"분전 기준 (유효값: "1" or "2") tm"" Assistant
I'll read the three files that need to be modified in parallel.
Assistant
Now let me check the imports in the file.
Assistant
Literalis already imported. Now let me create the task list and apply all three changes.Assistant
Now applying all three code changes in parallel.
Assistant
The unit test already uses valid Literal values (
tm_tp="1",tm="60",trde_qty_tp="00000",stk_cnd="0") — no changes needed there. Let me run the checks.Assistant
All checks passed — ruff clean on both packages, 28/28 tests passing.
Assistant
All done. Here's a summary of the changes:
1.
_domestic_stock_info.py— Literal 타입 validation 추가get_price_volatility메서드의 9개str파라미터를Literal[...]로 변경하여 잘못된 값 전달 시 타입 체커가 경고하도록 수정. docstring도crd_cnd에7:신용융자E군,stex_tp에3:통합추가.2.
fetcher.py— 잘못된 파라미터 수정파라미터 수정 전 수정 후 tm_tp"0""1"(분전 기준)tm"""60"(60분전 대비)trde_qty_tp"0""00000"(전체조회)stk_cnd"4""1"(관리종목제외)3. 단위 테스트
기존 mock 테스트 파라미터가 이미 유효한 Literal 값을 사용하고 있어 변경 불필요. 28개 테스트 모두 통과.
- User
commit /commit #19 issue number
Assistant
커밋 완료:
1965ba6 fix(desk): RANK 급등/급락 데이터 미표시 수정 (#19)