diff --git a/rotation/simple_rotation.py b/rotation/simple_rotation.py index 9dde1c3..6e70df3 100644 --- a/rotation/simple_rotation.py +++ b/rotation/simple_rotation.py @@ -505,12 +505,10 @@ class SimpleRotationStrategy: # Signal timing: 9:00 AM on day T # At this moment, T's market has NOT opened yet. # Only T-1 close data is available for all markets. - # So momentum must be computed from T-1 close (prev_date). + # Use calendar day -1 (not A-share prev trading day) so that + # foreign markets (US/HK) that traded during A-share holidays are captured. # Execution happens at 9:30 AM using T's ETF prices. - if i > 0: - signal_date = self.trading_calendar[i - 1] # T-1 close - else: - signal_date = date # First day: no prior trading day available + signal_date = date - timedelta(days=1) new_holdings, factors, bond_momentum = self._generate_signals(signal_date) @@ -826,11 +824,9 @@ class SimpleRotationStrategy: tracked_entry: Dict[str, dict] = {} prev_holdings = [] - # Build date index map for signal_date lookup (T-1) + # Build date index map for signal_date lookup (calendar T-1, not A-share prev trading day) date_list = [pd.Timestamp(rec['date']) for rec in self.daily_records] - date_to_signal_date = {} - for i, d in enumerate(date_list): - date_to_signal_date[d] = date_list[i - 1] if i > 0 else d + date_to_signal_date = {d: d - timedelta(days=1) for d in date_list} for rec in self.daily_records: date = pd.Timestamp(rec['date'])