Factor Forge
A modern, reproducible factor zoo replication engine for cross-sectional equity research.
Factor Forge takes the academic "factor zoo" — momentum, value, quality, low-volatility, investment, profitability — and makes it runnable, honest, and ML-ready. It handles transaction costs, survivorship bias, look-ahead bias, factor decay, and walk-forward machine learning.
Mission: Let any researcher or student answer "Does this factor still work after costs?" with net-of-cost Sharpe, turnover analysis, and uncertainty-aware ensembles.
Why this matters
- Quantopian is gone and
zipline/pyfolioare unmaintained. - Most public factor code reports gross returns, ignores transaction costs, and suffers from look-ahead bias.
- Factor Forge reports net-of-cost Sharpe, turnover, capacity, and factor decay in a clean, extensible Python package.
What you can do
- Compute 15+ classic factors with a uniform cross-sectional API.
- Build decile long/short and long-only portfolios with monthly rebalancing.
- Apply a transaction-cost and slippage model to every trade.
- Measure information coefficient (IC), factor decay, turnover, and regime performance.
- Train a walk-forward LightGBM ensemble that combines factors without peeking.
- Add conformal prediction intervals for return forecasts.
- Generate publication-ready plots, interactive HTML research reports, and a Streamlit dashboard.
Quickstart
git clone https://github.com/satyamdas03/factor-forge.git
cd factor-forge
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
Or install from PyPI:
pip install factor-forge-quant
Run a backtest on a single factor using cached or Polygon data:
export POLYGON_API_KEY=your_key_here
factor-forge --factor momentum_12_1 --start 2015-01-01 --end 2024-01-01
Generate an HTML research report:
ff-report --factor momentum_12_1 --start 2015-01-01 --end 2024-01-01 --output reports
Launch the interactive dashboard:
pip install "factor-forge-quant[dashboard]"
ff-dashboard
Or from Python:
from factor_forge import BacktestEngine, DataLoader
from factor_forge.factors.registry import FactorRegistry
loader = DataLoader(source="polygon", api_key="your_key")
prices = loader.load_eod(["AAPL", "MSFT", "GOOGL"], start="2015-01-01", end="2024-01-01")
registry = FactorRegistry()
registry.load_builtin()
factor = registry.get("momentum_12_1")
engine = BacktestEngine(factor=factor, prices=prices, transaction_cost_bps=10.0)
result = engine.run()
print(result.metrics)
Factor library
| Category | Factors |
|---|---|
| Momentum | momentum_12_1, momentum_52_high, residual_momentum |
| Value | pe_ratio, pb_ratio |
| Quality | roe, gross_margin, accruals |
| Low volatility | idiosyncratic_volatility, beta, max_drawdown |
| Investment | asset_growth, capex_growth |
| Profitability | gross_profits_to_assets |
Each factor is a pure function prices / fundamentals → cross-sectional score. Adding a new factor is one function + one registry entry.
Architecture
factor_forge/
├── data/ # Data sources, loader, cache, survivorship handling
├── factors/ # Factor definitions and registry
├── backtest/ # Portfolio, cost model, decile engine
├── analytics/ # Metrics, IC, decay, turnover, regimes, correlations
├── ml/ # Walk-forward features, LightGBM ensemble, conformal prediction
├── viz/ # Publication-ready plots
├── cli/ # Command-line tools
└── docs/ # MkDocs site + blog
Roadmap
| Version | Goal | Status |
|---|---|---|
| v0.1.0 | Data pipeline + 5 core factors + decile backtest | ✅ |
| v0.2.0 | 15+ factors + transaction costs + analytics | ✅ |
| v0.3.0 | Factor decay, turnover, regime analysis | ✅ |
| v0.4.0 | ML ensemble + conformal prediction | ✅ |
| v0.5.0 | Dashboard + research report generation | ✅ |
Documentation
Full documentation, API reference, and research blog are at:
https://satyamdas03.github.io/factor-forge/
Interview talking points
- "Most retail factor backtests report gross returns. Factor Forge reports net-of-cost Sharpe and turnover-adjusted returns."
- "I handle delisting and point-in-time fundamentals to avoid look-ahead bias."
- "I found momentum still works but turnover is high; low-vol is crowded and decayed post-2020."
- "I combined factors with a walk-forward LightGBM ensemble and added conformal prediction intervals for risk."
License
MIT © Satyam Das
Metadata
Release files for factor-forge-quant 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| factor_forge_quant-0.5.0.tar.gz | 42.3 kB | Without provenance | Details for factor_forge_quant-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| factor_forge_quant-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for factor_forge_quant-0.5.0-py3-none-any.whl |
Total release size: 93.0 kB
Release files / factor_forge_quant-0.5.0.tar.gz
| Download URL | factor_forge_quant-0.5.0.tar.gz |
|---|---|
| Size | 42.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8325f885ecc182155e10ab0495dce702669e3ed7e5f551e42177f07668655a1f
|
|
BLAKE2b-256 checksum How to use checksums |
1a8f09448dcdc605dc4c902ed08ff7738c8afc2624a796941e652288e60b036f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / factor_forge_quant-0.5.0-py3-none-any.whl
| Download URL | factor_forge_quant-0.5.0-py3-none-any.whl |
|---|---|
| Size | 50.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
058779f67a5ba1ce9a8087901fcf6d5f970b84afb35d76a0d597417f52333933
|
|
BLAKE2b-256 checksum How to use checksums |
1e5870f54a3d005457b68a5f0f48c14c97a9640aa80902b631a18813adda13b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for factor-forge-quant 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.