Skill: Portfolio Analysis
Purpose
Analyze cryptocurrency portfolio performance, calculate key metrics, and provide insights for portfolio optimization. This skill helps track holdings, measure returns, and assess risk.
When to Use
- •Reviewing portfolio performance
- •Calculating profit/loss across positions
- •Assessing portfolio risk and diversification
- •Rebalancing decisions
- •Tax reporting preparation
Workflow
Step 1: Load Portfolio
typescript
import { analyzePortfolio } from './skills/portfolio-analysis';
const analysis = await analyzePortfolio({
includeOpenPositions: true,
includeClosed: true,
dateRange: { start: '2024-01-01', end: '2024-12-31' }
});
Step 2: Performance Metrics
The skill calculates:
- •Total portfolio value
- •Unrealized P&L
- •Realized P&L
- •ROI percentage
- •Sharpe ratio
- •Maximum drawdown
Step 3: Risk Assessment
Evaluates:
- •Position concentration
- •Correlation risk
- •Volatility exposure
- •Asset allocation
Step 4: Recommendations
Provides actionable insights:
- •Rebalancing suggestions
- •Risk reduction strategies
- •Diversification opportunities
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| includeOpenPositions | boolean | true | Include current holdings |
| includeClosed | boolean | true | Include closed positions |
| dateRange | object | last 30 days | Analysis period |
| benchmark | string | 'BTC/USDT' | Benchmark for comparison |
Output
typescript
interface PortfolioAnalysis {
summary: {
totalValue: number;
totalCost: number;
unrealizedPnL: number;
realizedPnL: number;
totalPnL: number;
roiPercent: number;
};
holdings: Array<{
symbol: string;
quantity: number;
avgCost: number;
currentPrice: number;
value: number;
pnl: number;
pnlPercent: number;
allocation: number;
}>;
metrics: {
sharpeRatio: number;
maxDrawdown: number;
volatility: number;
beta: number;
};
diversification: {
score: number;
topHolding: string;
topHoldingPercent: number;
recommendations: string[];
};
}
Best Practices
- •Regular reviews - Analyze portfolio at least weekly
- •Track all transactions - Include fees and taxes
- •Compare to benchmark - Measure against BTC or market index
- •Consider correlation - Avoid over-concentration in similar assets
Example
typescript
const portfolio = await analyzePortfolio({
includeOpenPositions: true,
benchmark: 'BTC/USDT'
});
console.log(`Portfolio Value: $${portfolio.summary.totalValue}`);
console.log(`Total ROI: ${portfolio.summary.roiPercent}%`);
console.log(`Sharpe Ratio: ${portfolio.metrics.sharpeRatio}`);