How maxzcodes/zeghers-multifactor-thesis works
This repository is a research pipeline for evaluating characteristic-based stock-selection strategies on a US equity universe. Its main workflow fetches licensed market and fundamentals data, builds and ranks monthly characteristics, forms portfolios, and evaluates gross/net returns, factor exposures, and benchmarks before exporting thesis tables and charts. The graph combines the documented stage sequence with sampled implementation details; unsampled modules are represented only where the README documents their role.
Main entry points: 06_performance_gross.py Gross performance · results Strategy results · data Strategy labels · 03_rank_select.py Rank and select
Components 33
Data ingestion
- RIC universe
ric_mapping.csv - Fetch prices
src/00_fetch_prices.py - Fetch fundamentals
src/00_fetch_fundamentals.py - Monthly price panel
data - Annual fundamentals
data - Clean fundamentals
src/01_clean_fundamentals.py
Signal construction
- Build characteristics
src/02_build_characteristics.py - Characteristics panel
data - Rank and select
src/03_rank_select.py - Strategy labels
data - Freeze TW weights
src/04_freeze_tw_weights.py - Score composites
src/04_score_composite_ewcw.py - Score TSMV composites
src/04_score_composite_tsmv.py
Portfolio evaluation
- Form portfolios
src/05_portfolio_ls.py - Long-only portfolios
src/05_portfolio_lo.py - Gross performance
src/06_performance_gross.py - Transaction costs
src/07_transaction_costs.py
Statistical analysis
- FF factors
data/ff_factors - FF6 regressions
src/08_ff6_full.py - Rolling FF6
src/08_ff6_rolling.py - Subperiod FF6
src/08_ff6_subperiod.py - Benchmark analysis
src/09_benchmark.py - SPY returns
data/benchmarks/spy_tr_monthly.csv - Strategy results
data/results - Export thesis tables
src/10_export_tables.py - Generate charts
src/10_generate_charts.py - Research question tables
data/results/research_questions
Shared analysis layer
- Signal preprocessing
src/thesis/preprocessing.py - Ranking methods
src/thesis/ranking.py - Performance metrics
src/thesis/performance.py - Regression methods
src/thesis/regression.py
Other components
- Researcher
- LSEG Workspace
Connections 48
- Researcher → Fetch prices: runs fetch
- Researcher → Fetch fundamentals: runs fetch
- RIC universe → Fetch prices: provides RICs
- RIC universe → Fetch fundamentals: provides RICs
- Fetch prices → LSEG Workspace: requests prices
- Fetch fundamentals → LSEG Workspace: requests fundamentals
- Fetch prices → Monthly price panel: writes panel
- Fetch fundamentals → Annual fundamentals: writes panel
- Annual fundamentals → Clean fundamentals: reads panel
- Clean fundamentals → Build characteristics: supplies fundamentals
- Monthly price panel → Build characteristics: supplies prices
- Build characteristics → Signal preprocessing: uses transforms
- Build characteristics → Characteristics panel: writes panel
- Characteristics panel → Rank and select: reads signals
- Rank and select → Ranking methods: uses selection
- Rank and select → Strategy labels: writes labels
- Strategy labels → Freeze TW weights: feeds first pass
- Freeze TW weights → Score composites: supplies frozen weights
- Strategy labels → Score composites: supplies ranked signals
- Strategy labels → Score TSMV composites: supplies ranked signals
- Score composites → Rank and select: adds composite scores
- Score TSMV composites → Rank and select: adds composite scores
- Strategy labels → Form portfolios: forms holdings
- Strategy labels → Long-only portfolios: forms holdings
- Form portfolios → Gross performance: provides returns
- Long-only portfolios → Gross performance: provides returns
- Gross performance → Performance metrics: uses metrics
- Gross performance → Transaction costs: provides gross inputs
- Transaction costs → Performance metrics: uses metrics
- Gross performance → Strategy results: writes gross results
- Transaction costs → Strategy results: writes net results
- FF factors → FF6 regressions: provides factors
- FF factors → Rolling FF6: provides factors
- FF factors → Subperiod FF6: provides factors
- Gross performance → FF6 regressions: provides returns
- Gross performance → Rolling FF6: provides returns
- Gross performance → Subperiod FF6: provides returns
- FF6 regressions → Regression methods: uses regressions
- Rolling FF6 → Regression methods: uses regressions
- Subperiod FF6 → Regression methods: uses regressions
- FF6 regressions → Strategy results: writes factor results
- Rolling FF6 → Strategy results: writes rolling results
- Subperiod FF6 → Strategy results: writes subperiod results
- FF factors → Benchmark analysis: provides factors
- SPY returns → Benchmark analysis: provides yardstick
- Gross performance → Benchmark analysis: provides returns
- Benchmark analysis → Strategy results: writes comparisons
- Strategy results → Export thesis tables: reads analysis