Communitygithub.com

retc1/personal-fund-portfolio-analysis

基金投资持仓组合分析。接收基金代码、当前市值、持仓盈亏,精确计算组合收益、回本涨幅、条件补仓金额及资产分布,默认生成两页中文可检索PDF:持仓总表与带文字标签的资产分布图。仅作有依据的数据分析,不自动生成买卖、换仓建议。 Analysis of a portfolio of fund holdings. Takes fund codes, current market values, and holding gains or losses; precisely calculates portfolio returns, the rise needed to break even, conditional top-up amounts needed to break even, and asset allocation. By default, produces a two-page searchable Chinese PDF with a holdings summary table and a labeled asset allocation chart. Provides evi

personal-fund-portfolio-analysis 是什么?

personal-fund-portfolio-analysis is a Claude Code agent skill that 基金投资持仓组合分析。接收基金代码、当前市值、持仓盈亏,精确计算组合收益、回本涨幅、条件补仓金额及资产分布,默认生成两页中文可检索PDF:持仓总表与带文字标签的资产分布图。仅作有依据的数据分析,不自动生成买卖、换仓建议。 Analysis of a portfolio of fund holdings. Takes fund codes, current market values, and holding gains or losses; precisely calculates portfolio returns, the rise needed to break even, conditional top-up amounts needed to break even, and asset allocation. By default, produces a two-page searchable Chinese PDF with a holdings summary table and a labeled asset allocation chart. Provides evi.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/retc1/skills/tree/HEAD/plugin/personal-fund-portfolio/skills/personal-fund-portfolio-analysis

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Fund Investment Portfolio Analysis

Objective and Scope

Performs a verifiable quantitative and structural analysis of a fund holding portfolio. Default output is a Chinese searchable PDF. Applicable to equity funds, hybrid funds, index funds, bond funds, money market funds, commodity funds, gold funds, etc. Assets outside funds should have their type and statistical boundary clearly defined if included.

The report presents verified data, calculation results, and necessary brief annotations only. It must not default to outputting "core judgments", "immediate actions", "priority studies", "buy/sell/swap recommendations", or "sector increase/decrease instructions"; asset structure alone does not imply trading advice. When the user requests trading decisions, a separate analysis is required, which must include real-time valuations, fundamentals, holding period, actual fees, risk tolerance, available capital, and trading opportunity costs. Otherwise, clearly state that reliable judgment is not possible, and do not present theoretical calculations as investment recommendations.

Input and Classification

  • Required: Each fund's code or name, current market value V, current accumulated holding gain/loss P (positive for profit, negative for loss); default currency is CNY; account snapshot date must be specified.
  • Optional: Fund name, fund type, primary investment category, share class, purchase and redemption records, dividends, fees, cost details, etc.
  • Sold funds are not included in current holdings; if the user provides realized losses separately, record them independently and do not automatically mix them with current holdings' market value and gain/loss.
  • Holding classification is determined based on fund contracts, periodic reports, and fund attributes explicitly provided by the user. Mark as "unclassified" if verification is not possible. The same market value can only be placed in one primary category; duplicate statistics are prohibited. Classification is a fund-level statistical grouping, not a proxy for underlying security allocation percentages.
  • If the user only provides a code without a category, public information may be verified with publicly available data; do not mislabel different input dates as actual holdings on the same day. All reports must clearly indicate the user's account snapshot date and external data dates.
  • C = V - P is the imputed current holding cost derived from the account's holding gain/loss, not necessarily the sum of all historical cash flows. When partial redemptions, dividends, or account transfers have occurred, this limitation must be stated.

Precise Calculations

Use decimal arithmetic (Decimal) for all operations; round only for display purposes. The minimum top-up amount must be rounded up to the nearest cent.

Let V = current market value of the holding, P = accumulated holding gain/loss, C = V - P, and r > 0 be the hypothetical future rise percentage from the current price.

MetricFormula
Holding return rateP / C
Rise needed to break even without top-up for a single losing fund-P / V
Additional amount needed for a single fund to break even assuming future rise rA = max(0, -P / r - V), 0 if already profitable
Rise needed to break even after top-up A-P / (V + A) (when losing)
Portfolio total market value, total gain/loss, total costΣV, ΣP, ΣC
Portfolio total return rate, overall break-even rise without top-upΣP / ΣC, -ΣP / ΣV when losing
Total top-up for each fund to break even individuallyΣ max(0, -Pᵢ / r - Vᵢ) (zero for profitable items)
Theoretical top-up to offset entire account levelmax(0, -ΣP / r - ΣV), assuming all holdings rise uniformly by r

Default scenarios: r = 10% and r = 20%; users can modify. For positive top-up amounts, verify (V + A) × (1 + r) ≥ C + A using exact decimals. Do not output additional explanations of top-up principles, sample calculations, or portfolio break-even scenario pages by default, ensuring non-professional readers can directly view the tables.

PDF Fixed Content (Two Pages Only by Default)

Unified Report Name and Cover Title: Fund Investment Portfolio Analysis. Do not use alternative main titles like "Diagnosis", "Core Judgment", or "Action Recommendations".

  1. Account Overview: Snapshot date, number of holdings, current market value, imputed cost, accumulated gain/loss, overall return rate, overall break-even rise. Present only numbers and necessary definitions; do not include investment opinions or duplicate asset allocation charts.
  2. Single Holdings Summary Table: Fund/Code | Current Market Value | Gain/Loss & Return Rate | Rise Needed to Break Even Without Top-Up | Top-Up Needed to Break Even if Future Rise 10% | Top-Up Needed to Break Even if Future Rise 20%. End the table with a brief note: the two columns of totals are calculations for each fund to break even individually, not investment advice. Use red for loss figures and green for profits; highlight individual top-up amounts ≥ CNY 10,000 in bold red and flag them as high amounts; users can modify the threshold. Amounts are precise to the cent. Do not add a column for "current action/judgment" without sufficient evidence.
  3. Asset Allocation: Include only one set of detailed horizontal bar charts with text labels. Each row directly shows the category, bar, percentage, and amount. Categories are mutually exclusive, and the sum of amounts equals the total market value. Attach a list of funds under each category, the maximum single holding percentage, and the classification methodology. Do not draw duplicate colored horizontal stacked charts on the first page or above the chart; do not include charts without text labels.

Do not generate swap analysis, timing analysis, pre/post adjustment comparisons, or inferential sector increase/decrease content by default. These belong to a separate trading research task requiring evidence and cannot be derived from market values, gains/losses, and allocation proportions alone.

Presentation and Quality

  • A4 portrait, Chinese, searchable; text in charts and tables must be clear and readable, suitable for zooming on mobile devices; page count should be content-complete, not artificially filled or expanded.
  • Use stable color schemes for categories, but category text and values must be displayed directly alongside the bars. Highlight high top-up amounts in red; do not overuse colors for ordinary amounts and titles.
  • Do not derive action opinions (e.g., "worth adding", "needs selling", "should buy broad market") from original holding losses or conditional top-up amounts; do not add general market outlook judgments.
  • PDF filename: Fund_Investment_Portfolio_Analysis_YYYY-MM-DD.pdf. Retain the snapshot date for cross-period comparison.
  • After generation, render and inspect the holdings table and category bar chart for Chinese text overlap and missing characters; verify ΣC = ΣV − ΣP and group amount conservation.

Generation Method

Utility scripts:

  • scripts/portfolio_calc.py: Decimal precision calculations and amount validation.
  • scripts/build_report_pdf.py: Reads JSON, invokes the calculation script, and generates a Chinese PDF; supports --html to output HTML for review.

Run: python scripts/build_report_pdf.py input.json output.pdf. Example input structure:

{
  "as_of": "YYYY-MM-DD",
  "currency": "CNY",
  "scenarios": ["0.10", "0.20"],
  "highlight_threshold": "10000",
  "positions": [
    {"code": "Fund Code", "name": "Fund Abbreviation", "market_value": "Current Market Value", "pnl": "Current Gain/Loss", "category": "Fund Primary Category"}
  ],
  "sold_excluded": []
}

The ZIP should contain only the generic skill, calculation, and PDF scripts, with no user holdings, historical discussions, or case-specific trading conclusions.

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相关技能