Issue #1027 — Phase 1 complete : portefeuille agrege des 8 sous-stratégies (5 IBKR equities + 3 Binance crypto), matrice de correlation des returns mensuels, Sharpe net / MaxDD du blend après couts de transaction. Complete le sleeve crypto livre dans research.ipynb (#1179) en ajoutant le sleeve equities et l’analyse cross-sleeve.
Composition cible (cf README.md)
Sleeve
Sous-stratégie
Poids sleeve
Poids portefeuille
IBKR 50%
Framework_Composite_TrendWeather
30%
15.0%
IBKR 50%
Framework_Composite_EMATrend
25%
12.5%
IBKR 50%
SectorMomentum
20%
10.0%
IBKR 50%
AllWeather v5
15%
7.5%
IBKR 50%
EMA-Cross-Alpha
10%
5.0%
Binance 50%
EMA-Cross-Crypto
50%
25.0%
Binance 50%
Crypto-MultiCanal
30%
15.0%
Binance 50%
HAR-RV-J vol-target BTC
20%
10.0%
Methodologie et caveats (honnetete)
Chaque sous-stratégie est modelisee comme un proxy recherche : règles de signal journalieres reproduisant la logique de la stratégie du depot (pas le code exact du backtest QC). Le backtest unifie exact via le framework QC (MultiAlphaModel) est l’objet de la Phase 2.
Pas de lookahead : poids decides en t-1, appliques au return t (shift(1)).
Couts de transaction par notionnel traite (un sens) : equities 10 bps (5 fee IBKR + 5 slippage), crypto 15 bps (10 fee Binance + 5 slippage). Rebalancement mensuel inter-stratégies facture en sus.
Periode commune limitee par les données Binance sur QC (debut ~2020-08) : l’analyse couvre ~2020-11 -> 2025-12 (~62 mois), incluant le bear 2022 et la reprise 2023-2025. Le COVID crash 2020 n’est PAS couvert pour le blend complet (caveat majeur, cf Phase 2 backtest 2018+ pour les equities).
Metriques calculees sur returns mensuels (rebalancement mensuel) : le MaxDD mensuel sous-estime le MaxDD intraday/journalier.
HAR-RV-J vol-target plafonne a 1.0 (spot Binance, pas de levier).
from AlgorithmImports import*import numpy as npimport pandas as pdfrom itertools import combinationsqb = QuantBook()EQUITY_TICKERS = ['SPY', 'IEF', 'GLD', 'XLP', 'XLK', 'XLF', 'XLE', 'XLV', 'XLY', 'XLI', 'XLB', 'XLU']SECTOR_TICKERS = ['XLK', 'XLF', 'XLE', 'XLV', 'XLY', 'XLI', 'XLB', 'XLU', 'XLP']CRYPTO_TICKERS = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'ADAUSDT', 'LTCUSDT', 'XRPUSDT']equity_symbols = {t: qb.add_equity(t, Resolution.DAILY).symbol for t in EQUITY_TICKERS}crypto_symbols = {t: qb.add_crypto(t, Resolution.DAILY, Market.Binance).symbol for t in CRYPTO_TICKERS}print(f'Equity assets loaded: {len(equity_symbols)} | Crypto assets loaded: {len(crypto_symbols)}')
Matrice de correlation des returns mensuels (8 x 8)
Cible #1027 : correlation moyenne inter-stratégies < 0.3 sur le portefeuille complet. Aggregation mensuelle par PeriodIndex (agnostique aux conventions de timestamps equity NY vs crypto UTC).
def to_monthly(daily): g = daily.dropna().groupby(daily.dropna().index.to_period('M')).apply(lambda x: (1.0+ x).prod() -1.0)return gmdf = pd.DataFrame({name: to_monthly(r) for name, r in net_daily.items()})mdf = mdf[IBKR_STRATS + CRYPTO_STRATS].dropna()print(f'Monthly observations: {len(mdf)} months ({mdf.index[0]} -> {mdf.index[-1]})')print()corr = mdf.corr()print('Monthly returns correlation matrix (net of costs):')print(corr.round(3).to_string())def avg_upper(c): vals = [c.iloc[i, j] for i, j in combinations(range(len(c)), 2)]returnfloat(np.mean(vals))rho_all = avg_upper(corr)rho_ibkr = avg_upper(corr.loc[IBKR_STRATS, IBKR_STRATS])rho_crypto = avg_upper(corr.loc[CRYPTO_STRATS, CRYPTO_STRATS])rho_cross =float(corr.loc[IBKR_STRATS, CRYPTO_STRATS].values.mean())print()print(f'Average pairwise correlation (all 8): {rho_all:.3f} (target < 0.3)')print(f' intra-IBKR sleeve (5 strats): {rho_ibkr:.3f}')print(f' intra-Binance sleeve (3 strats): {rho_crypto:.3f}')print(f' cross-sleeve (IBKR x Binance): {rho_cross:.3f}')
Blend mensuel avec rebalancement aux poids cibles chaque fin de mois. Le cout de rebalancement inter-stratégies est estime par la derive des poids (sum |w_cible - w_derive| x 12.5 bps moyens) en sus des couts intra-stratégie déjà deduits.
Pont vers la Phase 2 — MultiAlphaModel (framework QC)
Le backtest unifie exact (Phase 2, main.py) assemble les 8 sous-stratégies via le framework QC :
Sous-stratégie
Alpha model Phase 2
Insight
TrendWeather
TrendWeatherAlpha (SMA200 + filtre vol)
SPY/IEF/GLD directionnel
EMATrend
EmaCrossAlphaModel(50, 200)
SPY vs IEF
SectorMomentum
SectorMomentumAlpha (top-3 / 126j)
ETFs sectoriels
AllWeather
ConstantAlpha poids statiques
SPY/IEF/GLD/XLP
EMA-Cross-Alpha
EmaCrossAlphaModel(20, 50)
SPY
EMA-Cross-Crypto
EmaCrossAlphaModel(20, 50)
BTCUSDT
Crypto-MultiCanal
ConstantAlpha equipondere
6 cryptos
HAR-RV-VolTarget
VolTargetAlpha (RV 22j -> scaling)
BTCUSDT
Assemblage : self.add_alpha(...) x8 + InsightWeightingPortfolioConstructionModel avec les poids cibles ci-dessus, rebalancement mensuel, InteractiveBrokersBrokerageModel (sleeve equity) et fees Binance (sleeve crypto). Les poids et la structure sont déjà refletes dans main.py (squelette).
print('='*72)print('PORTFOLIO HYBRIDE IBKR+BINANCE — PHASE 1 SUMMARY (#1027)')print('='*72)print(f'Period analyzed : {mdf.index[0]} -> {mdf.index[-1]} ({len(mdf)} months)')print(f'Sub-strategies : {len(mdf.columns)} (5 IBKR equities + 3 Binance crypto)')print()blend = stats_m(blend_net, 'net')checks = [ ('Sharpe net 1.0 - 1.3', f"{blend['Sharpe']:.3f}", 1.0<= blend['Sharpe'] <=1.3,'above'if blend['Sharpe'] >1.3else ('below'if blend['Sharpe'] <1.0else'in range')), ('MaxDD ~ -22% (monthly)', f"{blend['MaxDD']:.1%}", blend['MaxDD'] >=-0.25, ''), ('rho_avg < 0.3 (8 strats)', f'{rho_all:.3f}', rho_all <0.3, ''),]print(f'{"Target":<28}{"Actual":>10}{"Verdict":>10}')for label, actual, ok, note in checks: verdict ='PASS'if ok else'FAIL'print(f'{label:<28}{actual:>10}{verdict:>10}{note}')print()print(f'Cross-sleeve correlation (diversification engine): {rho_cross:.3f}')print(f'Blend net CAGR {blend["CAGR"]:.1%}, AnnVol {blend["AnnVol"]:.1%}, Calmar {blend["Calmar"]:.2f}')print()print('Honest caveats:')print(' - Sub-strategies are research PROXIES of the repo strategies, not the exact QC backtests.')print(' - Common window starts 2020-11 (Binance data on QC): no COVID-crash coverage for the blend.')print(' - Monthly MaxDD understates daily/intraday drawdowns.')print(' - In-sample rule parameters inherited from the catalog: expect 20-30% live discount.')print()print('Phase 2 next: unified QC framework backtest (MultiAlphaModel) 2018-2025,')print('walk-forward annual + allocation sweep 60/40-40/60, per pr-review-discipline section C.')
========================================================================
PORTFOLIO HYBRIDE IBKR+BINANCE — PHASE 1 SUMMARY (#1027)
========================================================================
Period analyzed : 2018-08 -> 2025-12 (89 months)
Sub-strategies : 8 (5 IBKR equities + 3 Binance crypto)
Target Actual Verdict
Sharpe net 1.0 - 1.3 0.899 FAIL below
MaxDD ~ -22% (monthly) -31.8% FAIL
rho_avg < 0.3 (8 strats) 0.337 FAIL
Cross-sleeve correlation (diversification engine): 0.189
Blend net CAGR 22.0%, AnnVol 25.7%, Calmar 0.69
Honest caveats:
- Sub-strategies are research PROXIES of the repo strategies, not the exact QC backtests.
- Common window starts 2020-11 (Binance data on QC): no COVID-crash coverage for the blend.
- Monthly MaxDD understates daily/intraday drawdowns.
- In-sample rule parameters inherited from the catalog: expect 20-30% live discount.
Phase 2 next: unified QC framework backtest (MultiAlphaModel) 2018-2025,
walk-forward annual + allocation sweep 60/40-40/60, per pr-review-discipline section C.