Educational agentic framework for converting quantitative finance research into backtesting repositories
quant2repo is an open source educational tool designed to help students and researchers understand how to convert quantitative finance research papers into production-ready backtesting repositories. It demonstrates domain-specific applications of Agentic Collective Intelligence (ACI) systems in financial contexts, serving as a specialized engine within the any2repo-gateway ecosystem.
This tool serves educational purposes by helping students and researchers:
Financial-specific validation including:
Built-in catalog of systematic trading strategies covering:
Integration with financial data sources:
Financial performance metrics:
| Feature | Quant2Repo | QuantConnect | Quantopian | Backtrader | Zipline |
|---|---|---|---|---|---|
| Research Paper Input | ✅ Native PDF parsing | ❌ No | ❌ No | ❌ No | ❌ No |
| Strategy Extraction | ✅ LLM-powered | ❌ Manual | ❌ Manual | ❌ Manual | ❌ Manual |
| Bias Detection | ✅ Auto detection | ❌ No | ⚠️ Limited | ❌ No | ❌ No |
| ACI Architecture | ✅ Multi-agent DAG | ❌ Single model | ❌ Single model | ❌ No | ❌ No |
| Multi-Cloud Support | ✅ Token economics | ❌ No | ❌ No | ❌ No | ❌ No |
| Strategy Catalog | ✅ 47 pre-indexed | ⚠️ Community | ⚠️ Community | ❌ No | ❌ No |
| Backtest Validation | ✅ Auto verification | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| Financial Metrics | ✅ Comprehensive | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| Data Persistence | ✅ Iceberg/DuckDB | ⚠️ Cloud DB | ⚠️ Cloud DB | ❌ No | ❌ No |
| Educational Focus | ✅ Learning-oriented | ⚠️ Mixed | ⚠️ Mixed | ❌ Production | ❌ Production |
| Feature | Quant2Repo | TradeIdeas | TrendSpider | Kavout | EquBot |
|---|---|---|---|---|---|
| Research-to-Code | ✅ Core focus | ❌ No | ❌ No | ❌ No | ❌ No |
| Paper-Aware | ✅ Academic context | ❌ No | ❌ No | ❌ No | ❌ No |
| Strategy Extraction | ✅ LLM-powered | ❌ Manual | ❌ Manual | ❌ Manual | ❌ Manual |
| Bias Detection | ✅ Auto detection | ❌ No | ❌ No | ❌ No | ❌ No |
| Explainable AI | ✅ Transparent | ❌ No | ❌ No | ❌ No | ❌ No |
| Open Source | ✅ Apache 2.0 | ❌ Proprietary | ❌ Proprietary | ❌ Proprietary | ❌ Proprietary |
| Custom Strategies | ✅ Any paper | ❌ Pre-built | ❌ Pre-built | ❌ Pre-built | ❌ Pre-built |
| Multi-Asset | ✅ 6 asset classes | ⚠️ Limited | ⚠️ Limited | ⚠️ Limited | ⚠️ Limited |
| Backtesting | ✅ Full pipeline | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| Academic Rigor | ✅ Paper-based | ❌ No | ❌ No | ❌ No | ❌ No |
| Feature | Quant2Repo | Research2Repo | Difference |
|---|---|---|---|
| Domain Focus | ✅ Quantitative Finance | ✅ General CS | Specialized vs General |
| Strategy Extraction | ✅ Financial signals | ✅ General algorithms | Domain-specific logic |
| Bias Detection | ✅ Financial biases | ❌ N/A | Quant-specific validation |
| Strategy Catalog | ✅ 47 strategies | ❌ N/A | Pre-indexed strategies |
| Financial Metrics | ✅ Sharpe, drawdown, etc. | ❌ N/A | Domain-specific metrics |
| Data Sources | ✅ yfinance, FRED | ❌ N/A | Financial data APIs |
| Asset Classes | ✅ 6 classes | ❌ N/A | Equities, crypto, etc. |
| Backtest Focus | ✅ Core feature | ⚠️ Optional | Specialized pipeline |
| ACI Architecture | ✅ Multi-agent DAG | ✅ Multi-agent DAG | Shared foundation |
| Gateway Integration | ✅ any2repo-gateway | ✅ any2repo-gateway | Same orchestration |
# Clone the repository
git clone https://github.com/nellaivijay/quant2repo.git
cd quant2repo
# Install dependencies
pip install -r requirements.txt
# Google Gemini (recommended)
export GEMINI_API_KEY="your_key_here"
# OpenAI GPT-4o
export OPENAI_API_KEY="your_key_here"
pip install openai
# Anthropic Claude
export ANTHROPIC_API_KEY="your_key_here"
pip install anthropic
# Ollama (local models)
ollama pull deepseek-coder-v2
# From research paper URL
python main.py --pdf_url "https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1079975"
# From local PDF file
python main.py --pdf_path ./papers/momentum.pdf
# Agent mode with decomposed planning
python main.py --pdf_url "..." --mode agent
# Agent mode with self-refine loops
python main.py --pdf_url "..." --mode agent --refine
# Agent mode with execution sandbox
python main.py --pdf_url "..." --mode agent --execute
# From strategy catalog
python main.py --catalog time-series-momentum
# List all strategies
python main.py --list-catalog
PDF → [Paper Parser] → [Strategy Extractor] → [Planner] → [Coder] → [Validator] → Repository
PDF → [Paper Parser] → [Strategy Extractor] → [Decomposed Planner] → [Per-File Analyzer]
→ [CodeRAG] → [Context-Managed Coder] → [Test Generator] → [Code Validator]
→ [Backtest Validator] → [Execution Sandbox] → [Auto-Debugger] → [DevOps Generator]
→ [Reference Evaluator] → Repository
Built-in catalog covering multiple asset classes:
quant2repo/
├── main.py # CLI entry point
├── config.py # Global configuration
├── providers/ # Multi-model abstraction
├── core/ # Pipeline stages
│ ├── paper_parser.py
│ ├── strategy_extractor.py
│ ├── planner.py
│ ├── file_analyzer.py
│ ├── coder.py
│ └── validator.py
├── quant/ # Quant-specific modules
│ ├── catalog.py
│ ├── signals.py
│ ├── asset_classes.py
│ ├── metrics.py
│ └── data_sources.py
├── advanced/ # Advanced capabilities
│ ├── backtest_validator.py
│ ├── cache.py
│ ├── executor.py
│ ├── debugger.py
│ ├── evaluator.py
│ ├── devops.py
│ ├── test_generator.py
│ ├── code_rag.py
│ └── context_manager.py
├── agents/ # Multi-agent orchestration
├── prompts/ # Quant-specific prompts
├── catalog/ # Strategy catalog data
└── tests/ # Test suite
Add new strategies to the strategy catalog following existing patterns.
Run the test suite:
pytest tests/
Quant2Repo has been evaluated on 47 systematic trading strategies across multiple asset classes:
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/nellaivijay/quant2repo.git
cd quant2repo
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run tests
pytest tests/
# Run linting
black .
flake8 .
mypy .
To add a new trading strategy to the catalog:
catalog/strategies.jsonIf you use Quant2Repo in your research, please cite:
@article{quant2repo2024,
title={Quant2Repo: Agentic Collective Intelligence for Converting Quantitative Finance Research into Backtesting Repositories},
author={Nella, Vijay},
journal={arXiv preprint arXiv:2024.xxxxx},
year={2024},
url={https://arxiv.org/abs/2024.xxxxx}
}
Quant2Repo is part of the ACI (Agentic Collective Intelligence) ecosystem:
Apache 2.0 License - See LICENSE file for details.
This tool is provided for educational purposes to help students and researchers learn about: