Merge pull request #298 from kevin9327/fix/market-time-non-trading-day-full-session

fix(market-time): 非交易日的已交易分钟数按全天算, 量比不再被折算放大
This commit is contained in:
wshy
2026-09-11 09:02:22 +08:00
committed by GitHub
2 changed files with 63 additions and 0 deletions
+2
View File
@@ -44,6 +44,8 @@ def trading_minutes_elapsed_from_dt(dt: datetime) -> float:
- 开盘前 = 0; 午休(11:30-13:00) = 120(保持上午累计); 收盘后 = 240。
- 非交易日(周末) = 240 (视作全天, 避免量比被折算成 0)。
"""
if dt.weekday() >= 5:
return float(_TRADING_TOTAL_MINUTES)
t = dt.time()
if t < _MORNING_START:
return 0.0