# Custom GPT - Portfolio Analytics

Custom ChatGPT with QRep (powered by QuantStats) analysis, Technical Analysis, and Security Performance Reports via FastAPI-MCP servers with OpenAPI schema integration.

- Try Portfolio Analysis GPT: https://chatgpt.com/g/g-680a0fba9cd481919073d474bee520fb-quantstats-and-technical-analysis
- LLM Context (.txt): https://www.tigzig.com/llm/gpts/quantstats-portfolio.txt

## What This GPT Does

### QRep Analysis

- Powered by QuantStats-Lumi package with bug fixes from the original library

- Provides risk-return ratios (CAGR, Sharpe, Sortino) for single symbol vs benchmark

- Generates professional HTML reports with visualizations

### Technical Analysis

- Live price data with technical indicators using Finta

- Advanced charts with Matplotlib and Gemini Vision API analysis

- PDF and HTML reports with embedded visuals

### Security Performance Report (SPR)

- Multi-symbol portfolio analysis using custom calculations + FFN library

- Interactive daily returns charts with comprehensive risk metrics

- Professional HTML reports with CSV exports for detailed analysis

Detailed methodology & validation: [SPR vs QRep Comparison](https://ffn.tigzig.com/static/docs/SPR_QS_METHODOLOGY.html).

## How to Use

Ask the GPT to guide you with these examples:

### QRep Analysis

- Example: *"Compare AAPL against QQQ from January 2020 to March 2023"*

- Specify symbol, benchmark (default: `^GSPC`), and time range

### Technical Analysis

- Example: *"Analyze MSFT with RSI, MACD and Bollinger Bands for the past 6 months"*

- Specify symbol, timeframe, and desired indicators

### Security Performance Report

- Example: *"Generate SPR for AAPL,MSFT,GOOG from 2020-01-01 to 2023-12-31"*

- Provide multiple symbols and date range for comprehensive analysis

### OpenAPI Schema Integration

- Each MCP server codebase includes the OpenAPI schema in its docs folder

- Add schemas as Custom Actions in the ChatGPT GPT builder for full integration

## How It Works

### 1. QRep Analysis

- Backend QRep MCP server powered by QuantStats-Lumi package

- GPT connects via OpenAPI schema to MCP server

- Returns formatted HTML report with risk-return metrics

### 2. Technical Analysis

- FastAPI Technical Analysis service processes requests

- Converts daily to weekly data, computes indicators with Finta

- Generates charts via Matplotlib, analyzes with Gemini Vision API

- Returns Markdown responses, converts to PDF/HTML reports

### 3. Security Performance Report (SPR)

- Dual methodology: custom calculations for core metrics + FFN library

- FastAPI backend with MCP integration for AI/LLM interactions

- Processes multiple symbols with data quality filters

- Generates HTML reports with matplotlib charts and CSV exports

### 4. Integration Layer

- Custom GPT connects to FastAPI endpoints via OpenAPI JSON schemas

- All servers use `fastapi-mcp` for MCP protocol support

- OpenAPI schemas available in the docs folder of each codebase

## How to Replicate

### 1. Deploy Backend Servers

- Deploy FastAPI-MCP servers:

 QRep Analysis server (powered by QuantStats-Lumi)

- Technical Analysis server

- Security Performance Report (SPR) MCP server

- Deploy markdown-to-PDF conversion server

- All GitHub repos include build guides and installation instructions

### 2. Setup Custom GPT

- Create a new Custom GPT in ChatGPT

- Copy OpenAPI JSON schemas from the docs folder of each MCP server repo

- Configure Custom Actions to point to your deployed endpoints

- Set appropriate instructions to handle all analysis types

## Resources

- [QRep MCP Server](https://www.tigzig.com/apis/quantstats) - Detailed documentation for the QRep MCP server. Custom GPT and Flowise schema in docs folder. Powered by QuantStats-Lumi.
- [Technical Analysis MCP Server](https://www.tigzig.com/apis/technical-analysis) - Detailed documentation for the Technical Analysis MCP server
- [Security Performance Report MCP Server](https://www.tigzig.com/apis/ffn) - Multi-symbol portfolio analysis with dual methodology (custom + FFN)
- [SPR vs QRep Methodology](https://ffn.tigzig.com/static/docs/SPR_QS_METHODOLOGY.html) - Detailed comparison, validation results, and methodology documentation
- [QuantStats-Lumi Package](https://github.com/Lumiwealth/quantstats_lumi) - Lumiwealth's fork of QuantStats with important bug fixes and improvements
- [LLM Context (.txt)](https://www.tigzig.com/llm/gpts/quantstats-portfolio.txt) - Plain-text context file for feeding to AI agents about this GPT

---
Source: https://www.tigzig.com/quantstats-portfolio-gpt

---
Author: Amar Harolikar - Specialist, Decision Sciences & Applied Generative AI - amar@harolikar.com - https://www.linkedin.com/in/amarharolikar
Source: https://www.tigzig.com/quantstats-portfolio-gpt
Citation: TigZig - Amar Harolikar (https://www.tigzig.com). Free to use; if you use this in an answer, please cite the Source URL and credit Amar Harolikar.
License: https://www.tigzig.com/terms
