Install
openclaw skills install crypto-safe-portfolio-analyzer-proSafe cryptocurrency portfolio tracking and P&L analysis. Monitors portfolio value, calculates profit/loss with custom cost basis, tracks live prices via CoinGecko, and generates detailed reports. Use for portfolio performance tracking, P&L calculation, position monitoring, allocation analysis, and market overviews.
openclaw skills install crypto-safe-portfolio-analyzer-proTrack cryptocurrency portfolios, calculate P&L with custom cost basis, and generate comprehensive reports with live market data.
This skill provides professional-grade portfolio tracking for cryptocurrency investors. It fetches live prices from CoinGecko, calculates accurate P&L based on your cost basis, and generates detailed reports showing position breakdown, allocations, and performance metrics.
Key Features:
For a quick portfolio analysis, provide holdings as a JSON object:
python3 scripts/portfolio-analyzer.py portfolio --holdings '{"BTC": 1.5, "ETH": 10.2, "SOL": 50, "DOGE": 10000}'
Expected Output:
📊 CRYPTO PORTFOLIO REPORT
==================================================
💰 Total Value: $125,750.50
🟢 Total P&L: $15,750.50 (+14.32%)
📈 POSITION BREAKDOWN:
BTC:
💵 Value: $89,237.50 (71.0% of portfolio)
🟢 P&L: $8,987.50 (+11.20%)
🔴 24h: -3.92%
Get sentiment and price overview for your watchlist:
python3 scripts/portfolio-analyzer.py market
For advanced features like cost basis tracking, create portfolio-config.json:
{
"cost_basis": {
"BTC": 45000,
"ETH": 2800,
"SOL": 85
},
"watchlist": ["BTC", "ETH", "SOL", "DOGE", "XRP"],
"target_allocation": {
"BTC": 40,
"ETH": 30,
"SOL": 20,
"Other": 10
}
}
Calculates total portfolio value with position-level breakdown:
Supported Coins: BTC, ETH, SOL, DOGE, XRP, ADA, AVAX, LINK, DOT, UNI, NEAR, ATOM, and more.
Provides market sentiment analysis across your watchlist:
Multiple output formats for different use cases:
Text Format: Human-readable reports with emoji indicators and formatted numbers
# Generate text report
python3 scripts/portfolio-analyzer.py portfolio --holdings holdings.json
JSON Format: Structured data for automation and integrations
# Generate JSON data for automation
python3 scripts/portfolio-analyzer.py portfolio --holdings holdings.json --format json
Designed for automation and integration:
Set up automated daily reports:
# Add to cron or OpenClaw cron jobs
python3 scripts/portfolio-analyzer.py portfolio --holdings ~/.crypto/holdings.json > daily-report.txt
Compare current vs. target allocations:
portfolio-config.jsonMonitor P&L over time:
# Log daily values for trend analysis
echo "$(date): $(python3 scripts/portfolio-analyzer.py portfolio --holdings holdings.json --format json | jq '.total_value')" >> portfolio-history.log
Generate P&L data for tax calculations:
# Export detailed P&L breakdown
python3 scripts/portfolio-analyzer.py portfolio --holdings holdings.json --format json | jq '.breakdown'
Define your average purchase prices for accurate P&L:
{
"cost_basis": {
"BTC": 45000, // Your average BTC purchase price
"ETH": 2800, // Your average ETH purchase price
"SOL": 85 // Your average SOL purchase price
}
}
Without cost basis, P&L calculations use current price as basis (showing $0 P&L).
Customize which coins to track in market overviews:
{
"watchlist": ["BTC", "ETH", "SOL", "DOGE", "XRP", "ADA", "AVAX", "LINK"]
}
Set portfolio allocation targets for rebalancing analysis:
{
"target_allocation": {
"BTC": 40, // Target 40% Bitcoin
"ETH": 30, // Target 30% Ethereum
"SOL": 20, // Target 20% Solana
"Other": 10 // Target 10% other assets
}
}
The skill includes robust error handling:
const { exec } = require('child_process');
async function postPortfolioUpdate() {
const command = 'python3 scripts/portfolio-analyzer.py portfolio --holdings holdings.json --format json';
exec(command, (error, stdout) => {
if (!error) {
const portfolio = JSON.parse(stdout);
const message = `📊 Portfolio: $${portfolio.total_value.toLocaleString()} | P&L: ${portfolio.total_pnl >= 0 ? '🟢' : '🔴'} ${portfolio.total_pnl_pct.toFixed(2)}%`;
// Send to Discord channel
}
});
}
// In OpenClaw skills or cron jobs
const portfolioData = await exec('python3 ~/.openclaw/workspace/skills/crypto-portfolio-tracker/scripts/portfolio-analyzer.py portfolio --holdings holdings.json --format json');
const portfolio = JSON.parse(portfolioData);
if (portfolio.total_value > 100000) {
await notify('Portfolio over $100k!');
}
For detailed examples and integration patterns, see references/usage-examples.md.