portfolio

Records stock buy and sell transactions and calculates realized and unrealized profit and loss.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/meimeitou/xshare --skill portfolio-meimeitou
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: portfolio
Source: https://github.com/meimeitou/xshare/tree/main/workspace/skills/portfolio
Command: npx skills add https://github.com/meimeitou/xshare --skill portfolio-meimeitou

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tracking personal stock holdings manually is error-prone: remembering purchase prices, computing weighted average costs across multiple buys, and calculating floating profit and loss against current prices all require tedious bookkeeping. This Skill turns natural-language statements like "I bought 1000 shares at 15" into structured portfolio records with automatic P&L analysis. ## Core Features & Use Cases - Transaction Recording: Log buy and sell actions with price, quantity, and date; the system validates that sell quantities never exceed current holdings and computes weighted average cost for repeated buys. - Holdings Overview: Retrieve the full position list with realized P&L from closed trades, then fetch latest quotes to compute floating P&L per position and in total. - Position Cleanup: Delete records for stocks you no longer want to track. - Use Case: You say "I sold 500 shares of Zijin Mining at 18" and later ask "how are my holdings doing" — the Skill records the sale, then presents a table of quantity, cost basis, current price, floating P&L, realized P&L, and portfolio totals. ## Quick Start Tell the assistant "I bought 1000 shares of Zijin Mining at 15 yuan" and then ask "how are my holdings performing" to see your profit and loss summary.

Frequently Asked Questions about portfolio

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track my stock holdings with natural language?▼

State your transaction in plain language, such as "I bought 1000 shares at 15 yuan", and the Skill resolves the stock code, extracts price and quantity, and records it via the portfolio_update tool. Ask "how are my holdings" to see a full P&L summary.

How is profit and loss calculated for stock positions?▼

Floating P&L is computed as current price times quantity minus position cost, using live quotes or the last trading day's close outside market hours. Realized P&L from sold portions is tracked separately by the portfolio_summary tool.

What happens if I buy the same stock multiple times at different prices?▼

The system automatically calculates a weighted average cost across all purchases of the same stock. Each new buy updates the position's average cost basis used for subsequent P&L calculations.

Can I sell more shares than I currently hold?▼

No. The portfolio_update tool validates sell actions and rejects any sale where the quantity exceeds your current holdings, preventing impossible position states.

Why are quotes different outside trading hours?▼

Outside trading hours, live prices are unavailable, so the Skill uses the most recent trading day's closing price for P&L calculations. The output notes that figures are based on the last close.