Compare commits

...

2 Commits

Author SHA1 Message Date
agentson
8af5f564c3 fix: ranking API 필수 파라미터 KEYB 추가 및 GUBN 값 수정 (#258)
Some checks failed
CI / test (pull_request) Has been cancelled
KIS 공식 문서(20260221) 기준 KEYB(NEXT KEY BUFF)는 Required=Y이나
누락되어 있어 항상 rt_cd=2 오류 발생, fallback 경로로만 실행됨.

- fluctuation/volume 양쪽 params에 KEYB: '' 추가
- GUBN 주석 수정: 0=하락율, 1=상승율 (문서 기준)
- GUBN 값 0→1 수정: 상승율 기준으로 변동성 급등 종목 스캔

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 00:19:55 +09:00
06e4fc5597 Merge pull request 'fix: run_overnight.sh --mode=paper → --mode=live 수정 (#256)' (#257) from feature/issue-256-fix-overnight-live-mode into main
Some checks failed
CI / test (push) Has been cancelled
Reviewed-on: #257
2026-02-26 00:06:50 +09:00
2 changed files with 6 additions and 2 deletions

View File

@@ -121,6 +121,7 @@ class OverseasBroker:
tr_id = self._broker._settings.OVERSEAS_RANKING_VOLUME_TR_ID
path = self._broker._settings.OVERSEAS_RANKING_VOLUME_PATH
params: dict[str, str] = {
"KEYB": "", # NEXT KEY BUFF — Required, 공백
"AUTH": "",
"EXCD": ranking_excd,
"MIXN": "0",
@@ -130,10 +131,11 @@ class OverseasBroker:
tr_id = self._broker._settings.OVERSEAS_RANKING_FLUCT_TR_ID
path = self._broker._settings.OVERSEAS_RANKING_FLUCT_PATH
params = {
"KEYB": "", # NEXT KEY BUFF — Required, 공백
"AUTH": "",
"EXCD": ranking_excd,
"NDAY": "0",
"GUBN": "0", # 0=전체(상승+하락), 1=상승 — 변동성 스캐너는 전체 필요
"GUBN": "1", # 0=하락, 1=상승 — 변동성 스캐너는 급등 종목 우선
"VOL_RANG": "0",
}

View File

@@ -122,9 +122,10 @@ class TestFetchOverseasRankings:
params = call_args[1]["params"]
assert "/uapi/overseas-stock/v1/ranking/updown-rate" in url
assert params["KEYB"] == "" # Required by KIS API spec
assert params["EXCD"] == "NAS"
assert params["NDAY"] == "0"
assert params["GUBN"] == "0" # 0=전체(상승+하락), 변동성 스캐너에 필요
assert params["GUBN"] == "1" # 1=상승율 — 변동성 스캐너는 급등 종목 우선
assert params["VOL_RANG"] == "0"
overseas_broker._broker._auth_headers.assert_called_with("HHDFS76290000")
@@ -157,6 +158,7 @@ class TestFetchOverseasRankings:
params = call_args[1]["params"]
assert "/uapi/overseas-stock/v1/ranking/volume-surge" in url
assert params["KEYB"] == "" # Required by KIS API spec
assert params["EXCD"] == "NYS"
assert params["MIXN"] == "0"
assert params["VOL_RANG"] == "0"