feat(constants): add get_ws_url helper for real/mock WebSocket selection#36
Merged
Conversation
v1.7.0에서 도입했지만 미사용으로 dead code 상태였던 WS_MOCK_URL을 활성화. KIS 공식 샘플 코드(open-trading-api/legacy/websocket/python/*)에서 모의투자 WS 엔드포인트가 ws://ops.koreainvestment.com:31000임을 확인. 추가: - kis_agent.core.constants.get_ws_url(is_real: bool = True) -> str 실전/모의 분기 헬퍼. 기본은 실전(기존 동작 호환). - kis_agent/websocket/__init__.py 도크스트링에 모의 엔드포인트 사용 예제 추가. 기존 WSAgent/KisWebSocket 시그니처는 변경하지 않음(url 매개변수에 직접 전달). 사용자가 명시적으로 get_ws_url(False)로 선택할 수 있게 된 점이 가장 큰 차이.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v1.7.0(#33)에서 도입했지만 미사용으로 dead code 상태였던
WS_MOCK_URL을 활성화하는 헬퍼 추가.Verified
KIS 공식 샘플 코드
open-trading-api/legacy/websocket/python/{ws_domestic_overseas_all,ws_domestic+overseas_stock,ops_ws_sample,ws_commodity_future,ws_domestic_stock,ws_domestic_future,multi_processing_sample_ws}.py에서 모두 모의투자 WS 엔드포인트로 `ws://ops.koreainvestment.com:31000`을 주석으로 명시 — 본 PR의 `WS_MOCK_URL`이 KIS 공식과 일치함을 확인.Changes
kis_agent/core/constants.py: `get_ws_url(is_real: bool = True) -> str` 헬퍼 추가kis_agent/websocket/__init__.py: 도크스트링에 모의 엔드포인트 사용 예제 추가Compatibility
Test plan