changedOutput schema / (root)
Previous value: -nullNew value: +{
+ "$defs": {
+ "Position": {
+ "additionalProperties": false,
+ "description": "One holding in the caller's portfolio (manual entry OR\nPlaid-synced brokerage position). Merged view — matches the web\n/portfolio page shape.\n\n`price_source` documents where `current_price` came from:\n - `broker_derived`: computed as `market_value / shares` where\n `market_value` is Plaid-reported (fresh as of last brokerage\n sync). Plaid doesn't send `current_price` directly — we\n derive it, and this label says so honestly.\n - `cached_snapshot`: read from stock_snapshot_cache (up to\n 7 days old; cache-refresh worker keeps it warm hourly).\n - `cache_miss`: no price available; `current_price` is None\n and `market_value` falls back to shares × avg_cost so\n totals still make sense.\n - `demo_snapshot`: BUG-57 (2026-08-25) — position belongs to\n the shared demo portfolio (signed-in-empty tenant funneled\n to anon pool) and price came from the reference-price map\n baked into `_DEMO_PORTFOLIO_POSITIONS`. Honest label so\n callers know this isn't a live market snapshot. Only appears\n on PortfolioResult rows where `demo_mode=True`.\n\nAnti-BUG-24 discipline: no hardcoded fallback values. Empty is\nhonest; unknown price is honest. Never fake data.",
+ "properties": {
+ "account_type": {
+ "title": "Account Type",
+ "type": "string"
+ },
+ "avg_cost": {
+ "title": "Avg Cost",
+ "type": "number"
+ },
+ "cost_basis_status": {
+ "default": "reported",
+ "enum": [
+ "reported",
+ "split_uncertain"
+ ],
+ "title": "Cost Basis Status",
+ "type": "string"
+ },
+ "current_price": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Current Price"
+ },
+ "is_fund": {
+ "default": false,
+ "title": "Is Fund",
+ "type": "boolean"
+ },
+ "market_value": {
+ "title": "Market Value",
+ "type": "number"
+ },
+ "pnl_dollars": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Pnl Dollars"
+ },
+ "pnl_pct": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Pnl Pct"
+ },
+ "pnl_status": {
+ "default": "computed",
+ "enum": [
+ "computed",
+ "cost_unknown",
+ "price_unavailable"
+ ],
+ "title": "Pnl Status",
+ "type": "string"
+ },
+ "price_source": {
+ "enum": [
+ "broker_derived",
+ "cached_snapshot",
+ "cache_miss",
+ "demo_snapshot"
+ ],
+ "title": "Price Source",
+ "type": "string"
+ },
+ "shares": {
+ "title": "Shares",
+ "type": "number"
+ },
+ "source": {
+ "enum": [
+ "manual",
+ "brokerage"
+ ],
+ "title": "Source",
+ "type": "string"
+ },
+ "ticker": {
+ "title": "Ticker",
+ "type": "string"
+ },
+ "weight_pct": {
+ "title": "Weight Pct",
+ "type": "number"
+ }
+ },
+ "required": [
+ "ticker",
+ "shares",
+ "avg_cost",
+ "market_value",
+ "weight_pct",
+ "account_type",
+ "source",
+ "price_source"
+ ],
+ "title": "Position",
+ "type": "object"
+ }
+ },
+ "additionalProperties": false,
+ "description": "Return type for `list_portfolio()`. Rich shape matching web\n/portfolio: positions + totals + source split.\n\n`is_empty` is the explicit signal for empty-tenant / anonymous\ncallers — LLMs use it to distinguish \"no holdings yet\" from\n\"engine failure\". Post-BUG-24: NEVER return fake positions;\nempty state must render as empty state.",
+ "properties": {
+ "brokerage_count": {
+ "default": 0,
+ "title": "Brokerage Count",
+ "type": "integer"
+ },
+ "demo_mode": {
+ "default": false,
+ "title": "Demo Mode",
+ "type": "boolean"
+ },
+ "is_empty": {
+ "title": "Is Empty",
+ "type": "boolean"
+ },
+ "manual_count": {
+ "default": 0,
+ "title": "Manual Count",
+ "type": "integer"
+ },
+ "positions": {
+ "items": {
+ "$ref": "#/$defs/Position"
+ },
+ "title": "Positions",
+ "type": "array"
+ },
+ "price_freshness_note": {
+ "title": "Price Freshness Note",
+ "type": "string"
+ },
+ "total_cost": {
+ "default": 0,
+ "title": "Total Cost",
+ "type": "number"
+ },
+ "total_pnl": {
+ "default": 0,
+ "title": "Total Pnl",
+ "type": "number"
+ },
+ "total_pnl_pct": {
+ "default": 0,
+ "title": "Total Pnl Pct",
+ "type": "number"
+ },
+ "total_value": {
+ "default": 0,
+ "title": "Total Value",
+ "type": "number"
+ },
+ "upgrade_hint": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Upgrade Hint"
+ }
+ },
+ "required": [
+ "is_empty",
+ "price_freshness_note"
+ ],
+ "title": "PortfolioResult",
+ "type": "object"
+}