Calculate portfolio statistics
calculate_portfolio_statisticsCalculate historical return, volatility, drawdown, risk-adjusted and benchmark-relative statistics from a confirmed portfolio series profile. The metrics parameter describes all available calculations and their required inputs. Use daily, weekly or monthly complete periods; results include coverage, warnings and exact dataset/profile pins. Reuse an idempotency_key only for an identical calculation.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"series_profile_id": "<series_profile_id>",
"metrics": "<metrics>",
"target_frequency": "<target_frequency>",
"idempotency_key": "<idempotency_key>"
},
"name": "calculate_portfolio_statistics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metrics | Yes | Select one or more unique metric names. periodic_returns: Return for each complete period at target_frequency. cumulative_return: Compounded return across the selected complete periods. observation_count: Number of source observations in the selected date range. period_count: Number of complete return periods available for calculation. min_return: Lowest periodic return and its period end date. max_return: Highest periodic return and its period end date. volatility: Sample standard deviation of periodic returns, with annualized volatility. drawdown: Decline from the running peak of compounded wealth for each period. max_drawdown: Largest peak-to-trough decline, with peak, trough and recovery dates when available. downside_deviation: Root mean square shortfall below minimum_acceptable_return, with annualized deviation. Requires minimum_acceptable_return. sharpe: Mean return above risk_free_rate divided by the sample standard deviation of excess returns, with annualized ratio. Requires risk_free_rate. sortino: Mean return above minimum_acceptable_return divided by downside deviation, with annualized ratio. Requires minimum_acceptable_return. beta: Sensitivity of portfolio returns to benchmark returns. Requires benchmark_profile_id. alpha: Return above the benchmark return implied by beta and risk_free_rate, with annualized alpha. Requires benchmark_profile_id and risk_free_rate. correlation: Pearson correlation between portfolio and benchmark returns. Requires benchmark_profile_id. tracking_error: Sample standard deviation of portfolio-minus-benchmark returns, with annualized tracking error. Requires benchmark_profile_id. information_ratio: Mean portfolio-minus-benchmark return divided by tracking error, with annualized ratio. Requires benchmark_profile_id. | |
| end_date | No | ||
| start_date | No | ||
| analysis_name | No | Optional private grouping name. The same case-sensitive name, after trimming outer whitespace, reuses one group for this user. Omit it for an independent operation. Keep the name on retries; each calculation still needs its own idempotency_key. | |
| risk_free_rate | No | Required for sharpe and alpha. Use a confirmed risk-free rate profile or a source-backed dated annualized scalar with currency, tenor, compounding and provenance. Do not substitute an assumed rate. | |
| idempotency_key | Yes | ||
| target_frequency | Yes | Calculate complete daily, weekly or monthly return periods. Annualization uses 252, 52 or 12 periods per year respectively; finer-frequency data must be available. | |
| series_profile_id | Yes | Confirmed portfolio series profile returned by upload or list_portfolio_series; pins one immutable dataset version. | |
| benchmark_profile_id | No | Confirmed benchmark series profile in the same currency and return basis as the portfolio. Required for beta, alpha, correlation, tracking_error and information_ratio. Returns are matched by exact period dates. | |
| minimum_acceptable_return | No | Required for downside_deviation and sortino. Use a confirmed minimum acceptable return profile or a source-backed dated annualized scalar with currency, tenor, compounding and provenance. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||