portfolio-manager by tradermonty/claude-trading-skills
npx skills add https://github.com/tradermonty/claude-trading-skills --skill portfolio-manager通过集成 Alpaca MCP 服务器获取实时持仓数据,进而对投资组合进行分析和管理。分析内容涵盖资产配置、多元化、风险指标、个股评估以及再平衡建议。生成包含可操作建议的详细投资组合报告。
此技能通过 MCP(模型上下文协议)利用 Alpaca 的经纪商 API 访问实时投资组合数据,确保分析基于实际当前持仓,而非手动输入的数据。
当用户提出以下请求时调用此技能:
此技能要求配置并连接 Alpaca MCP 服务器。MCP 服务器提供对以下内容的访问:
使用的 MCP 服务器工具:
get_account_info - 获取账户权益、购买力、现金余额get_positions - 检索所有当前持仓,包括数量、成本基础、市场价值get_portfolio_history - 历史投资组合绩效数据广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果 Alpaca MCP 服务器未连接,请通知用户并提供 references/alpaca_mcp_setup.md 中的设置说明。
使用 Alpaca MCP 服务器工具收集当前投资组合信息:
1.1 获取账户信息:
Use mcp__alpaca__get_account_info to fetch:
- Account equity (total portfolio value)
- Cash balance
- Buying power
- Account status
1.2 获取当前持仓:
Use mcp__alpaca__get_positions to fetch all holdings:
- Symbol ticker
- Quantity held
- Average entry price (cost basis)
- Current market price
- Current market value
- Unrealized P&L ($ and %)
- Position size as % of portfolio
1.3 获取投资组合历史记录(可选):
Use mcp__alpaca__get_portfolio_history for performance analysis:
- Historical equity values
- Time-weighted return calculation
- Drawdown analysis
数据验证:
针对投资组合中的每个持仓,收集额外的市场数据和基本面信息:
2.1 当前市场数据:
2.2 基本面数据: 使用 WebSearch 或可用的市场数据 API 获取:
2.3 技术分析:
使用参考文件中的框架进行全面的投资组合分析:
阅读 references/asset-allocation.md 以了解配置框架
从多个维度分析当前配置:
按资产类别:
按行业板块:
按市值:
按地域:
输出格式:
## Asset Allocation
### Current Allocation vs Target
| Asset Class | Current | Target | Variance |
|-------------|---------|--------|----------|
| US Equities | XX.X% | YY.Y% | +/- Z.Z% |
| ... |
### Sector Breakdown
[Pie chart description or table with sector percentages]
### Top 10 Holdings
| Rank | Symbol | % of Portfolio | Sector |
|------|--------|----------------|--------|
| 1 | AAPL | X.X% | Technology |
| ... |
阅读 references/diversification-principles.md 以了解多元化理论
评估投资组合的多元化质量:
持仓集中度:
行业集中度:
相关性分析:
持仓数量:
输出:
## Diversification Assessment
**Concentration Risk:** [Low / Medium / High]
- Top 5 holdings represent XX% of portfolio
- Largest single position: [SYMBOL] at XX%
**Sector Diversification:** [Excellent / Good / Fair / Poor]
- Dominant sector: [Sector Name] at XX%
- [Assessment of balance across sectors]
**Position Count:** [Optimal / Under-diversified / Over-diversified]
- Total positions: XX stocks
- [Recommendation]
**Correlation Concerns:**
- [List any highly correlated position pairs]
- [Diversification improvement suggestions]
阅读 references/portfolio-risk-metrics.md 以了解风险度量框架
计算并解释关键风险指标:
波动性度量:
下行风险:
风险集中度:
尾部风险:
输出:
## Risk Assessment
**Overall Risk Profile:** [Conservative / Moderate / Aggressive]
**Portfolio Beta:** X.XX (vs market at 1.00)
- Interpretation: Portfolio is [more/less] volatile than market
**Maximum Drawdown:** -XX.X% (from $XXX,XXX to $XXX,XXX)
- Current drawdown from peak: -XX.X%
**High-Risk Positions:**
| Symbol | % of Portfolio | Beta | Risk Factor |
|--------|----------------|------|-------------|
| [TICKER] | XX% | X.XX | [High volatility / Recent loss / etc] |
**Risk Concentrations:**
- XX% in single sector ([Sector])
- XX% in stocks with beta > 1.5
- [Other concentration risks]
**Risk Score:** XX/100 ([Low/Medium/High] risk)
使用可用数据评估投资组合绩效:
绝对回报:
时间加权回报(如有历史记录):
持仓层面绩效:
输出:
## Performance Review
**Total Portfolio Value:** $XXX,XXX
**Total Unrealized P&L:** $XX,XXX (+XX.X%)
**Cash Balance:** $XX,XXX (XX% of portfolio)
**Best Performers:**
| Symbol | Gain | Position Value |
|--------|------|----------------|
| [TICKER] | +XX.X% | $XX,XXX |
| ... |
**Worst Performers:**
| Symbol | Loss | Position Value |
|--------|------|----------------|
| [TICKER] | -XX.X% | $XX,XXX |
| ... |
**Performance vs Benchmark (if available):**
- Portfolio return: +X.X%
- S&P 500 return: +Y.Y%
- Alpha: +/- Z.Z%
针对关键持仓(按投资组合权重前 10-15 名),进行详细分析:
阅读 references/position-evaluation.md 以了解持仓分析框架
对于每个重要持仓:
4.1 当前投资逻辑验证:
4.2 估值评估:
4.3 技术健康状况:
4.4 持仓规模:
4.5 操作建议:
每个持仓的输出:
### [SYMBOL] - [Company Name] (XX.X% of portfolio)
**Position Details:**
- Shares: XXX
- Avg Cost: $XX.XX
- Current Price: $XX.XX
- Market Value: $XX,XXX
- Unrealized P/L: $X,XXX (+XX.X%)
**Fundamental Snapshot:**
- Sector: [Sector]
- Market Cap: $XX.XB
- P/E: XX.X | Dividend Yield: X.X%
- Recent developments: [Key news or earnings]
**Technical Status:**
- Trend: [Uptrend / Downtrend / Sideways]
- Price vs 50-day MA: [Above/Below by XX%]
- Support: $XX.XX | Resistance: $XX.XX
**Position Assessment:**
- **Thesis Status:** [Intact / Weakening / Broken / Strengthening]
- **Valuation:** [Undervalued / Fair / Overvalued]
- **Position Sizing:** [Optimal / Overweight / Underweight]
**Recommendation:** [HOLD / ADD / TRIM / SELL]
**Rationale:** [1-2 sentence explanation]
阅读 references/rebalancing-strategies.md 以了解再平衡方法
生成具体的再平衡建议:
5.1 识别再平衡触发点:
5.2 制定再平衡计划:
需要减持的持仓:
需要增持的持仓:
现金部署:
5.3 优先级排序: 按优先级对再平衡操作进行排序:
输出:
## Rebalancing Recommendations
### Summary
- **Rebalancing Needed:** [Yes / No / Optional]
- **Primary Reason:** [Concentration risk / Sector drift / Cash deployment / etc]
- **Estimated Trades:** X sell orders, Y buy orders
### Recommended Actions
#### HIGH PRIORITY: Risk Reduction
**TRIM [SYMBOL]** from XX% to YY% of portfolio
- **Shares to Sell:** XX shares (~$XX,XXX)
- **Rationale:** [Overweight / Valuation extended / etc]
- **Tax Impact:** $X,XXX capital gain (est)
#### MEDIUM PRIORITY: Asset Allocation
**ADD [Sector/Asset Class]** exposure
- **Target:** Increase from XX% to YY%
- **Suggested Stocks:** [SYMBOL1, SYMBOL2, SYMBOL3]
- **Amount to Invest:** ~$XX,XXX
#### CASH DEPLOYMENT
**Current Cash:** $XX,XXX (XX% of portfolio)
- **Recommendation:** [Deploy / Keep for opportunities / Reduce to X%]
- **Suggested Allocation:** [Distribution across sectors/stocks]
### Implementation Plan
1. [First action - highest priority]
2. [Second action]
3. [Third action]
...
**Timing Considerations:**
- [Tax year-end planning / Earnings season / Market conditions]
- [Suggested phasing if applicable]
创建全面的 Markdown 报告并保存到仓库根目录:
文件名: portfolio_analysis_YYYY-MM-DD.md
报告结构:
# Portfolio Analysis Report
**Account:** [Account type if available]
**Report Date:** YYYY-MM-DD
**Portfolio Value:** $XXX,XXX
**Total P&L:** $XX,XXX (+XX.X%)
---
## Executive Summary
[3-5 bullet points summarizing key findings]
- Overall portfolio health assessment
- Major strengths
- Key risks or concerns
- Primary recommendations
---
## Holdings Overview
[Summary table of all positions]
---
## Asset Allocation
[Section from Step 3.1]
---
## Diversification Analysis
[Section from Step 3.2]
---
## Risk Assessment
[Section from Step 3.3]
---
## Performance Review
[Section from Step 3.4]
---
## Position Analysis
[Detailed analysis of top 10-15 positions from Step 4]
---
## Rebalancing Recommendations
[Section from Step 5]
---
## Action Items
**Immediate Actions:**
- [ ] [Action 1]
- [ ] [Action 2]
**Medium-Term Actions:**
- [ ] [Action 3]
- [ ] [Action 4]
**Monitoring Priorities:**
- [ ] [Watch list item 1]
- [ ] [Watch list item 2]
---
## Appendix: Full Holdings
[Complete table with all positions and metrics]
准备好回答后续问题:
常见问题:
"为什么我应该卖出 [SYMBOL]?"
"我应该买什么来代替?"
"我最大的风险是什么?"
"我的投资组合与 [基准] 相比如何?"
"我应该现在再平衡还是等待?"
"你能更详细地分析 [特定持仓] 吗?"
此技能包含针对不同投资者画像的参考配置模型:
阅读 references/target-allocations.md 以了解详细模型:
每个模型包括:
当用户未指定其配置策略时,使用这些作为比较基准。
如果用户的目标配置未知,则根据以下因素评估适当的风险承受能力:
阅读 references/risk-profile-questionnaire.md 以了解评估框架
语气和风格:
数据呈现:
建议清晰度:
视觉描述:
在分析过程中根据需要加载这些参考文件:
references/alpaca-mcp-setup.md
references/asset-allocation.md
references/diversification-principles.md
references/portfolio-risk-metrics.md
references/position-evaluation.md
references/rebalancing-strategies.md
references/target-allocations.md
references/risk-profile-questionnaire.md
如果 Alpaca MCP 服务器未连接:
如果 API 返回不完整数据:
如果持仓数据似乎过时:
如果用户没有持仓:
识别具有未实现亏损、适合进行税务亏损收割的持仓:
针对持有派息股票的投资组合:
针对持有 5-20 个持仓的投资组合:
模拟投资组合在不同情景下的表现:
基本投资组合回顾:
配置分析:
风险评估:
再平衡:
绩效:
特定持仓:
在所有报告中包含:
此分析仅供参考,不构成财务建议。投资决策应基于个人情况、风险承受能力和财务目标做出。过往业绩不保证未来结果。在进行投资决策前,请咨询合格的财务顾问。
数据准确性取决于 Alpaca API 和第三方市场数据源。请独立核实关键信息。税务影响仅为估计值;具体指导请咨询税务专业人士。
每周安装量
293
仓库
GitHub 星标数
394
首次出现
Jan 26, 2026
安全审计
安装于
opencode280
gemini-cli279
codex276
cursor275
github-copilot274
kimi-cli270
Analyze and manage investment portfolios by integrating with Alpaca MCP Server to fetch real-time holdings data, then performing comprehensive analysis covering asset allocation, diversification, risk metrics, individual position evaluation, and rebalancing recommendations. Generate detailed portfolio reports with actionable insights.
This skill leverages Alpaca's brokerage API through MCP (Model Context Protocol) to access live portfolio data, ensuring analysis is based on actual current positions rather than manually entered data.
Invoke this skill when the user requests:
This skill requires Alpaca MCP Server to be configured and connected. The MCP server provides access to:
MCP Server Tools Used:
get_account_info - Fetch account equity, buying power, cash balanceget_positions - Retrieve all current positions with quantities, cost basis, market valueget_portfolio_history - Historical portfolio performance dataIf Alpaca MCP Server is not connected, inform the user and provide setup instructions from references/alpaca_mcp_setup.md.
Use Alpaca MCP Server tools to gather current portfolio information:
1.1 Get Account Information:
Use mcp__alpaca__get_account_info to fetch:
- Account equity (total portfolio value)
- Cash balance
- Buying power
- Account status
1.2 Get Current Positions:
Use mcp__alpaca__get_positions to fetch all holdings:
- Symbol ticker
- Quantity held
- Average entry price (cost basis)
- Current market price
- Current market value
- Unrealized P&L ($ and %)
- Position size as % of portfolio
1.3 Get Portfolio History (Optional):
Use mcp__alpaca__get_portfolio_history for performance analysis:
- Historical equity values
- Time-weighted return calculation
- Drawdown analysis
Data Validation:
For each position in the portfolio, gather additional market data and fundamentals:
2.1 Current Market Data:
2.2 Fundamental Data: Use WebSearch or available market data APIs to fetch:
2.3 Technical Analysis:
Perform comprehensive portfolio analysis using frameworks from reference files:
Read references/asset-allocation.md for allocation frameworks
Analyze current allocation across multiple dimensions:
By Asset Class:
By Sector:
By Market Cap:
By Geography:
Output Format:
## Asset Allocation
### Current Allocation vs Target
| Asset Class | Current | Target | Variance |
|-------------|---------|--------|----------|
| US Equities | XX.X% | YY.Y% | +/- Z.Z% |
| ... |
### Sector Breakdown
[Pie chart description or table with sector percentages]
### Top 10 Holdings
| Rank | Symbol | % of Portfolio | Sector |
|------|--------|----------------|--------|
| 1 | AAPL | X.X% | Technology |
| ... |
Read references/diversification-principles.md for diversification theory
Evaluate portfolio diversification quality:
Position Concentration:
Sector Concentration:
Correlation Analysis:
Number of Positions:
Output:
## Diversification Assessment
**Concentration Risk:** [Low / Medium / High]
- Top 5 holdings represent XX% of portfolio
- Largest single position: [SYMBOL] at XX%
**Sector Diversification:** [Excellent / Good / Fair / Poor]
- Dominant sector: [Sector Name] at XX%
- [Assessment of balance across sectors]
**Position Count:** [Optimal / Under-diversified / Over-diversified]
- Total positions: XX stocks
- [Recommendation]
**Correlation Concerns:**
- [List any highly correlated position pairs]
- [Diversification improvement suggestions]
Read references/portfolio-risk-metrics.md for risk measurement frameworks
Calculate and interpret key risk metrics:
Volatility Measures:
Downside Risk:
Risk Concentration:
Tail Risk:
Output:
## Risk Assessment
**Overall Risk Profile:** [Conservative / Moderate / Aggressive]
**Portfolio Beta:** X.XX (vs market at 1.00)
- Interpretation: Portfolio is [more/less] volatile than market
**Maximum Drawdown:** -XX.X% (from $XXX,XXX to $XXX,XXX)
- Current drawdown from peak: -XX.X%
**High-Risk Positions:**
| Symbol | % of Portfolio | Beta | Risk Factor |
|--------|----------------|------|-------------|
| [TICKER] | XX% | X.XX | [High volatility / Recent loss / etc] |
**Risk Concentrations:**
- XX% in single sector ([Sector])
- XX% in stocks with beta > 1.5
- [Other concentration risks]
**Risk Score:** XX/100 ([Low/Medium/High] risk)
Evaluate portfolio performance using available data:
Absolute Returns:
Time-Weighted Returns (if history available):
Position-Level Performance:
Output:
## Performance Review
**Total Portfolio Value:** $XXX,XXX
**Total Unrealized P&L:** $XX,XXX (+XX.X%)
**Cash Balance:** $XX,XXX (XX% of portfolio)
**Best Performers:**
| Symbol | Gain | Position Value |
|--------|------|----------------|
| [TICKER] | +XX.X% | $XX,XXX |
| ... |
**Worst Performers:**
| Symbol | Loss | Position Value |
|--------|------|----------------|
| [TICKER] | -XX.X% | $XX,XXX |
| ... |
**Performance vs Benchmark (if available):**
- Portfolio return: +X.X%
- S&P 500 return: +Y.Y%
- Alpha: +/- Z.Z%
For key positions (top 10-15 by portfolio weight), perform detailed analysis:
Read references/position-evaluation.md for position analysis framework
For each significant position:
4.1 Current Thesis Validation:
4.2 Valuation Assessment:
4.3 Technical Health:
4.4 Position Sizing:
4.5 Action Recommendation:
Output per position:
### [SYMBOL] - [Company Name] (XX.X% of portfolio)
**Position Details:**
- Shares: XXX
- Avg Cost: $XX.XX
- Current Price: $XX.XX
- Market Value: $XX,XXX
- Unrealized P/L: $X,XXX (+XX.X%)
**Fundamental Snapshot:**
- Sector: [Sector]
- Market Cap: $XX.XB
- P/E: XX.X | Dividend Yield: X.X%
- Recent developments: [Key news or earnings]
**Technical Status:**
- Trend: [Uptrend / Downtrend / Sideways]
- Price vs 50-day MA: [Above/Below by XX%]
- Support: $XX.XX | Resistance: $XX.XX
**Position Assessment:**
- **Thesis Status:** [Intact / Weakening / Broken / Strengthening]
- **Valuation:** [Undervalued / Fair / Overvalued]
- **Position Sizing:** [Optimal / Overweight / Underweight]
**Recommendation:** [HOLD / ADD / TRIM / SELL]
**Rationale:** [1-2 sentence explanation]
Read references/rebalancing-strategies.md for rebalancing approaches
Generate specific rebalancing recommendations:
5.1 Identify Rebalancing Triggers:
5.2 Develop Rebalancing Plan:
Positions to TRIM:
Positions to ADD:
Cash Deployment:
5.3 Prioritization: Rank rebalancing actions by priority:
Output:
## Rebalancing Recommendations
### Summary
- **Rebalancing Needed:** [Yes / No / Optional]
- **Primary Reason:** [Concentration risk / Sector drift / Cash deployment / etc]
- **Estimated Trades:** X sell orders, Y buy orders
### Recommended Actions
#### HIGH PRIORITY: Risk Reduction
**TRIM [SYMBOL]** from XX% to YY% of portfolio
- **Shares to Sell:** XX shares (~$XX,XXX)
- **Rationale:** [Overweight / Valuation extended / etc]
- **Tax Impact:** $X,XXX capital gain (est)
#### MEDIUM PRIORITY: Asset Allocation
**ADD [Sector/Asset Class]** exposure
- **Target:** Increase from XX% to YY%
- **Suggested Stocks:** [SYMBOL1, SYMBOL2, SYMBOL3]
- **Amount to Invest:** ~$XX,XXX
#### CASH DEPLOYMENT
**Current Cash:** $XX,XXX (XX% of portfolio)
- **Recommendation:** [Deploy / Keep for opportunities / Reduce to X%]
- **Suggested Allocation:** [Distribution across sectors/stocks]
### Implementation Plan
1. [First action - highest priority]
2. [Second action]
3. [Third action]
...
**Timing Considerations:**
- [Tax year-end planning / Earnings season / Market conditions]
- [Suggested phasing if applicable]
Create comprehensive markdown report saved to repository root:
Filename: portfolio_analysis_YYYY-MM-DD.md
Report Structure:
# Portfolio Analysis Report
**Account:** [Account type if available]
**Report Date:** YYYY-MM-DD
**Portfolio Value:** $XXX,XXX
**Total P&L:** $XX,XXX (+XX.X%)
---
## Executive Summary
[3-5 bullet points summarizing key findings]
- Overall portfolio health assessment
- Major strengths
- Key risks or concerns
- Primary recommendations
---
## Holdings Overview
[Summary table of all positions]
---
## Asset Allocation
[Section from Step 3.1]
---
## Diversification Analysis
[Section from Step 3.2]
---
## Risk Assessment
[Section from Step 3.3]
---
## Performance Review
[Section from Step 3.4]
---
## Position Analysis
[Detailed analysis of top 10-15 positions from Step 4]
---
## Rebalancing Recommendations
[Section from Step 5]
---
## Action Items
**Immediate Actions:**
- [ ] [Action 1]
- [ ] [Action 2]
**Medium-Term Actions:**
- [ ] [Action 3]
- [ ] [Action 4]
**Monitoring Priorities:**
- [ ] [Watch list item 1]
- [ ] [Watch list item 2]
---
## Appendix: Full Holdings
[Complete table with all positions and metrics]
Be prepared to answer follow-up questions:
Common Questions:
"Why should I sell [SYMBOL]?"
"What should I buy instead?"
"What's my biggest risk?"
"How does my portfolio compare to [benchmark]?"
"Should I rebalance now or wait?"
"Can you analyze [specific position] in more detail?"
This skill includes reference allocation models for different investor profiles:
Read references/target-allocations.md for detailed models:
Each model includes:
Use these as comparison benchmarks when user hasn't specified their allocation strategy.
If user's target allocation is unknown, assess appropriate risk profile based on:
Read references/risk-profile-questionnaire.md for assessment framework
Tone and Style:
Data Presentation:
Recommendation Clarity:
Visual Descriptions:
Load these references as needed during analysis:
references/alpaca-mcp-setup.md
references/asset-allocation.md
references/diversification-principles.md
references/portfolio-risk-metrics.md
references/position-evaluation.md
references/rebalancing-strategies.md
references/target-allocations.md
references/risk-profile-questionnaire.md
If Alpaca MCP Server is not connected:
If API returns incomplete data:
If position data seems stale:
If user has no positions:
Identify positions with unrealized losses suitable for tax-loss harvesting:
For portfolios with dividend-paying stocks:
For portfolios with 5-20 positions:
Model portfolio behavior under different scenarios:
Basic Portfolio Review:
Allocation Analysis:
Risk Assessment:
Rebalancing:
Performance:
Position-Specific:
Include in all reports:
This analysis is for informational purposes only and does not constitute financial advice. Investment decisions should be made based on individual circumstances, risk tolerance, and financial goals. Past performance does not guarantee future results. Consult with a qualified financial advisor before making investment decisions.
Data accuracy depends on Alpaca API and third-party market data sources. Verify critical information independently. Tax implications are estimates only; consult a tax professional for specific guidance.
Weekly Installs
293
Repository
GitHub Stars
394
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode280
gemini-cli279
codex276
cursor275
github-copilot274
kimi-cli270
Python PDF处理教程:合并拆分、提取文本表格、创建PDF文件
55,400 周安装