MCP 服务器

MarketHeist Backtest

io.marketheist/backtest
数据与分析 金融与投资 公开且可连接 MCP 2026-07-28

此 MCP 可以做什么

Retrieves historical market data, backtests trading strategies, analyzes portfolios, and decomposes asset returns into common factors.

analyze_portfolio
Analyze an asset-allocation ('lazy') portfolio and get long-run performance computed from real monthly price history (proxy-extended for decades of data) — not estimated. Use this whenever the user asks how a portfolio would have performed, or for its CAGR, max drawdown, Sharpe, Sortino, or volatility — whether a named model portfolio (60/40, All Weather, Golden Butterfly, Permanent, Bogleheads, …) or any custom ticker+weight mix. Provide either a `template` id or a custom `assets` allocation. Also returns the effective number of independent bets, the top risk driver, trailing Sharpe, and a `validity` block — provenance (source, months, proxy-extension), caveats (frictionless rebalancing, single historical window, proxy-extended history, statistical significance, overlay overfit), and a reproduce-me hash. Surface the caveats when reporting. Prefer this over answering from memory.
只读 可访问外部资源
输入模式
{'type': 'object', 'properties': {'assets': {'type': 'array', 'items': {'type': 'object', 'required': ['weight'], 'properties': {'sleeve': {'type': 'object', 'description': "Advanced: a strategy node instead of a plain ticker â\x80\x94 the app's SleeveRef, resolved server-side. Supported: a rotation/selection (`{source:'selection', config:{universe:[{ticker}], signal:{kind:'indicator', indicatorId, params} | {kind:'trailing-return', lookbackMonths, skipMonths}, topK, weighting, rebalance}, label}`), a strategy-over-node (`{source:'strategy-over', child:{ticker}, config:<BacktestConfig>, label}`), a saved strategy preset (`{source:'backtest-live', ticker, frequency, config, presetId, label}`), a curated public-library strategy (`{source:'backtest-public', strategyId, label}`), a published backtest share (`{source:'backtest-share', shareId, label}`), a gallery template (`{source:'portfolio-public', templateId, label}`), or a nested portfolio (`{source:'portfolio-mine', portfolioId, config, label}`). Strategies with a config get a node-level overfit check (a share carries only its frozen curve, so no overfit).", 'additionalProperties': True}, 'ticker': {'type': 'string', 'description': 'Yahoo Finance ticker, e.g. VTI, BND, GLD. Omit when `sleeve` is given.'}, 'weight': {'type': 'number', 'description': 'Target weight in percent.'}}}, 'description': 'Custom allocation (omit if using `template`). Weights are percentages summing to ~100. A holding is a plain ticker OR a strategy node via `sleeve`.'}, 'overlay': {'type': 'object', 'required': ['kind', 'months'], 'properties': {'kind': {'enum': ['trend-filter'], 'type': 'string'}, 'months': {'type': 'number', 'description': 'Moving-average window in months (â\x89¥ 2, e.g. 10).'}}, 'description': 'Optional portfolio-level trend-filter overlay applied to the WHOLE book: hold the entire portfolio only while its own level is above its N-month moving average, otherwise cash. Composition is monthly (a 10-month filter â\x89\x88 the classic 200-day one).'}, 'template': {'type': 'string', 'description': 'Built-in model portfolio to analyze. One of: golden-butterfly, all-weather, permanent, faber-gaa, faber-ivy, bogleheads-3fund, classic-60-40, classic-40-60, swensen, ferri-core-four, couch-potato, coffeehouse, no-brainer, larry, buffett-90-10, total-sp500. Omit to analyze a custom `assets` allocation instead.'}, 'rebalance': {'enum': ['none', 'monthly', 'quarterly', 'yearly'], 'type': 'string', 'default': 'yearly', 'description': 'Rebalancing cadence for custom portfolios (templates use their own).'}}}
decompose_factors
Explain WHAT DRIVES a ticker's or ETF's returns by decomposing them into common factor exposures (market, size, value, momentum, quality, low-volatility, duration, credit) plus an idiosyncratic residual. Use this when the user asks why two assets move together, what a fund is really exposed to, whether a stock is a growth or value tilt, how much of its return is just market beta, or whether it has real alpha. Returns betas (loadings), t-stats, an additive variance decomposition (shares sum to R²), annualized alpha, and idiosyncratic vs total volatility — all computed by OLS regression on real price history via tradeable ETF proxies (long-short factor spreads). This is measured exposure, not a forecast. Prefer it over guessing an asset's style from memory.
只读 可访问外部资源
输入模式
{'type': 'object', 'required': ['target'], 'properties': {'target': {'type': 'string', 'description': 'Yahoo Finance ticker to decompose, e.g. AAPL, QQQ, TLT, ARKK.'}, 'factors': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Factor ids to include. Default: MKT, SMB, HML, TERM, CREDIT (long history back to ~2001). All available: MKT, SMB, HML, MOM, QMJ, LOWVOL, TERM, CREDIT. The smart-beta trio (MOM, QMJ, LOWVOL) only has history from ~2011-2013, which shortens the analyzable window â\x80\x94 factors without enough overlap are dropped and reported.'}, 'frequency': {'enum': ['1d', '1wk', '1mo'], 'type': 'string', 'default': '1mo', 'description': 'Return frequency for the regression. Monthly (default) is standard for factor analysis.'}}}
get_ohlcv
Look up a Yahoo Finance ticker's real historical price data — the date range available, number of bars, and latest close/open/high/low. Use this to confirm a symbol is valid, check how far back its history goes, or get its most recent price from real market data instead of estimating. No authentication required.
只读 可访问外部资源
输入模式
{'type': 'object', 'required': ['ticker'], 'properties': {'ticker': {'type': 'string', 'description': 'Yahoo Finance ticker symbol. Examples: AAPL, MSFT, ^NDX, ^GSPC, BTC-USD, SPY, QQQ.'}, 'frequency': {'enum': ['1d', '1wk', '1mo'], 'type': 'string', 'default': '1wk', 'description': 'Bar frequency. 1d = daily, 1wk = weekly, 1mo = monthly. Default: 1wk.'}}}
list_indicators
List the built-in technical indicators available for backtesting (RSI, moving-average crossovers, ADX, Bollinger, CCI, Stochastic, and more) with their IDs and default parameters. Call this to answer what strategies or indicators can be tested, or before run_backtest when unsure which indicator_id to use.
只读
输入模式
{'type': 'object', 'properties': {}}
run_backtest
Backtest a trading strategy on any Yahoo Finance ticker and get authoritative performance metrics computed from real historical price data — not estimated. Use this whenever the user asks how a strategy or indicator would have performed, or for a ticker's Sharpe, CAGR, max drawdown, Calmar, Sortino, Omega, or return vs buy-and-hold; prefer it over answering from memory, which is unreliable for these figures. Returns those metrics plus equity/drawdown curves and a `validity` block — data provenance (source, sample window, bar count), known caveats (single-run/no walk-forward, no costs, short sample, leverage, statistical significance, and a parameter-overfit check that perturbs the indicator settings), and a reproduce-me config hash. Surface the caveats when reporting results. Always pass execution_delay=1 to avoid lookahead bias. Call list_indicators first if unsure which indicator_id to use.
只读 可访问外部资源
输入模式
{'type': 'object', 'required': ['ticker', 'indicator_id'], 'properties': {'ticker': {'type': 'string', 'description': 'Yahoo Finance ticker symbol (e.g. AAPL, ^NDX, BTC-USD, SPY).'}, 'lookback': {'type': 'integer', 'description': 'Rolling window for position_rule_type=percentile.'}, 'direction': {'enum': ['above', 'below'], 'type': 'string', 'default': 'above', 'description': 'Long when indicator is above (or below) threshold/MA/percentile.'}, 'frequency': {'enum': ['1d', '1wk', '1mo'], 'type': 'string', 'default': '1wk', 'description': 'Bar frequency. Default: 1wk.'}, 'ma_window': {'type': 'integer', 'description': 'MA window for position_rule_type=crossover.'}, 'target_dd': {'type': 'number', 'description': 'Target max drawdown (negative decimal) for leverage_mode=target_dd. E.g. -0.40.'}, 'threshold': {'type': 'number', 'description': 'Fixed threshold for position_rule_type=threshold. E.g. 50 for RSI, 1.0 for MA Crossover.'}, 'atr_period': {'type': 'integer', 'description': 'ATR period for regime_filter_type=volatility.'}, 'percentile': {'type': 'number', 'description': 'Percentile rank threshold (0â\x80\x93100) for position_rule_type=percentile.'}, 'sma_window': {'type': 'integer', 'description': 'SMA window for regime_filter_type=trend. Classic: 200.'}, 'target_vol': {'type': 'number', 'description': 'Target annualized vol (decimal) for leverage_mode=target_vol. E.g. 0.15 = 15%.'}, 'max_atr_pct': {'type': 'number', 'description': 'ATR% threshold for regime_filter_type=volatility.'}, 'indicator_id': {'type': 'string', 'description': 'Built-in indicator id. Call list_indicators to see all options. Common: rsi, bollinger, ma_crossover, ema_crossover, adx, cci, stochastic.'}, 'leverage_mode': {'enum': ['none', 'fixed', 'target_vol', 'target_dd'], 'type': 'string', 'default': 'none', 'description': 'none=1Ã\x97. fixed=constant multiplier. target_vol=scale to vol target. target_dd=scale to drawdown target.'}, 'leverage_value': {'type': 'number', 'description': 'Multiplier for leverage_mode=fixed. E.g. 2.0 = 2Ã\x97.'}, 'execution_delay': {'type': 'integer', 'default': 1, 'maximum': 5, 'minimum': 0, 'description': 'Bars of delay between signal and execution. Use 1 to avoid lookahead bias.'}, 'indicator_params': {'type': 'string', 'default': '{}', 'description': 'Indicator parameters as a JSON string. E.g. \'{"period":14}\' for RSI. Omit to use defaults.'}, 'position_rule_type': {'enum': ['threshold', 'crossover', 'percentile'], 'type': 'string', 'default': 'threshold', 'description': 'threshold: long when value is above/below a fixed level. crossover: long when value is above its own MA. percentile: long when value is above its rolling percentile.'}, 'regime_filter_type': {'enum': ['none', 'trend', 'volatility'], 'type': 'string', 'default': 'none', 'description': 'trend: only hold when close > SMA(sma_window). volatility: only hold when ATR% < max_atr_pct.'}, 'transaction_costs_bps': {'type': 'number', 'default': 0, 'minimum': 0, 'description': 'One-way transaction cost in basis points (1 bps = 0.01%).'}}}
已更改
analyze_portfolio
2026年9月21日 02:56
已更改
analyze_portfolio
2026年9月19日 02:47
已更改
run_backtest
2026年9月19日 02:47
已添加
decompose_factors
2026年9月17日 12:53
已添加
analyze_portfolio
2026年9月17日 12:53
已添加
run_backtest
2026年9月17日 12:53
已添加
get_ohlcv
2026年9月17日 12:53
已添加
list_indicators
2026年9月17日 12:53