# Security Performance Report API (SPR) - Portfolio Analytics

Open, no-auth HTTP API and MCP server for multi-symbol portfolio performance reporting - a dual methodology combining custom Total Return / CAGR / Sharpe / Sortino calculations (validated against QuantStats) with the FFN library for drawdowns, monthly returns and statistics, delivered as professional HTML reports with CSV exports. Built for AI agents first, humans second: every page here has a Copy-as-Markdown button so you can hand it straight to your agent.

Kind: REST / HTTP API, MCP Server (AI agents), Analytics API, Open - no auth
Base URL: https://ffn.tigzig.com
Docs: https://ffn.tigzig.com/docs  ·  OpenAPI: https://ffn.tigzig.com/openapi.json
Full page: https://www.tigzig.com/apis/ffn

## Overview

SPR (Security Performance Report) is a multi-symbol portfolio reporting tool. Pass a set of Yahoo Finance symbols and a date range; get back a professional HTML report with matplotlib charts plus six CSV files (price data, returns, correlations, statistics). Two access shapes over one backend:
- REST - POST /analyze (and /api/analyze) with symbols, start_date, end_date, optional risk_free_rate.
- MCP - the same report as an agent tool call (see below).

AI agents: open (no auth), listed in the RFC 9727 catalog at https://api.tigzig.com/.well-known/api-catalog ; OpenAPI at https://ffn.tigzig.com/openapi.json .

Related: single-symbol profiling -> /apis/quantstats ; 6-security metric comparison -> /apis/qrep .

## MCP Server (for AI agents)

Connect an AI agent and let it generate a portfolio report. No auth. Three transports:
- https://ffn.tigzig.com/v1/mcp/http - Streamable HTTP (recommended; MCP 2025-03-26).
- https://ffn.tigzig.com/v1/mcp/sse - SSE (legacy fallback).
- https://ffn.tigzig.com/mcp - original SSE endpoint (back-compat).

Example prompt: "Generate an SPR report for AAPL, MSFT and GOOG from 2020-01-01 to 2024-12-31."
Add to Claude.ai: Settings -> Connectors -> Add custom connector -> paste the Streamable HTTP URL (fall back to SSE) -> approve. Same URLs work for Cursor, n8n, any MCP client.

## Methodology & validation

Dual calculation methodology. Core performance metrics (Total Return, CAGR, Sharpe, Sortino) use custom implementations based on QuantStats methodology; additional analytics (drawdowns, monthly returns, statistics) are powered by the open-source FFN library. Price data from Yahoo Finance with preprocessing (zero/NaN removal, date alignment).

Validation. Selective validation against QuantStats shows perfect matches for Total Return (100%) and CAGR (100%), 97%+ for Sharpe and Sortino. Variance from data-quality filters + precision. For multi-security analysis, date mismatches from differing exchange calendars are forward-filled up to five days. Full details: https://ffn.tigzig.com/static/docs/SPR_QS_METHODOLOGY.html

Informational only, not investment advice. Always validate outputs.

## Build your own (open source)

Clone and run your own:
1. Clone https://github.com/amararun/shared-fastapi-mcp-ffn
2. Create a virtual environment and install dependencies.
3. Configure environment variables, then run the FastAPI server with uvicorn.

Key dependencies: custom calculation engine, FFN, FastAPI, yfinance, fastapi-mcp.

Self-hosting a public MCP server is your responsibility for security - a public endpoint needs edge rate limiting, abuse detection, secret hygiene. Full checklist: https://www.tigzig.com/security

## API Endpoints (REST / HTTP)

Base URL: `https://ffn.tigzig.com`

### POST /analyze
Analyze
Example: curl -X POST "https://ffn.tigzig.com/analyze"
### POST /api/analyze
Analyze Api
Example: curl -X POST "https://ffn.tigzig.com/api/analyze"
