Portfolio Management — AIsa Edition Manage investment portfolios with live P&L tracking using the AIsa API. Usage Actions | Action | Description | |--------|-------------| | | Create a new portfolio | | | List all portfolios | | | Show portfolio summary with live P&L | | | Add position with and | | | Update position quantity/cost | | | Remove position from portfolio | | | Rename a portfolio | | | Delete a portfolio | Data Storage Portfolio data is stored in for persistence across sessions. NOT FINANCIAL ADVICE. For informational purposes only. ---

:>12} {'P&L %':>8}\")\n print(\"─\" * 76)\n\n total_cost = 0.0\n total_value = 0.0\n\n for ticker, asset in assets.items():\n qty = asset[\"quantity\"]\n cost = asset[\"cost_basis\"]\n price = prices.get(ticker, None)\n cost_total = qty * cost\n\n if price is not None:\n value = qty * price\n pl_dollar = value - cost_total\n pl_pct = (pl_dollar / cost_total) * 100\n sign = \"+\" if pl_dollar >= 0 else \"\"\n print(f\"{ticker:\u003c12} {qty:>8.4f} {cost:>10.2f} {price:>10.2f} {value:>12,.2f} {sign}{pl_dollar:>11,.2f} {sign}{pl_pct:>7.1f}%\")\n total_value += value\n else:\n print(f\"{ticker:\u003c12} {qty:>8.4f} {cost:>10.2f} {'N/A':>10} {'N/A':>12} {'N/A':>12} {'N/A':>8}\")\n\n total_cost += cost_total\n\n print(\"─\" * 76)\n total_pl = total_value - total_cost\n total_pl_pct = (total_pl / total_cost * 100) if total_cost > 0 else 0\n sign = \"+\" if total_pl >= 0 else \"\"\n print(f\"{'TOTAL':\u003c12} {'':>8} {'':>10} {'':>10} {total_value:>12,.2f} {sign}{total_pl:>11,.2f} {sign}{total_pl_pct:>7.1f}%\")\n print(f\"\\n💰 Total Cost Basis: ${total_cost:,.2f}\")\n print(f\"📈 Total Value: ${total_value:,.2f}\")\n emoji = \"📈\" if total_pl >= 0 else \"📉\"\n print(f\"{emoji} Total P&L: {sign}${abs(total_pl):,.2f} ({sign}{total_pl_pct:.1f}%)\")\n\n\ndef cmd_delete(args):\n data = load_portfolios()\n name = args.name\n if name not in data[\"portfolios\"]:\n print(f\"❌ Portfolio '{name}' not found.\")\n sys.exit(1)\n del data[\"portfolios\"][name]\n if data.get(\"active\") == name:\n remaining = list(data[\"portfolios\"].keys())\n data[\"active\"] = remaining[0] if remaining else None\n save_portfolios(data)\n print(f\"✅ Deleted portfolio: '{name}'\")\n\n\ndef cmd_rename(args):\n data = load_portfolios()\n old, new = args.old_name, args.new_name\n if old not in data[\"portfolios\"]:\n print(f\"❌ Portfolio '{old}' not found.\")\n sys.exit(1)\n data[\"portfolios\"][new] = data[\"portfolios\"].pop(old)\n if data.get(\"active\") == old:\n data[\"active\"] = new\n save_portfolios(data)\n print(f\"✅ Renamed '{old}' → '{new}'\")\n\n\n# ─── Main ────────────────────────────────────────────────────────────────────\n\ndef main():\n parser = argparse.ArgumentParser(description=\"Portfolio management with live AIsa pricing\")\n sub = parser.add_subparsers(dest=\"command\", required=True)\n\n p_create = sub.add_parser(\"create\", help=\"Create a new portfolio\")\n p_create.add_argument(\"name\")\n\n sub.add_parser(\"list\", help=\"List all portfolios\")\n\n p_show = sub.add_parser(\"show\", help=\"Show portfolio with live P&L\")\n p_show.add_argument(\"--portfolio\", default=None)\n\n p_add = sub.add_parser(\"add\", help=\"Add asset to portfolio\")\n p_add.add_argument(\"ticker\")\n p_add.add_argument(\"--quantity\", type=float, required=True)\n p_add.add_argument(\"--cost\", type=float, required=True, help=\"Cost per share/unit\")\n p_add.add_argument(\"--portfolio\", default=None)\n\n p_update = sub.add_parser(\"update\", help=\"Update asset quantity or cost\")\n p_update.add_argument(\"ticker\")\n p_update.add_argument(\"--quantity\", type=float, default=None)\n p_update.add_argument(\"--cost\", type=float, default=None)\n p_update.add_argument(\"--portfolio\", default=None)\n\n p_remove = sub.add_parser(\"remove\", help=\"Remove asset from portfolio\")\n p_remove.add_argument(\"ticker\")\n p_remove.add_argument(\"--portfolio\", default=None)\n\n p_delete = sub.add_parser(\"delete\", help=\"Delete a portfolio\")\n p_delete.add_argument(\"name\")\n\n p_rename = sub.add_parser(\"rename\", help=\"Rename a portfolio\")\n p_rename.add_argument(\"old_name\")\n p_rename.add_argument(\"new_name\")\n\n args = parser.parse_args()\n\n commands = {\n \"create\": cmd_create,\n \"list\": cmd_list,\n \"show\": cmd_show,\n \"add\": cmd_add,\n \"update\": cmd_update,\n \"remove\": cmd_remove,\n \"delete\": cmd_delete,\n \"rename\": cmd_rename,\n }\n commands[args.command](args)\n\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":11729,"content_sha256":"0ef5fee40ecac4cf5ba8f9df4baed57c380b9cfa9da54d75bcb11afc2e7552c0"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Portfolio Management — AIsa Edition","type":"text"}]},{"type":"paragraph","content":[{"text":"Manage investment portfolios with live P&L tracking using the AIsa API.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Usage","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Create a new portfolio\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" create \"My Portfolio\"\n\n# Add a position\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" add AAPL --quantity 10 --cost 150\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" add BTC-USD --quantity 0.5 --cost 40000\n\n# Show portfolio with live P&L\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" show\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" show --portfolio \"My Portfolio\"\n\n# Update a position\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" update AAPL --quantity 15 --cost 160\n\n# Remove a position\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" remove AAPL\n\n# List all portfolios\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" list\n\n# Rename a portfolio\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" rename \"My Portfolio\" \"Tech Holdings\"\n\n# Delete a portfolio\npython3 \"${CLAUDE_PLUGIN_ROOT}/skills/stock-portfolio/scripts/portfolio.py\" delete \"Old Portfolio\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Actions","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Action","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Description","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"create NAME","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create a new portfolio","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"list","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"List all portfolios","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"show","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Show portfolio summary with live P&L","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"add TICKER","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Add position with ","type":"text"},{"text":"--quantity","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"--cost","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"update TICKER","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Update position quantity/cost","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"remove TICKER","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Remove position from portfolio","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"rename OLD NEW","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rename a portfolio","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"delete NAME","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Delete a portfolio","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Data Storage","type":"text"}]},{"type":"paragraph","content":[{"text":"Portfolio data is stored in ","type":"text"},{"text":"${CLAUDE_PLUGIN_DATA}/portfolios.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" for persistence across sessions.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"NOT FINANCIAL ADVICE.","type":"text","marks":[{"type":"strong"}]},{"text":" For informational purposes only.","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"stock-portfolio","author":"@skillopedia","source":{"stars":11,"repo_name":"agent-skills","origin_url":"https://github.com/aisa-team/agent-skills/blob/HEAD/stock-portfolio/SKILL.md","repo_owner":"aisa-team","body_sha256":"b92cc1a929cafb601c93db2281b1c754eebae86cfba5a3a1eebfc591aeaff0e4","cluster_key":"fbbae642b38a120a2401d5f3b20d25253cec6470179af64bfe8363b76711d620","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aisa-team/agent-skills/stock-portfolio/SKILL.md","attachments":[{"id":"d962324f-9c23-5a0e-82db-a02213d5325d","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/d962324f-9c23-5a0e-82db-a02213d5325d/attachment.py","path":"scripts/portfolio.py","size":11729,"sha256":"0ef5fee40ecac4cf5ba8f9df4baed57c380b9cfa9da54d75bcb11afc2e7552c0","contentType":"text/x-python; charset=utf-8"}],"bundle_sha256":"eccb8b9179f82ab3c945a46631aeef184b31d38851bac86c026458cffabdbd72","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"stock-portfolio/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"finance-legal-compliance","category_label":"Finance"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"finance-legal-compliance","metadata":{"aisa":{"emoji":"📊","requires":{"env":["AISA_API_KEY"],"bins":["python3"]},"primaryEnv":"AISA_API_KEY","compatibility":"Designed for Agent Skills compatible clients such as OpenClaw, Claude Code, Hermes, and GitHub-backed skill catalogs. Requires system binaries python3, environment variables AISA_API_KEY and internet access to api.aisa.one."}},"import_tag":"clean-skills-v1","description":"Manage investment portfolios with live P&L tracking via AIsa API. Create, add, update, remove positions, rename, and show portfolio summary with real-time profit/loss. Use when the user wants to track investments, manage a portfolio, check P&L, or add/remove holdings.","compatibility":"Designed for Agent Skills compatible clients such as OpenClaw, Claude Code, Hermes, and GitHub-backed skill catalogs. Requires system binaries python3, environment variables AISA_API_KEY and internet access to api.aisa.one."}},"renderedAt":1782981685971}

Portfolio Management — AIsa Edition Manage investment portfolios with live P&L tracking using the AIsa API. Usage Actions | Action | Description | |--------|-------------| | | Create a new portfolio | | | List all portfolios | | | Show portfolio summary with live P&L | | | Add position with and | | | Update position quantity/cost | | | Remove position from portfolio | | | Rename a portfolio | | | Delete a portfolio | Data Storage Portfolio data is stored in for persistence across sessions. NOT FINANCIAL ADVICE. For informational purposes only. ---