MarketHeist

Backtest strategies and analyze portfolios, incl. nested multi-strategy portfolios, on real data.

Documentation

MarketHeist runs an MCP (Model Context Protocol) server so you can run real backtests and analyze portfolios directly from Claude and other MCP-compatible AI assistants — just by asking. Portfolios can hold more than funds: whole portfolios, backtested strategies and rotations can be holdings, with a trend filter on top. No account, no API key, no setup beyond adding one URL.

Connector URL

https://api.marketheist.io/api/mcp
  • Transport: Streamable HTTP
  • Authentication: None required — all tools read public market data
  • Cost: Free

Add it to Claude

  1. Open Settings → Connectors.
  2. Click Add custom connector.
  3. Paste the URL above and confirm.

Claude connects immediately and lists four tools. Ask a question in plain language and Claude will call them for you.

What it can do

ToolWhat it does
List IndicatorsLists the built-in indicators (RSI, Bollinger, MA/EMA Crossover, ADX, ATR, CCI, OBV, Stochastic, VWAP Deviation, and more) with their parameters and default rules.
Run BacktestRuns a single-strategy backtest and returns Sharpe, CAGR, max drawdown, Calmar, Sortino, Omega, and equity/drawdown curves, benchmarked against buy-and-hold. Also reports where the data came from, known caveats (no costs, short sample, statistical significance, parameter sensitivity) and a reproducible config hash. If you give no threshold for a threshold rule, it uses the indicator's default (for example RSI above 50).
Analyze PortfolioAnalyzes an asset-allocation portfolio — a built-in model (60/40, All Weather, Golden Butterfly, Permanent, Bogleheads, and more) or a custom ticker+weight mix — and returns CAGR, max drawdown, volatility, Sharpe, and Sortino from decades of proxy-extended history. Multi-strategy and nested portfolios: a holding can also be a whole portfolio (a portfolio of portfolios), a strategy (for example the S&P 500 with a 10-month trend filter), a rotation that holds the strongest of a few funds each month, or a strategy from the public library. Optionally applies a trend-filter overlay to the whole portfolio (hold only while it's above its N-month average, else cash). Also reports the number of independent bets, the top risk driver and the same data and caveat notes as a backtest.
Factor DecompositionExplains what drives a ticker's or ETF's returns by splitting them into common factor exposures (U.S. stock market, small companies, value vs. growth, momentum, quality, low volatility, interest-rate sensitivity, corporate credit) plus a leftover that is specific to the asset. Returns each exposure with its statistical strength, how much of the variance each explains, and annualized alpha. It is a measurement of past exposure, not a forecast.

All four are read-only — they analyze public market data and never modify anything.

Example prompts

Try these once the connector is added:

  1. "Backtest a 200-day moving-average trend filter on the Nasdaq 100 and compare it to buy-and-hold." Runs an MA-crossover strategy with a trend regime filter on ^NDX and shows how the drawdown compares to holding the index.
  2. "What indicators can MarketHeist backtest, and what parameters does RSI take?" Lists the indicator catalogue and the default RSI settings.
  3. "How much price history does Bitcoin have, then run an RSI(14) strategy on it weekly." Checks BTC-USD history, then backtests a weekly RSI strategy with lookahead protection.
  4. "Compare a weekly RSI strategy on SPY against buy-and-hold — which has the smaller drawdown?" Returns both sets of metrics side by side.
  5. "How has the Golden Butterfly portfolio performed, and how does a 70/30 VTI/BND compare?" Analyzes the built-in template and a custom allocation, with CAGR, drawdown, and Sharpe for each.
  6. "Analyze the All Weather portfolio with a 10-month trend filter and tell me how much it cuts the drawdown." Applies a whole-portfolio trend-filter overlay and compares the filtered result to the plain allocation.
  7. "What is QQQ really exposed to? How much of its return is just the stock market?" Decomposes QQQ into factor exposures and shows how much of its variance the market explains and how much is specific to the fund.
  8. "Build a portfolio of portfolios: 40% Golden Butterfly, 40% All Weather and 20% QQQ, rebalanced yearly, then add a 10-month trend filter on the whole thing." Holds two whole model portfolios and a fund in one portfolio and reports the result with and without the filter.
  9. "Make the stock side of a 60/40 a trend-following S&P 500 (in the market only above its 10-month average) and compare it with a plain 60/40." Uses a strategy as a holding next to a plain bond fund, over the same window as the plain mix.
  10. "Half my portfolio rotates monthly into whichever of SPY, EFA or BND had the best 12-month return; the rest is 30% VTI and 20% BND." A multi-strategy portfolio: a rotation next to fixed holdings.

Nested and multi-strategy portfolios

Most portfolio tools only let a portfolio hold funds. Here a holding can also be a whole portfolio or a strategy, so you can test a portfolio of portfolios, put a trend-following strategy inside a 60/40, or combine a rotation with fixed holdings. Your assistant builds the arguments; this is what example 8 sends (without the filter):

{
  "assets": [
    { "weight": 40, "sleeve": { "source": "portfolio-public", "templateId": "golden-butterfly", "label": "Golden Butterfly" } },
    { "weight": 40, "sleeve": { "source": "portfolio-public", "templateId": "all-weather", "label": "All Weather" } },
    { "ticker": "QQQ", "weight": 20 }
  ],
  "rebalance": "yearly"
}

Add "overlay": { "kind": "trend-filter", "months": 10 } to filter the whole portfolio. Other kinds of holding:

Holdingsleeve
A built-in model portfolio{ "source": "portfolio-public", "templateId": "all-weather", "label": "All Weather" }
Your own mix, nested{ "source": "portfolio-mine", "portfolioId": "my-core", "label": "My core", "config": { "id": "my-core", "name": "My core", "assets": [{ "ticker": "VTI", "weight": 60 }, { "ticker": "BND", "weight": 40 }], "rebalance": "yearly" } }
A strategy from the public library{ "source": "backtest-public", "strategyId": "spx-golden-cross", "label": "S&P 500 Golden Cross" }
A rotation{ "source": "selection", "label": "Top 1 of SPY/EFA/BND", "config": { "universe": [{ "ticker": "SPY" }, { "ticker": "EFA" }, { "ticker": "BND" }], "signal": { "kind": "trailing-return", "lookbackMonths": 12, "skipMonths": 1 }, "topK": 1, "weighting": "equal", "rebalance": "monthly" } }
A strategy on a ticker or portfolio{ "source": "strategy-over", "label": "SPY 10-month trend", "child": { "ticker": "SPY" }, "config": { ... a full backtest configuration ... } }

Notes:

  • Everything is computed monthly, so a 10-month average stands in for the 200-day one.
  • For a rotation ranked on trailing return, keep skipMonths at 1 so the ranking does not use the month it is about to earn.
  • Give every nested holding a label; it names the holding in the result's allocation line.
  • Nested results report the same metrics, caveats and reproduce hash as any other portfolio. A nested portfolio counts as one holding in the independent-bets figure.

Tickers

Any symbol on Yahoo Finance works — stocks (AAPL), ETFs (SPY, QQQ), indices (^GSPC, ^NDX), crypto (BTC-USD), and commodities (GLD). History goes back as far as Yahoo has records for that symbol.

Notes

  • Backtests always apply a one-bar execution delay to avoid lookahead bias.
  • Results are for research and education only — they are not investment advice.
  • Prefer a visual interface? Every backtest here can also be run at marketheist.io/backtest.