portfolio_performance
Calculate period-by-period returns for each position and the overall portfolio, helping compare holdings and track performance over time.
Instructions
The value and returns of a portfolio over time, built from one of: transactions (a list of trades, e.g. [{'date': '2023-01-03', 'ticker': 'AAPL', 'volume': 10, 'price': 125.1}]; volume negative for a sale, price optional (the closing price of the day), costs and currency optional), holdings ({'AAPL': 10, 'MSFT': 5}, bought at the close of start_date), weights ({'VTI': 0.6, 'BND': 0.4}, investing initial_value on start_date and rebalancing as rebalancing= says) or preset (a classic portfolio such as '60/40', 'All Weather' or 'Permanent'; get_presets lists them). get_portfolio_overview: per position and for the Portfolio the volume, average purchase price, invested amount, latest value, return, dividends, weight, volatility, beta and alpha against the benchmark. get_portfolio_performance (period=): the return per period of each position and the Portfolio. get_positions_overview: per day the volume, invested amount, value, cumulative return and weights of each position (use limit=-5 for the latest days). get_transactions_overview (pnl_method='FIFO'|'LIFO'|'AVERAGE'): each trade with its value, return and profit and loss. get_transactions_performance (period=): how the units bought in each period did against the same purchases of the benchmark. get_money_weighted_return: the annual money-weighted return (XIRR) per position and for the Portfolio. Prices are valued in one currency (currency=, by default the currency most of the portfolio trades in). Returns, weights and rates are decimals.
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": {
"indicator": "<indicator>"
},
"name": "portfolio_performance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | The rows to return, like head and tail: 5 for the first five, -5 for the last five (the most recent of a time series). A table with its periods as columns (financial statements, ratios) keeps its first or last periods instead, and rows per ticker (an earnings calendar) are selected per ticker. For ETF holdings the largest (or, negative, the smallest) by weight, and for a list (e.g. news or a screener) its length. 0 returns every row. | |
| period | No | Observation frequency, e.g. 'daily', 'weekly', 'monthly', 'quarterly', or 'annual' (supported values differ per method). | |
| preset | No | A classic portfolio by name, e.g. '60/40', 'All Weather', 'Permanent', 'Golden Butterfly' or 'Three Fund' (get_presets lists them all). | |
| weights | No | The target weight per ticker, e.g. {'VTI': 0.6, 'BND': 0.4} or 'VTI:0.6, BND:0.4': initial_value is invested on start_date and brought back to these weights as rebalancing says, with the dividends reinvested. | |
| currency | No | The currency the portfolio is valued in, e.g. 'USD' or 'EUR'; prices in other currencies are converted at each day's rate. Defaults to the currency most of the portfolio trades in. | |
| holdings | No | The shares held per ticker, e.g. {'AAPL': 10, 'MSFT': 5} or 'AAPL:10, MSFT:5', bought at the close of start_date. | |
| indicator | Yes | Name of the specific metric to calculate, one of the listed values. Required — search_metrics finds the indicator (and its tool) for a metric by name. | |
| pnl_method | No | The method for calculating profit & loss. Options are: 'FIFO' (First In, First Out), 'LIFO' (Last In, First Out), or 'AVERAGE'. | FIFO |
| start_date | No | When holdings, weights or a preset are invested, YYYY-MM-DD; left empty, ten years ago for weights and presets and five years ago for holdings. Transactions start on their first date. | |
| rebalancing | No | How often weights or a preset return to their weights: 'none', 'monthly', 'quarterly' or 'yearly'. Defaults to quarterly (a preset: its own frequency). | |
| show_columns | No | Comma-separated names to filter the output. For historical data use the key names visible in any response record (e.g. 'Close,Volume,Return'). For financial statements use the 'metric' field values from the response (e.g. 'Revenue,Net Income,EBITDA'). Call the tool once without this parameter to see all available names, then repeat with show_columns to reduce response size and token usage. | |
| transactions | No | The trades of the portfolio as a list, e.g. [{'date': '2023-01-03', 'ticker': 'AAPL', 'volume': 10, 'price': 125.1}, {'date': '2024-06-03', 'ticker': 'AAPL', 'volume': -5, 'price': 194.0}]. volume is negative for a sale; price (for every trade or none: the close of the day), costs (negative) and currency are optional. At most 1000 trades. | |
| initial_value | No | The amount invested in weights or a preset. Defaults to 10,000. | |
| benchmark_ticker | No | Ticker used as the market benchmark, e.g. 'SPY' or '^GSPC'; 'None' for no benchmark. | SPY |
| include_portfolio | No | A boolean flag indicating whether the portfolio itself should be included in the overview. | |
| exclude_sold_positions | No | A flag indicating whether to exclude sold positions. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |