ls증권 히스토리 구독 넣음
This commit is contained in:
26
kis_trader/utils/session_hm.py
Normal file
26
kis_trader/utils/session_hm.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
세션 HHMM 판별 — 국내(당일 구간) / 해외(자정 넘김 RTH) 공통.
|
||||
|
||||
국내 기본: start <= hm < end (예: 900~1430)
|
||||
해외 야간: wrap_midnight 이고 start > end 이면 hm>=start or hm<end (예: 2230~0500 KST)
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def hm_in_trading_window(
|
||||
hm: int,
|
||||
start_hm: int,
|
||||
end_hm: int,
|
||||
*,
|
||||
wrap_midnight: bool = False,
|
||||
) -> bool:
|
||||
"""True = 매매 허용 시각."""
|
||||
try:
|
||||
h = int(hm)
|
||||
s = int(start_hm)
|
||||
e = int(end_hm)
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
if wrap_midnight and s > e:
|
||||
return h >= s or h < e
|
||||
return s <= h < e
|
||||
Reference in New Issue
Block a user