feat: US 3-sleeve portfolio and lowrisk_top20; US portfolio research harness
Register two live strategies from the 2026-09-29 US research: - lowrisk_top20: idiosyncratic vol + low beta, top 20, monthly, buffer 2 (new `low_risk` signal in strategies/robust_momentum.py) - us_three_sleeve: 1/3 each of overnight_recovery_top10, lowrisk_top20 and trend_rider_v7_vt24 in one account (strategies/sleeve_portfolio.py, a mixed stock+ETF strategy). Sleeve shares drift with their returns and reset at a month start once any is >25% off its share. Research (research/lab, S&P 500 PIT, next-open fills): - rotation.py / persistence.py: walk-forward factor weighting (factor momentum, rolling IC, market state) and last-year's-winner selection do not beat a fixed composite - us_sweep.py: holdings count, z/vol weights, dynamic N, tranching and market overlays (Faber SMA, de-risk vol target, statistical jump model, momentum state); engine.py gains zvol weighting and dyn_n - fetch_us_fundamentals.py / fundamentals.py / fund_eval.py: SEC EDGAR point-in-time fundamentals (first-filed values) and factor tests - trend_rider_long.py / us_final.py: 2010-2026 TrendRider curves and the 3-sleeve check (2011-2026 Sharpe 1.21, CAGR 21.9%, MaxDD -23%) Web-UI engine, 2017-09..2026-09, $2/order: us_three_sleeve CAGR 28.9%, Sharpe 1.49, MaxDD -24.8%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,10 @@ Signals:
|
||||
lowrisk_momentum (CN) amplitude-cut momentum + low beta
|
||||
+ negative price-volume correlation + momentum/vol
|
||||
lowbeta_sharpe_mom (CN) low beta + momentum/vol (close prices only)
|
||||
low_risk (US) low idiosyncratic volatility + low beta (close only);
|
||||
the defensive sleeve of the 2026-09-29 US portfolio
|
||||
research, meant to be held next to overnight_recovery
|
||||
and trend_rider_v7_vt24 (monthly correlation 0.2-0.4)
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
@@ -68,6 +72,17 @@ def low_beta(close: pd.DataFrame, window: int = 252) -> pd.DataFrame:
|
||||
return -(e_xy - e_x.mul(e_y, axis=0)).div(var_y, axis=0)
|
||||
|
||||
|
||||
def idiosyncratic_vol(close: pd.DataFrame, beta_window: int = 252,
|
||||
vol_window: int = 63) -> pd.DataFrame:
|
||||
"""Negative 63-day volatility of returns net of the equal-weight market
|
||||
times a trailing (lagged) 252-day beta; Ang, Hodrick, Xing & Zhang (2006)."""
|
||||
r = _returns(close)
|
||||
m = r.mean(axis=1).fillna(0.0)
|
||||
beta = -low_beta(close, beta_window).shift(1)
|
||||
resid = r - beta.mul(m, axis=0)
|
||||
return -resid.rolling(vol_window, min_periods=40).std()
|
||||
|
||||
|
||||
def price_volume_corr(close: pd.DataFrame, volume: pd.DataFrame) -> pd.DataFrame:
|
||||
"""Negative 21-day correlation of price and dollar volume."""
|
||||
return -close.ffill().rolling(21, min_periods=15).corr(close * volume)
|
||||
@@ -115,11 +130,17 @@ def signal_lowbeta_sharpe_mom(bars):
|
||||
return _composite(low_beta(c), sharpe_momentum(c))
|
||||
|
||||
|
||||
def signal_low_risk(bars):
|
||||
c = bars["close"]
|
||||
return _composite(idiosyncratic_vol(c), low_beta(c))
|
||||
|
||||
|
||||
# name -> (bar fields, score function)
|
||||
SIGNALS = {
|
||||
"overnight_recovery": (("close", "open"), signal_overnight_recovery),
|
||||
"lowrisk_momentum": (("close", "high", "low", "volume"), signal_lowrisk_momentum),
|
||||
"lowbeta_sharpe_mom": (("close",), signal_lowbeta_sharpe_mom),
|
||||
"low_risk": (("close",), signal_low_risk),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user