Evaluate weights against next-period returns to avoid look-ahead

Weights formed from close[t] now earn the t→t+1 return: forward returns
are computed on the full market calendar before selecting signal dates,
so a sparse signal grid earns the next available return rather than the
next signal date, and the final signal date (no forward return) is
dropped. Signal pct_change uses fill_method=None so suspended names do
not inherit stale prices.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Yuxuan Yan
2026-06-11 17:39:55 +08:00
parent 534b91aaa4
commit 0a6f367fbf
7 changed files with 150 additions and 22 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ class ReversalAlpha(BaseAlpha):
self.lookback = lookback
def signal(self, close: pd.DataFrame) -> pd.DataFrame:
return -close.pct_change(self.lookback)
return -close.pct_change(self.lookback, fill_method=None)