fund-assistant

fund-assistant

Fund investment assistant. Query real-time fund valuations, NAVs, and price changes; search funds (by name or code); manage portfolios (add/remove holdings, record transactions, calculate returns); view market indices, capital flows, and northbound capital; import and export holding data. Supports multi-user data isolation. Trigger words: fund, NAV, valuation, portfolio, holdings, returns, AIP, market, northbound capital, CSI 300.

5stars
0forks
Updated 2/9/2026
SKILL.md
read-only
name
fund-assistant
description

Fund investment assistant. Query real-time fund valuations, NAVs, and price changes; search funds (by name or code); manage portfolios (add/remove holdings, record transactions, calculate returns); view market indices, capital flows, and northbound capital; import and export holding data. Supports multi-user data isolation. Trigger words: fund, NAV, valuation, portfolio, holdings, returns, AIP, market, northbound capital, CSI 300.

Fund Investment Assistant

Script Commands

Fund API (scripts/fund_api.py)

python scripts/fund_api.py query 001618,000001   # Query real-time valuation
python scripts/fund_api.py search 白酒           # Search funds
python scripts/fund_api.py detail 001618         # Fund details
python scripts/fund_api.py history 001618 y      # Historical NAV (y/3y/6y/n/3n/5n)
python scripts/fund_api.py position 001618       # Holding breakdown
python scripts/fund_api.py manager 001618        # Fund manager
python scripts/fund_api.py index                 # Market indices
python scripts/fund_api.py flow                  # Capital flows
python scripts/fund_api.py north                 # Northbound capital

Portfolio Management (scripts/portfolio.py)

python scripts/portfolio.py init                 # Initialize data directory
python scripts/portfolio.py list                 # View holdings
python scripts/portfolio.py add 001618 1000 1.5  # Add holding (code shares cost)
python scripts/portfolio.py update 001618 shares=1500  # Update holding
python scripts/portfolio.py remove 001618        # Remove holding
python scripts/portfolio.py user 老婆            # Switch user
python scripts/portfolio.py users                # List all users
python scripts/portfolio.py export portfolio.json  # Export holdings
python scripts/portfolio.py import portfolio.json  # Import holdings

Data Storage

Location: .fund-assistant/users/{用户名}/portfolio.json (Project local directory)

{"funds": [{"code": "001618", "name": "天弘中证食品饮料", "shares": 1000, "cost": 1.5}]}

Detailed structure: references/storage.md

Return Calculation

// Estimated daily gain/loss (amount earned/lost today)
dailyGains = (gsz - nav) * shares;
dailyGainsRate = gszzl;  // Directly use the percentage change returned by the API

// Total portfolio gain/loss (total amount earned/lost since purchase)
costGains = (gsz - cost) * shares;
costGainsRate = ((gsz - cost) / cost) * 100;

Important Distinction:

  • Daily Return = (Estimated NAV - Yesterday's NAV) × Shares → Amount earned today
  • Holding Return = (Estimated NAV - Cost Price) × Shares → Total amount earned

Field Description:

  • nav: Yesterday's NAV (published)
  • gsz: Estimated NAV (real-time intraday)
  • gszzl: Estimated percentage change (%)
  • gztime: Valuation update time
  • cost: User buy cost price

Workflow

User Intent Execution Steps
Query fund fund_api.py query {代码} → Parse JSON output
Add holding portfolio.py add {代码} {份额} {成本}
View portfolio returns portfolio.py list → fund_api.py query {代码列表} → Calculate returns
Switch user portfolio.py user {用户名}
View market trend fund_api.py index

API Response Fields

See references/api.md for details.

Notes

  1. Run portfolio.py init to initialize the data directory before first use.
  2. Real-time valuation uses the East Money API: http://fundgz.1234567.com.cn/js/{code}.js
  3. Trading hours: 9:30-11:30, 13:00-15:00 (excluding holidays)
  4. Valuation updates for QDII funds may be delayed, and some newly issued funds may lack valuation data.