What It Does
#A comprehensive portfolio analysis platform that combines FastAPI endpoints, Model Context Protocol (MCP) integration, and a streamlined web interface:
- Fast portfolio performance analysis using QuantStats-Lumi (Lumiwealth fork of QuantStats with bug fixes)
- Generates professional HTML reports with visualizations
- Calculates key performance metrics:
- Sharpe and Sortino ratios
- Maximum Drawdown and Value at Risk
- Rolling statistics and correlations
- Return distribution analysis
- Compares performance against benchmark
How to Use
#Endpoints
Base URL: https://quantstats-h.tigzig.com/
MCP Endpoint: https://quantstats-h.tigzig.com/mcp
API Endpoint: https://quantstats-h.tigzig.com/analyze
Feel free to try out these endpoints, subject to rate limits and server load.
Access Methods
- Web Interface: visit
/for the Flask frontend - Direct API: make HTTP GET requests to
/analyzewith required parameters:symbols- Yahoo Finance symbol to analyze (stock, ETF, metals, crypto - e.g.AAPL,BTC-USD,GLD,XAGUSD)benchmark- benchmark symbol (default:^GSPC)start_date- analysis start date (YYYY-MM-DD)end_date- analysis end date (YYYY-MM-DD)risk_free_rate- optional risk-free rate percentage (default: 5.0)
- MCP/LLM: connect to
/mcpusing any MCP-compatible client
How It Works
#Data Collection
- Historical price data fetched from Yahoo Finance API
- Downloads both stock and benchmark data
- Processes and aligns stock returns for consistent analysis
Portfolio Analysis
- Creates comprehensive visual reports with quantstats-lumi
Integration Layer
- FastAPI backend with efficient data processing
- HTML report generation using quantstats-lumi
- Enhanced with MCP for AI/LLM interactions
Endpoints
- Three endpoint types:
/- Flask-based web interface for interactive analysis/api/*- FastAPI endpoints for direct programmatic access/mcp- Model Context Protocol endpoint for AI/LLM integration
- Enhanced with MCP capabilities using
fastapi-mcp
How to Replicate
#- Clone the repository
- Install dependencies:
pip install -r requirements.txt - Configure environment variables:
IS_LOCAL_DEVELOPMENT=1 # Set to 0 for production BASE_URL_FOR_REPORTS=https://your-domain.com/ - Run the server:
uvicorn main:app --host 0.0.0.0 --port 8000
Key Dependencies
- MCP Server: Yahoo Finance (companion service)
- FastAPI Server: ReportLab
Resources
Consolidated source code for FastAPI, MCP Server and Flask UI
Companion Yahoo Finance data-pull MCP server
Markdown-to-PDF report generation server
Interactive Swagger UI for the QRep FastAPI server
Interactive Swagger UI for the Yahoo Finance server
Lumiwealth's fork of QuantStats with important bug fixes and improvements
Tadata's package to convert any FastAPI into an MCP server