AI-FIRST SITE | AI agents & coders: fetch tigzig.com/llms.txt for structured data

MCP Server: Security Performance Report

Professional FastAPI and MCP server for comprehensive portfolio reporting using dual methodology: custom performance calculations validated against QuantStats combined with FFN library analytics, delivering formatted HTML reports and CSV exports.

GitHub Repo Talk to AI Agent Portfolio Suite Custom GPT Agent (Flowise UI) Excel (xlwings Lite)

What It Does

#

A portfolio reporting tool using dual calculation methodology, combining custom performance calculations with FFN library analytics. FastAPI endpoints, Model Context Protocol (MCP) integration, and a clean web interface:

  • Dual methodology: custom calculations for core metrics + FFN library for comprehensive analytics
  • Core performance metrics (Total Return, CAGR, Sharpe, Sortino) use custom implementations based on QuantStats methodology
  • Additional analytics (drawdowns, monthly returns, statistical analysis) powered by FFN
  • Selective validation against QuantStats for key performance metrics
  • Professional HTML reports with TIGZIG AI branding and matplotlib visualizations
  • Exports multiple CSV files with detailed data for further analysis

Methodology Detail

Full methodology, validation results and calculation details: SPR vs QuantStats Comparison.

How to Use

#

Endpoints

Base URL: https://ffn.tigzig.com/ MCP Endpoint: https://ffn.tigzig.com/mcp API Endpoint: https://ffn.tigzig.com/analyze

Feel free to try out these endpoints, subject to rate limits and server load.

Access Methods

  • Web Interface: visit / for the clean web form
  • Direct API: make HTTP POST requests to /analyze with required parameters:
    • symbols - comma-separated Yahoo Finance symbols (e.g. AAPL,MSFT,GOOG)
    • 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: 0.0)
  • MCP/LLM: connect to /mcp using any MCP-compatible client

How It Works

#

Dual Calculation Methodology

Core Performance Metrics: custom implementations based on QuantStats methodology for Total Return, CAGR, Sharpe, and Sortino ratios. Additional Analytics: FFN library for drawdown analysis, monthly returns, and statistical metrics. Historical price data sourced from Yahoo Finance with preprocessing applied including removal of zero/NaN values and date alignment.

Validation & Accuracy

Selective validation against QuantStats library shows: perfect matches for Total Return (100%) and CAGR (100%), near-perfect matches for Sharpe (97%+) and Sortino (97%+) ratios. The 3% variance is attributed to data quality filters and precision differences.

Integration & Output

  • FastAPI backend with efficient dual-methodology processing
  • Professional HTML reports with matplotlib charts and TIGZIG AI branding
  • 6 different CSV files: price data, returns, correlations, and statistics
  • MCP protocol integration for AI/LLM interactions

How to Replicate

#
  1. Clone the repository: shared-fastapi-mcp-ffn (now SPR - Security Performance Report)
  2. Create virtual environment and install dependencies
  3. Configure environment variables for development/production
  4. Run the FastAPI server with uvicorn

Key Dependencies

  • Custom calculation engine - core performance metrics
  • FFN library - additional analytics and drawdown analysis
  • FastAPI - high-performance web framework
  • yfinance - Yahoo Finance data integration
  • fastapi-mcp - Model Context Protocol integration

Detailed methodology, calculations, and validation results are documented in the GitHub repository README and the SPR vs QuantStats methodology comparison.

Resources

Fine Print: This is for informational purposes only and should not be considered as investment advice. Dual methodology: core performance metrics (Total Return, CAGR, Sharpe, Sortino) calculated using custom implementations based on QuantStats methodology, while additional analytics are powered by the open-source FFN library. Selective validation against QuantStats shows 97%+ accuracy for key metrics, with perfect matches for Total Return and CAGR. Input data sourced from Yahoo Finance with preprocessing applied. For multi-security analysis, date mismatches due to differing exchange calendars are forward-filled for up to five days - an industry-accepted practice with minimal impact on results. For complete methodology, validation results, and detailed explanations of any variations, see the SPR vs QuantStats methodology comparison and the linked GitHub repository. Always validate outputs.
Bugs,issues,questions? Drop a note: [email protected]