Skip to main content
Glama

get_covariance_matrix

Calculate pairwise covariances between portfolio assets using daily returns to analyze risk relationships and support portfolio optimization decisions.

Instructions

Get the covariance matrix for portfolio assets.

Calculates pairwise covariances between all assets in the portfolio based on daily returns. Args: name: The portfolio name. annualized: If True, annualize the covariance (multiply by 252). Returns: Dictionary containing: - symbols: List of symbols - covariance_matrix: 2D covariance matrix - variances: Individual asset variances (diagonal) Example: ``` result = get_covariance_matrix(name="tech_stocks") print(f"GOOG variance: {result['variances']['GOOG']}") ```

Caching Behavior:

  • Any input parameter can accept a ref_id from a previous tool call

  • Large results return ref_id + preview; use get_cached_result to paginate

  • All responses include ref_id for future reference

Preview Size: server default. Override per-call with get_cached_result(ref_id, max_size=...).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
annualizedNo

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/l4b4r4b4b4/portfolio-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server