unrealized_gains
Calculate unrealized gains by comparing current holdings' adjusted cost base against market prices, returning per-security gains and portfolio totals. Accepts transaction history via CSV or inline data.
Instructions
Compute unrealized gains: current holdings' book cost (ACB) against market prices.
For each security still held, returns shares, total ACB, current market value and the unrealized gain in dollars and percent, plus portfolio totals. 'market_prices' maps each security to its current price: either a number already in CAD (e.g. {"XEQT": 35.20}) or, for foreign-quoted securities, an object with the trade-currency price and the CAD exchange rate (e.g. {"VTI": {"price": 305.40, "fx_rate": 1.37}}). Held securities without a price are listed in 'missing_prices' and excluded from totals. Accepts inline 'transactions' or a 'csv_path'. Each transaction is an object: date (YYYY-MM-DD), action ('buy' or 'sell'), security (ticker/symbol), shares, price (per share), and optionally commission, currency, fx_rate (trade-currency to CAD, e.g. 1.35 for USD), and note.
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": {
"market_prices": "<market_prices>"
},
"name": "unrealized_gains"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| csv_path | No | ||
| transactions | No | ||
| market_prices | Yes |