feat: фильтр праздников NYSE — бот не торгует когда биржа закрыта

- holidays.py: календарь NYSE holidays 2024–2027 (10 дат/год)
- executor: _is_nyse_hours() пропускает праздники
- все ORB-бэктесты: исключают holidays из train/test split и run_day()
- OOS сравнение: +$18 PnL, +0.8pp WR, Sharpe 0.42→0.47

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-13 22:48:53 +10:00
co-authored by Claude Opus 4.6
parent 6a045d23f1
commit 31de69f641
8 changed files with 90 additions and 9 deletions
+4 -1
View File
@@ -20,6 +20,7 @@ import pandas as pd
from config import Config, StrategyConfig
from exchange import FuturesExecutor
from holidays import is_nyse_holiday
from notify import notify_entry, notify_exit, notify_or
from state import (
close_position, get_equity, get_open_positions, get_session,
@@ -63,9 +64,11 @@ def _get_session(symbol: str) -> SessionState:
def _is_nyse_hours(now_ny: datetime) -> bool:
"""Check if within NYSE trading window (9:25-16:05 NY, weekdays)."""
"""Check if within NYSE trading window (9:25-16:05 NY, weekdays, not holidays)."""
if now_ny.weekday() >= 5: # Sat, Sun
return False
if is_nyse_holiday(now_ny.date()):
return False
t = now_ny.hour * 60 + now_ny.minute
return 9 * 60 + 25 <= t <= 16 * 60 + 5