Skip to main content
Glama

get_returns

Calculate daily, log, or cumulative returns for investment portfolios to analyze performance and generate statistics.

Instructions

Get returns data for a portfolio.

Calculates different types of returns from the portfolio's price data. Args: name: The portfolio name. return_type: Type of returns to calculate: - "daily": Daily percentage returns - "log": Daily log returns - "cumulative": Cumulative returns from start as_percentage: If True, multiply by 100 for percentage display. Returns: Dictionary containing: - return_type: The type of returns calculated - dates: List of date strings - returns: Dict of returns per symbol - portfolio_returns: Weighted portfolio returns - statistics: Summary statistics (mean, std, min, max) Example: ``` # Get daily returns result = get_returns(name="tech_stocks", return_type="daily") # Get cumulative returns for growth chart result = get_returns(name="tech_stocks", return_type="cumulative") ```

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
return_typeNodaily
as_percentageNo

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