AI Agent Hub
Back to skills
Stock Portfolio Analysis Master icon

Stock Portfolio Analysis Master

Professional Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_fad4194b/portfolio-analysis-pro.

About this skill

Problem

Managing a stock portfolio often involves only a few concrete tasks: recording positions, refreshing prices, calculating P&L, and exporting reports. Spreadsheets become hard to maintain when positions change, prices need repeated updates, and there is no reliable audit trail. This skill organizes that workflow into callable APIs and a manager class, making it easier to build a local portfolio-analysis entry point.

Capabilities and workflow

  • Position management: supports adding, editing, and deleting positions, including stock code, name, quantity, and cost price.
  • Price updates: allows manual full-price refreshes, and optional automatic updates during trading hours. Automatic updates are limited to weekdays from 9:30-11:30 and 13:00-15:00.
  • P&L analysis: calculates total market value, total cost, total P&L, P&L percentage, per-stock P&L, and position weights, with sorting by name, code, market value, P&L amount, or P&L percentage.
  • Reports and auditability: generates Markdown reports and supports export, while also logging operation history for review.

Key entry points include APIs such as GET /api/portfolio, POST /api/portfolio/add, PUT /api/portfolio/edit-multiple/, and GET /api/portfolio/report. The underlying logic can also be reused through the PortfolioManager class.

Boundaries

This skill is focused on position tracking and analysis, not a full trading system. Price-related values use 4-decimal precision, with red indicating profit and green indicating loss. Supported stock codes cover common 6-digit Shanghai, Shenzhen, and ChiNext formats. For multi-account workflows, tax calculation, advanced risk control, or automated execution, additional systems are required.

Use Cases

  • Maintain multiple A-share positions by adding, batch editing, or deleting records with cost price.
  • Refresh all holding prices during trading hours and review total market value, total P&L, and position weights.
  • Review a past trade by querying a single stock price and checking operation history.
  • Generate a Markdown portfolio report, sort it by P&L percentage, and export the file.

Best For

  • Investment ops staff moving A-share holdings from spreadsheets into queryable APIs
  • Research assistants producing periodic P&L reports for team review
  • Python developers managing personal stock records through a local service
  • Portfolio managers auditing trade changes and cost-price updates