npx claudepluginhub brainbytes-dev/everything-claude-tradingThis skill uses the workspace's default tool permissions.
name: factor-models
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
name: factor-models description: Factor model construction and analysis — Fama-French, Carhart, Barra, custom factors. Use when building or analyzing factor-based strategies.
CAPM posits a single market factor explains all cross-sectional return variation. The empirical failure of CAPM led to multi-factor extensions:
Portfolio Sort Method (Fama-French style):
Cross-Sectional Regression (Barra style):
Step 1: Define hypothesis — WHY should this characteristic predict returns?
Step 2: Source point-in-time data (avoid survivorship and look-ahead bias)
Step 3: Compute factor exposures for each security at each rebalancing date
Step 4: Winsorize exposures at 3 standard deviations
Step 5: Neutralize sector and country effects (regression or demeaning)
Step 6: Standardize to z-scores (mean 0, std 1)
Step 7: Construct long-short portfolio (top decile - bottom decile)
Step 8: Evaluate: IC, IC_IR, turnover, capacity, drawdown
| Metric | Good Threshold | Excellent Threshold |
|---|---|---|
| Information Coefficient (IC) | > 0.02 | > 0.05 |
| IC Information Ratio (IC_IR) | > 0.10 | > 0.25 |
| Annual Sharpe (long-short) | > 0.3 | > 0.7 |
| Monthly turnover | < 30% | < 15% |
| Hit rate (% positive months) | > 52% | > 55% |
Factor crowding occurs when too much capital chases the same factor exposure, compressing future returns and amplifying drawdowns.
Signals of crowding:
Crowding mitigation:
Factor timing is the attempt to dynamically allocate across factors based on macro conditions, valuations, or momentum signals:
Caveat: Factor timing is difficult. Most academic studies find limited out-of-sample evidence. A blend of factors typically dominates timing.
Model: R_portfolio - R_f = alpha + beta_MKT * (R_MKT - R_f) + beta_SMB * SMB + beta_HML * HML + epsilon
Interpretation:
- alpha > 0 and statistically significant: genuine skill
- beta_MKT: market exposure (should be ~1 for equity portfolio)
- beta_SMB > 0: small-cap tilt; < 0: large-cap tilt
- beta_HML > 0: value tilt; < 0: growth tilt
- R-squared: fraction of return variance explained by factors
[ ] Economic rationale documented
[ ] Point-in-time data sourced (no look-ahead)
[ ] Survivorship bias addressed
[ ] Universe defined (liquidity filters, market cap cutoffs)
[ ] Exposures winsorized and standardized
[ ] Sector/country neutralization applied
[ ] Long-short portfolio constructed
[ ] Transaction cost analysis performed
[ ] Out-of-sample test window reserved
[ ] Correlation with known factors measured
[ ] Capacity estimate provided
Portfolio Factor Exposure Report — [Date]
Factor | Exposure (z) | Factor Return (bps) | Contribution (bps)
Market | 1.05 | +120 | +126
Size (SMB) | -0.30 | +45 | -13.5
Value (HML) | +0.80 | -30 | -24.0
Momentum | +0.15 | +60 | +9.0
Quality | +0.50 | +25 | +12.5
Residual | — | — | +18.0
Total Portfolio Return: +128.0 bps
Factor-Explained: +110.0 bps | Residual (Alpha): +18.0 bps
Before deploying a factor model or factor-based strategy, confirm: