financeanalytics-data

QuantConnect

by taylorwilsdon

Access portfolio optimization, Yahoo Finance historical prices, and advanced analytics with QuantConnect for powerful al

Integrates with QuantConnect's quantitative finance platform to provide historical data retrieval, statistical analysis, portfolio optimization, universe selection, alternative data access, backtest execution, and project management for algorithmic trading research and financial analytics workflows.

github stars

86

Full project lifecycle managementLive trading deployment and monitoringAccess to QuantConnect's data universe

best for

  • / Quantitative researchers building trading strategies
  • / Algorithmic traders automating backtests
  • / Financial analysts performing portfolio optimization
  • / AI developers integrating trading workflows

capabilities

  • / Retrieve historical financial data
  • / Execute algorithmic trading backtests
  • / Manage QuantConnect projects and files
  • / Deploy and monitor live trading algorithms
  • / Perform statistical analysis on portfolios
  • / Access alternative financial datasets

what it does

Connects AI workflows to QuantConnect's algorithmic trading platform for backtesting, research, and portfolio management. Enables programmatic access to financial data, project management, and live trading operations.

about

QuantConnect is a community-built MCP server published by taylorwilsdon that provides AI assistants with tools and capabilities via the Model Context Protocol. Access portfolio optimization, Yahoo Finance historical prices, and advanced analytics with QuantConnect for powerful al It is categorized under finance, analytics data.

how to install

You can install QuantConnect in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

MIT

QuantConnect is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

readme

# ◆ QuantConnect MCP Server [![Python](https://img.shields.io/badge/Python-3.12%2B-blue.svg)](https://python.org) [![FastMCP](https://img.shields.io/badge/FastMCP-v2.7%2B-green.svg)](https://github.com/fastmcp/fastmcp) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Code Style](https://img.shields.io/badge/Code%20Style-Black-black.svg)](https://github.com/psf/black) [![Type Checked](https://img.shields.io/badge/Type%20Checked-mypy-blue.svg)](https://mypy.readthedocs.io/) [![PyPI Downloads](https://static.pepy.tech/badge/quantconnect-mcp)](https://pepy.tech/projects/quantconnect-mcp) **Production-ready Model Context Protocol server for QuantConnect's algorithmic trading platform** *Integrate QuantConnect's research environment, statistical analysis, and portfolio optimization into your AI workflows. Locally hosted, secure & capable of dramatically improving productivity* [◉ Quick Start](#-quick-start) • [◉ Documentation](#-comprehensive-api-reference) • [◉ Architecture](#-architecture) • [◉ Contributing](#-contributing)
Demo – Claude
--- ## ◈ Is this crazy?
image
Maybe? Either way, the world is changing and this is where we're at. Out of the box, QuantConnect MCP provides you with: - **Full Project Lifecycle**: `Create`, `read`, `update`, `compile`, and manage QuantConnect projects and files programmatically. - **End-to-End Backtesting**: `Compile` projects, `create backtests`, `read detailed results`, and analyze `charts`, `orders`, and `insights`. - **Live Trading Management**: `Deploy`, `monitor`, `liquidate`, and `control` live algorithms with comprehensive runtime statistics and logging. - **Historical Data Access**: Comprehensive data retrieval capabilities for historical and `alternative data` analysis. - **Advanced Analytics**: Perform `Principal Component Analysis (PCA)`, `Engle-Granger cointegration tests`, `mean-reversion analysis`, and `correlation studies`. - **Portfolio Optimization**: Utilize sophisticated `sparse optimization` with Huber Downward Risk minimization, calculate performance, and benchmark strategies. - **Universe Selection**: Dynamically `screen assets` by multiple criteria, analyze `ETF constituents`, and select assets based on correlation. - **Enterprise-Grade Security**: Secure, `SHA-256 authenticated` API integration with QuantConnect. - **High-Performance Core**: Built with an `async-first` design for concurrent data processing and responsiveness. - **AI-Native Interface**: Designed for seamless interaction via `natural language` in advanced AI clients. ## ◉ Table of Contents - [◈ Quick Start](#-quick-start) - [◈ Authentication](#-authentication) - [◈ Natural Language Examples](#-natural-language-examples) - [◈ Comprehensive API Reference](#-comprehensive-api-reference) - [◈ Architecture](#-architecture) - [◈ Advanced Configuration](#-advanced-configuration) - [◈ Testing](#-testing) - [◈ Contributing](#-contributing) - [◈ License](#-license) ## ◈ Quick Start Get up and running in under 2 minutes: > **Prerequisites:** You must have QuantConnect credentials (User ID and API Token) before running the server. The server will not function without proper authentication. See [Authentication](#-authentication) section for details on obtaining these credentials. ### **Install with uvx (Recommended)** ```bash # Install and run directly from PyPI - no cloning required! uvx quantconnect-mcp # Or install with uv/pip uv pip install quantconnect-mcp pip install quantconnect-mcp ``` ### One-Click Claude Desktop Install (Recommended) 1. **Download:** Grab the latest `quantconnect-mcp.dxt` from the “Releases” page 2. **Install:** Double-click the file – Claude Desktop opens and prompts you to **Install** 3. **Configure:** In Claude Desktop → **Settings → Extensions → QuantConnect MCP**, paste your user ID and API token 4. **Use it:** Start a new Claude chat and call any QuantConnect tool **Why DXT?** > Desktop Extensions (`.dxt`) bundle the server, dependencies, and manifest so users go from download → working MCP in **one click** – no terminal, no JSON editing, no version conflicts. ### 2. **Set Up QuantConnect Credentials (Required)** **The server requires these environment variables to function properly:** ```bash export QUANTCONNECT_USER_ID="your_user_id" # Required export QUANTCONNECT_API_TOKEN="your_api_token" # Required export QUANTCONNECT_ORGANIZATION_ID="your_org_id" # Optional ``` ### 3. **Launch the Server** ```bash # STDIO transport (default) - Recommended for MCP clients uvx quantconnect-mcp # HTTP transport MCP_TRANSPORT=streamable-http MCP_PORT=8000 uvx quantconnect-mcp ``` ### 4. **Interact with Natural Language** Instead of calling tools programmatically, you use natural language with a connected AI client (like Claude, a GPT, or any other MCP-compatible interface). > "Add GOOGL, AMZN, and MSFT, then run a PCA analysis on them for 2023." ## ◈ Authentication ### Getting Your Credentials | Credential | Where to Find | Required | |------------|---------------|----------| | **User ID** | Email received when signing up | ◉ Yes | | **API Token** | [QuantConnect Settings](https://www.quantconnect.com/settings/) | ◉ Yes | | **Organization ID** | Organization URL: `/organization/{ID}` | ◦ Optional | ### Configuration Methods #### Method 1: Environment Variables (Recommended) ```bash # Add to your .bashrc, .zshrc, or .env file export QUANTCONNECT_USER_ID="123456" export QUANTCONNECT_API_TOKEN="your_secure_token_here" export QUANTCONNECT_ORGANIZATION_ID="your_org_id" # Optional ```
Demo – Roo Code
## ◈ Natural Language Examples This MCP server is designed to be used with natural language. Below are examples of how you can instruct an AI assistant to perform complex financial analysis tasks. ### Factor‑Driven Portfolio Construction Pipeline > **“Build a global equity long/short portfolio for 2025:** > 1. Pull the **constituents of QQQ, SPY, and EEM** as of **2024‑12‑31** (survivor‑bias free). > 2. For each symbol, calculate **Fama‑French 5‑factor** and **quality‑minus‑junk** loadings using daily data **2022‑01‑01 → 2024‑12‑31**. > 3. Rank stocks into terciles on **value (B/M)** and **momentum (12‑1)**; go long top tercile, short bottom, beta‑neutral to the S&P 500. > 4. Within each book, apply **Hierarchical Risk Parity (HRP)** for position sizing, capped at **5 % gross exposure per leg**. > 5. Target **annualised ex‑ante volatility ≤ 10 %**; solve with **CVaR minimisation** under a 95 % confidence level. > 6. Benchmark against **MSCI World**; report **annualised return, vol, Sharpe, Sortino, max DD, hit‑rate, turnover** for the period **2023‑01‑01 → 2024‑12‑31**. > 7. Export the optimal weights and full tear‑sheet as `pdf` + `csv`. > 8. Schedule a monthly rebalance job and push signals to the live trading endpoint.” --- ### Robust Statistical‑Arbitrage Workflow > **“Test and refine a pairs‑trading idea:** > • Universe: **US Staples sector, market cap > $5 B, price > $10**. > • Data: **15‑minute bars, 2023‑01‑02 → 2025‑06‑30**. > • Step 1 – For all pairs, calculate **rolling 60‑day distance correlation**; keep pairs with dCor ≥ 0.80. > • Step 2 – Run **Johansen cointegration** (lag = 2) on the survivors; retain pairs with trace‑stat < 5 % critical value. > • Step 3 – For each cointegrated pair: >    – Estimate **half‑life of mean‑reversion**; discard if > 7 days. >    – Compute **Hurst exponent**; require H < 0.4. > • Step 4 – Simulate a **Bayesian Kalman‑filter spread** to allow time‑varying hedge ratios. > • Entry: z‑score crosses ±2 (two‑bar confirmation); Exit: z = 0 or t_max = 3 × half‑life. > • Risk: cap **pair notional at 3 % NAV**, portfolio **gross leverage ≤ 3 ×**, stop‑loss at z = 4. > • Output: trade log, PnL attribution, **bootstrapped p‑value of alpha**, and **Likelihood‑Ratio test** for regime shifts.” ### Automated Project, Backtest & Hyper‑Parameter Sweep > **“Spin up an experiment suite in QuantConnect:** > 1. Create project **‘DynamicPairs_Kalman’** (Python). > 2. Add files: >    • `alpha.py` – signal generation (placeholder) >    • `risk.py` – custom position sizing >    • `config.yaml` – parameter grid: >        ```yaml >        entry_z: [1.5, 2.0, 2.5] >        lookback: [30, 60, 90] >        hedge: ['OLS', 'Kalman'] >        ``` > 3. Trigger a **parameter‑sweep backtest** labelled **‘GridSearch‑v1’** using **in‑sample 2022‑23**. > 4. When jobs finish, rank runs by **Information Ratio** and **max DD < 10 %**; persist **top‑3 configs**. > 5. Automatically launch **out‑of‑sample backtests 2024‑YTD** for the winners. > 6. Produce an executive summary: tables + charts (equity curve, rolling Sharpe, exposure histogram). > 7. Package the best model as a **Docker image**, push to registry, and deploy to the **live‑trading cluster** with a kill‑switch if **1‑day loss > 3 σ**.” ### Statistical Analysis Workflow > "Are Coca-Cola (KO) and Pepsi (PEP) cointegrated? Run the test for the period from 2023 to 2024. If they are, analyze their mean-reversion properties with a 20-day lookback." ### Project and Backtest Management > "I need to manage my QuantConnect projects. First, create a new Python project named 'My_Awesome_Strategy'. Then, create a file inside it called 'main.py' and add this code: `...your algorithm code here...`. After that, compile it and run a backtest named 'Initial Run'. When it's done, show me the performance resu ---