QuantRisk

Portfolio risk analytics — VaR, Monte Carlo, optimization, options Greeks, stress testing.

我该使用它吗

质量与安全性

A
描述质量
93%
模式完整度
99%
命名质量
84%
投毒风险
100%
权限匹配度
100%
协议合规性
100%

发现(1)

  • LOWTool 'compare_portfolios' description lacks action verb在 compare_portfolios 中

基于对工具定义和协议合规性的自动分析。

上下文开销

~4,756token 数(工具定义)
~4.8 KB典型响应大小
对注意力有显著影响(占 128k 上下文窗口的 3.72%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "mcp-server": {
      "command": "npx",
      "args": [
        "@quantrisk/mcp-server"
      ]
    }
  }
}

可运行的软件包

npm@quantrisk/mcp-server1.0.2stdio

远程端点

https://quantrisk-mcp.quantrisk.workers.dev/mcpstreamable-http

它能做什么

工具清单

工具(10)

🟢 只读🟡 写入🔴 删除⚪ 未知
🟢analyze_risk(positions, confidence_level, horizon_days, method, benchmark, ...)

Calculate core risk metrics for a portfolio — Value at Risk (VaR), Conditional VaR (CVaR), volatility, beta, and max drawdown.

输入模式

{
  "type": "object",
  "properties": {
    "positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
          },
          "quantity": {
            "type": "number",
            "description": "Number of shares held. Use a negative value to represent a short position."
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
          }
        },
        "required": [
          "ticker",
          "quantity"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500,
      "description": "Array of portfolio positions. Each entry needs a ticker and quantity. Free tier: max 20 positions. Paid tier: up to 500."
    },
    "confidence_level": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 0.99,
      "default": 0.95,
      "description": "VaR confidence level as a decimal, e.g. 0.95 = 95%. Range: 0.01-0.99. Default: 0.95."
    },
    "horizon_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 252,
      "default": 1,
      "description": "Risk horizon in trading days. 1 = overnight, 21 ≈ 1 month, 252 ≈ 1 year. Default: 1."
    },
    "method": {
      "type": "string",
      "enum": [
        "historical",
        "parametric",
        "cornish_fisher"
      ],
      "default": "historical",
      "description": "VaR calculation method. \"historical\" uses empirical return distribution, \"parametric\" assumes normality, \"cornish_fisher\" adjusts for skew and kurtosis. Default: \"historical\"."
    },
    "benchmark": {
      "type": "string",
      "minLength": 1,
      "maxLength": 10,
      "default": "SPY",
      "description": "Benchmark ticker for beta calculation, e.g. SPY or QQQ. Default: SPY."
    },
    "lookback_days": {
      "type": "integer",
      "minimum": 30,
      "maximum": 1260,
      "default": 252,
      "description": "Number of historical trading days to use. 252 ≈ 1 year, 756 ≈ 3 years. Range: 30-1260. Default: 252."
    }
  },
  "required": [
    "positions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪monte_carlo_simulation(positions, num_paths, horizon_days, model, lookback_days, ...)

Run Monte Carlo simulation on a portfolio to model the distribution of future returns, including percentile outcomes and probability of loss.

输入模式

{
  "type": "object",
  "properties": {
    "positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
          },
          "quantity": {
            "type": "number",
            "description": "Number of shares held. Use a negative value to represent a short position."
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
          }
        },
        "required": [
          "ticker",
          "quantity"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500,
      "description": "Array of portfolio positions. Free tier: max 20 positions. Paid tier: up to 500."
    },
    "num_paths": {
      "type": "integer",
      "minimum": 100,
      "maximum": 100000,
      "default": 10000,
      "description": "Number of simulation paths to run. More paths = more accurate but slower. Free tier: max 1,000. Paid tier: up to 100,000. Default: 10,000."
    },
    "horizon_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 252,
      "default": 21,
      "description": "Simulation horizon in trading days. 21 ≈ 1 month, 63 ≈ 1 quarter, 252 ≈ 1 year. Default: 21."
    },
    "model": {
      "type": "string",
      "enum": [
        "gbm",
        "jump_diffusion"
      ],
      "default": "gbm",
      "description": "Stochastic process model. \"gbm\" = Geometric Brownian Motion (standard), \"jump_diffusion\" = adds jump risk for fat-tail scenarios. Default: \"gbm\"."
    },
    "lookback_days": {
      "type": "integer",
      "minimum": 30,
      "maximum": 1260,
      "default": 252,
      "description": "Historical window used to estimate drift and volatility parameters. Range: 30-1260 trading days. Default: 252."
    },
    "seed": {
      "anyOf": [
        {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        {
          "type": "null"
        }
      ],
      "description": "Random seed for reproducible results. Omit for a fresh random run each time."
    }
  },
  "required": [
    "positions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪stress_test(positions, scenarios, custom_shocks)

Stress test a portfolio against historical crisis scenarios (GFC 2008, COVID 2020, etc.) or custom shocks (paid tier).

输入模式

{
  "type": "object",
  "properties": {
    "positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
          },
          "quantity": {
            "type": "number",
            "description": "Number of shares held. Use a negative value to represent a short position."
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
          }
        },
        "required": [
          "ticker",
          "quantity"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500,
      "description": "Array of portfolio positions. Free tier: max 20 positions and historical scenarios only. Paid tier: up to 500 positions plus custom shocks."
    },
    "scenarios": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "gfc_2008",
          "covid_2020",
          "dot_com_2000",
          "black_monday_1987",
          "taper_tantrum_2013",
          "rate_hike_2022",
          "volmageddon_2018",
          "euro_crisis_2011"
        ]
      },
      "default": [
        "gfc_2008",
        "covid_2020"
      ],
      "description": "Historical scenarios to run. Available values: gfc_2008, covid_2020, dot_com_2000, black_monday_1987, taper_tantrum_2013, rate_hike_2022, volmageddon_2018, euro_crisis_2011. Default: [gfc_2008, covid_2020]."
    },
    "custom_shocks": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 50,
                "description": "Name for this custom scenario, e.g. 'Rate spike +300bps'. 1-50 characters."
              },
              "ticker_shocks": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": -1,
                  "maximum": 1
                },
                "description": "Per-ticker price shocks as decimals, e.g. { AAPL: -0.20 } = AAPL drops 20%. Range: -1.0 to 1.0."
              },
              "sector_shocks": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": -1,
                  "maximum": 1
                },
                "description": "Per-sector shocks applied to all positions in that sector. e.g. { Technology: -0.15 }. Range: -1.0 to 1.0."
              },
              "market_shock": {
                "type": "number",
                "minimum": -1,
                "maximum": 1,
                "description": "Broad market shock applied to all positions not covered by ticker_shocks or sector_shocks. e.g. -0.10 = market down 10%. Range: -1.0 to 1.0."
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Custom shock definitions. PAID tier only. Each shock specifies ticker-level, sector-level, or market-wide price changes."
    }
  },
  "required": [
    "positions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢optimize_portfolio(tickers, objective, target_return, constraints, risk_free_rate, ...)

Find the optimal portfolio allocation using mean-variance optimization. Supports max Sharpe, min variance, and target return objectives. Paid tier only.

输入模式

{
  "type": "object",
  "properties": {
    "tickers": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 10,
        "pattern": "^[A-Z0-9.^-]{1,10}$"
      },
      "minItems": 2,
      "maxItems": 50,
      "description": "Universe of tickers to optimize across. Must be 2-50 tickers. The optimizer will determine the best weights within this set."
    },
    "objective": {
      "type": "string",
      "enum": [
        "max_sharpe",
        "min_variance",
        "target_return"
      ],
      "default": "max_sharpe",
      "description": "Optimization objective. \"max_sharpe\" = maximize risk-adjusted return, \"min_variance\" = minimize portfolio volatility, \"target_return\" = hit a specific return with minimum risk. Default: \"max_sharpe\"."
    },
    "target_return": {
      "anyOf": [
        {
          "type": "number",
          "exclusiveMinimum": 0
        },
        {
          "type": "null"
        }
      ],
      "description": "Required when objective is \"target_return\". Annualized return as a decimal, e.g. 0.12 = 12% annual return target."
    },
    "constraints": {
      "type": "object",
      "properties": {
        "min_weight": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "default": 0,
          "description": "Minimum allocation weight per asset as a decimal. 0.0 = no minimum (asset may be excluded). Range: 0.0-1.0. Default: 0.0."
        },
        "max_weight": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "default": 1,
          "description": "Maximum allocation weight per asset as a decimal. 0.1 = max 10% in any single asset. Range: 0.0-1.0. Default: 1.0."
        },
        "sector_max": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum total portfolio weight per sector, e.g. { Technology: 0.30 } = max 30% in tech. Keys should be GICS sector names."
        }
      },
      "additionalProperties": false,
      "description": "Optional weight constraints. See ConstraintsInput for details."
    },
    "risk_free_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.05,
      "description": "Annualized risk-free rate as a decimal, e.g. 0.05 = 5%. Used in Sharpe ratio calculation. Default: 0.05."
    },
    "lookback_days": {
      "type": "integer",
      "minimum": 252,
      "maximum": 1260,
      "default": 756,
      "description": "Historical window for estimating return and covariance. 252 = 1 year, 756 = 3 years, 1260 = 5 years. Range: 252-1260. Default: 756."
    }
  },
  "required": [
    "tickers"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟡correlation_matrix(tickers, lookback_days, method)

Compute the pairwise correlation matrix for a set of assets. Identifies highly correlated pairs and diversification opportunities.

输入模式

{
  "type": "object",
  "properties": {
    "tickers": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 10,
        "pattern": "^[A-Z0-9.^-]{1,10}$"
      },
      "minItems": 2,
      "maxItems": 50,
      "description": "Tickers to include in the correlation matrix. Minimum 2, maximum 50. Free tier: max 10 tickers. Paid tier: up to 50."
    },
    "lookback_days": {
      "type": "integer",
      "minimum": 30,
      "maximum": 1260,
      "default": 252,
      "description": "Historical window for computing correlations in trading days. 30 = ~6 weeks, 252 = ~1 year. Range: 30-1260. Default: 252."
    },
    "method": {
      "type": "string",
      "enum": [
        "pearson",
        "spearman",
        "kendall"
      ],
      "default": "pearson",
      "description": "Correlation method. \"pearson\" = linear correlation (standard), \"spearman\" = rank-based (robust to outliers), \"kendall\" = concordance-based. Default: \"pearson\"."
    }
  },
  "required": [
    "tickers"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪performance_attribution(positions, period_days, benchmark, risk_free_rate)

Break down portfolio performance into factor exposures, sector allocation, and position contributions. Computes Sharpe, Sortino, Treynor, Calmar, and Information ratios.

输入模式

{
  "type": "object",
  "properties": {
    "positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
          },
          "quantity": {
            "type": "number",
            "description": "Number of shares held. Use a negative value to represent a short position."
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
          }
        },
        "required": [
          "ticker",
          "quantity"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500,
      "description": "Array of portfolio positions. Free tier: max 20 positions (basic ratios only). Paid tier: up to 500 positions with full factor attribution."
    },
    "period_days": {
      "type": "integer",
      "minimum": 30,
      "maximum": 1260,
      "default": 252,
      "description": "Measurement period in trading days. 252 = ~1 year. Range: 30-1260. Default: 252."
    },
    "benchmark": {
      "type": "string",
      "minLength": 1,
      "maxLength": 10,
      "default": "SPY",
      "description": "Benchmark ticker for relative performance metrics (Information Ratio, Tracking Error, Beta). Default: SPY."
    },
    "risk_free_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.05,
      "description": "Annualized risk-free rate as a decimal, e.g. 0.05 = 5%. Used in Sharpe, Sortino, and Treynor ratios. Default: 0.05."
    }
  },
  "required": [
    "positions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪sector_exposure(positions)

Break down portfolio exposure by GICS sector, market cap, and asset class. Returns concentration metrics including the Herfindahl-Hirschman Index.

输入模式

{
  "type": "object",
  "properties": {
    "positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
          },
          "quantity": {
            "type": "number",
            "description": "Number of shares held. Use a negative value to represent a short position."
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
          }
        },
        "required": [
          "ticker",
          "quantity"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500,
      "description": "Array of portfolio positions to analyze. Returns GICS sector weights, market cap breakdown, and concentration metrics."
    }
  },
  "required": [
    "positions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢price_history(tickers, days, interval)

Fetch historical OHLCV price data for one or more tickers. Free tier: 1 ticker, 252 days. Paid tier: up to 20 tickers, 1260 days.

输入模式

{
  "type": "object",
  "properties": {
    "tickers": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 10,
        "pattern": "^[A-Z0-9.^-]{1,10}$"
      },
      "minItems": 1,
      "maxItems": 20,
      "description": "Ticker symbols to fetch price history for. Free tier: max 1 ticker. Paid tier: up to 20 tickers."
    },
    "days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1260,
      "default": 252,
      "description": "Number of historical trading days to return. Free tier: max 252 days (~1 year). Paid tier: up to 1260 days (~5 years). Default: 252."
    },
    "interval": {
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ],
      "default": "daily",
      "description": "Price interval. \"daily\" returns one OHLCV row per trading day, \"weekly\" aggregates to weekly bars, \"monthly\" aggregates to monthly bars. Default: \"daily\"."
    }
  },
  "required": [
    "tickers"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪compare_portfolios(portfolios, period_days, confidence_level)

Compare two or more portfolio allocations head-to-head across all key risk and return metrics. Paid tier only.

输入模式

{
  "type": "object",
  "properties": {
    "portfolios": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "Human-readable label for this portfolio, e.g. 'Current' or 'Rebalanced'. 1-50 chars."
          },
          "positions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ticker": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 10,
                  "pattern": "^[A-Z0-9.^-]{1,10}$",
                  "description": "Ticker symbol, e.g. AAPL or MSFT. Must be uppercase, 1-10 characters."
                },
                "quantity": {
                  "type": "number",
                  "description": "Number of shares held. Use a negative value to represent a short position."
                },
                "cost_basis": {
                  "anyOf": [
                    {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Per-share cost basis in USD. Optional — used only for P&L calculations."
                }
              },
              "required": [
                "ticker",
                "quantity"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 500,
            "description": "Positions in this portfolio. 1-500 entries."
          }
        },
        "required": [
          "name",
          "positions"
        ],
        "additionalProperties": false
      },
      "minItems": 2,
      "maxItems": 5,
      "description": "Two to five named portfolios to compare head-to-head. Each needs a unique name and a list of positions. Min: 2, max: 5."
    },
    "period_days": {
      "type": "integer",
      "minimum": 30,
      "maximum": 1260,
      "default": 252,
      "description": "Lookback period in trading days used for return and risk calculations. 252 = ~1 year. Range: 30-1260. Default: 252."
    },
    "confidence_level": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 0.99,
      "default": 0.95,
      "description": "VaR confidence level as a decimal, e.g. 0.95 = 95%. Range: 0.01-0.99. Default: 0.95."
    }
  },
  "required": [
    "portfolios"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢calculate_greeks(options, risk_free_rate)

Calculate option Greeks (delta, gamma, theta, vega, rho) for individual options or an options portfolio. Uses Black-Scholes for European, binomial for American style. Paid tier only.

输入模式

{
  "type": "object",
  "properties": {
    "options": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "underlying": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^[A-Z0-9.^-]{1,10}$",
            "description": "Ticker symbol of the underlying asset, e.g. AAPL."
          },
          "strike": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Option strike price in USD. Must be a positive number."
          },
          "expiry": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Option expiry date in ISO 8601 format, e.g. 2026-12-19. Must be a future date."
          },
          "option_type": {
            "type": "string",
            "enum": [
              "call",
              "put"
            ],
            "description": "Option type: \"call\" gives the right to buy, \"put\" gives the right to sell."
          },
          "style": {
            "type": "string",
            "enum": [
              "european",
              "american"
            ],
            "default": "european",
            "description": "Option exercise style. \"european\" can only be exercised at expiry (Black-Scholes). \"american\" can be exercised any time (binomial model). Default: \"european\"."
          },
          "quantity": {
            "type": "integer",
            "default": 1,
            "description": "Number of contracts. Positive = long, negative = short. Default: 1."
          },
          "implied_volatility": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Implied volatility as a decimal, e.g. 0.25 = 25%. If omitted or null, it is computed from market_price."
          },
          "market_price": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Current market price of the option in USD. Required when implied_volatility is not provided."
          }
        },
        "required": [
          "underlying",
          "strike",
          "expiry",
          "option_type"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 100,
      "description": "Array of option positions to calculate Greeks for. 1-100 options. Results include per-option Greeks and aggregated portfolio Greeks."
    },
    "risk_free_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.05,
      "description": "Annualized risk-free rate as a decimal, e.g. 0.05 = 5%. Used in Black-Scholes and binomial pricing models. Default: 0.05."
    }
  },
  "required": [
    "options"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

社区

评价此服务器

证据

最近观测

已验证未记录版本10 个工具
已验证未记录版本10 个工具