tradermonty/portfolio-manager
Comprehensive portfolio analysis using Alpaca MCP Server integration to fetch holdings and positions, then analyze asset allocation, risk metrics, individual stock positions, diversification, and generate rebalancing recommendations. Use when user requests portfolio review, position analysis, risk assessment, performance evaluation, or rebalancing suggestions for their brokerage account.
npx skills add https://github.com/tradermonty/claude-trading-skills --skill portfolio-manager
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.
Run the connection check from the repository root. Use paper credentials first;
never paste credentials into a report or commit them to the repository.
export ALPACA_API_KEY="<alpaca-key-id>"
export ALPACA_SECRET_KEY="<alpaca-secret-key>"
export ALPACA_PAPER="true"
uv run python skills/portfolio-manager/scripts/check_alpaca_connection.py
The command writes a redacted diagnostic summary to stdout and returns zero only
when the account and positions endpoints succeed. It does not create a report
file or place orders.
Use Alpaca MCP Server tools to gather current portfolio information when available. In scheduled Hermes jobs, MCP tools may not be exposed even when Alpaca credentials are present; in that case, use the Alpaca REST API directly with ALPACA_API_KEY, ALPACA_SECRET_KEY, and ALPACA_PAPER.
1.1 Get Account Information:
Preferred: use mcp__alpaca__get_account_info to fetch:
- Account equity (total portfolio value)
- Cash balance
- Buying power
- Account status
Fallback REST endpoints:
- paper: https://paper-api.alpaca.markets/v2/account
- live: https://api.alpaca.markets/v2/account
Headers:
- APCA-API-KEY-ID=$ALPACA_API_KEY
- APCA-API-SECRET-KEY=$ALPACA_SECRET_KEY
1.2 Get Current Positions:
Preferred: 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
Fallback REST endpoints:
- paper: https://paper-api.alpaca.markets/v2/positions
- live: https://api.alpaca.markets/v2/positions
1.3 Get Portfolio History (Optional):
Preferred: use mcp__alpaca__get_portfolio_history for performance analysis:
- Historical equity values
- Time-weighted return calculation
- Drawdown analysis
Fallback REST endpoint:
- /v2/account/portfolio/history
Scheduled-job fallback discipline:
Alpaca REST fallback rather than MCP.ALPACA_PAPER=true to choose paper endpoint; otherwise use live endpoint.long_market_value > equity.gross_long_exposure = long_market_value / equity, cash_pct = cash / equity, and explicitly flag margin-funded portfolios when gross exposure is materially above 100% or cash is negative. Do not let sector weights look benign by using only gross-long denominator when the account is levered.kanchi-dividend-review-monitor rather than treating dividend review as a narrative-only section. Also build tax-planning input for kanchi-dividend-us-tax-accounting when account-location notes are requested; label it degraded if account type or holding-period windows are unavailable.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 (illustrative values):
## Asset Allocation
### Current Allocation vs Target
| Asset Class | Current | Target | Variance |
|-------------|---------|--------|----------|
| US Equities | 70.0% | 60.0% | +10.0 pp |
### Sector Breakdown
[Pie chart description or table with sector percentages]
### Top 10 Holdings
| Rank | Symbol | % of Portfolio | Sector |
|------|--------|----------------|--------|
| 1 | AAPL | 8.5% | Technology |
Read references/diversification-principles.md for diversification theory
Evaluate portfolio diversification quality:
Position Concentration:
Sector Concentration:
Correlation Analysis:
Number of Positions:
Output (illustrative values):
## Diversification Assessment
**Concentration Risk:** [Low / Medium / High]
- Top 5 holdings represent 42% of portfolio
- Largest single position: AAPL at 12%
**Sector Diversification:** [Excellent / Good / Fair / Poor]
- Dominant sector: Technology at 31%
- [Assessment of balance across sectors]
**Position Count:** [Optimal / Under-diversified / Over-diversified]
- Total positions: 18 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 (illustrative values):
## Risk Assessment
**Overall Risk Profile:** [Conservative / Moderate / Aggressive]
**Portfolio Beta:** 1.12 (vs market at 1.00)
- Interpretation: Portfolio is [more/less] volatile than market
**Maximum Drawdown:** -14.2% (from $125,000 to $107,250)
- Current drawdown from peak: -6.3%
**High-Risk Positions:**
| Symbol | % of Portfolio | Beta | Risk Factor |
|--------|----------------|------|-------------|
| NVDA | 11% | 1.65 | High volatility |
**Risk Concentrations:**
- 31% in a single sector (Technology)
- 18% in stocks with beta above 1.5
- [Other concentration risks]
**Risk Score:** 68/100 (Medium risk)
Evaluate portfolio performance using available data:
Absolute Returns:
Time-Weighted Returns (if history available):
Position-Level Performance:
Output (illustrative values):
## Performance Review
**Total Portfolio Value:** $100,000
**Total Unrealized P&L:** $8,500 (+9.3%)
**Cash Balance:** $5,000 (5% of portfolio)
**Best Performers:**
| Symbol | Gain | Position Value |
|--------|------|----------------|
| AAPL | +22.4% | $12,240 |
**Worst Performers:**
| Symbol | Loss | Position Value |
|--------|------|----------------|
| INTC | -12.0% | $6,600 |
**Performance vs Benchmark (illustrative values):**
- Portfolio return: +9.3%
- S&P 500 return: +7.8%
- Alpha: +1.5 percentage points
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 (illustrative values):
### AAPL - Apple Inc. (8.5% of portfolio)
**Position Details:**
- Shares: 50
- Avg Cost: $150.00
- Current Price: $170.00
- Market Value: $8,500
- Unrealized P/L: $1,000 (+13.3%)
**Fundamental Snapshot:**
- Sector: [Sector]
- Market Cap: $3.2T
- P/E: 31.4 | Dividend Yield: 0.5%
- Recent developments: [Key news or earnings]
**Technical Status:**
- Trend: [Uptrend / Downtrend / Sideways]
- Price vs 50-day MA: Above by 4.2%
- Support: $162.00 | Resistance: $176.00
**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 (illustrative values):
## Rebalancing Recommendations
### Summary
- **Rebalancing Needed:** [Yes / No / Optional]
- **Primary Reason:** [Concentration risk / Sector drift / Cash deployment / etc]
- **Estimated Trades:** 2 sell orders, 3 buy orders
### Recommended Actions
#### HIGH PRIORITY: Risk Reduction
**TRIM NVDA** from 18% to 12% of portfolio
- **Shares to Sell:** 25 shares (about $3,000)
- **Rationale:** [Overweight / Valuation extended / etc]
- **Tax Impact:** $600 capital gain (estimate)
#### MEDIUM PRIORITY: Asset Allocation
**ADD investment-grade bond exposure**
- **Target:** Increase from 10% to 20%
- **Suggested Securities:** [Select liquid securities that fit the user's mandate]
- **Amount to Invest:** About $10,000
#### CASH DEPLOYMENT
**Current Cash:** $5,000 (5% of portfolio)
- **Recommendation:** [Deploy / Keep for opportunities / Reduce to target]
- **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:** 2026-07-25
**Portfolio Value:** $100,000
**Total P&L:** $8,500 (+9.3%)
---
## 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.*
Take tradermonty/portfolio-manager from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.