๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

Portfolio Manager

by @chenghaifeng08-creator

Intelligent portfolio management for crypto, stocks, and forex. Auto-rebalancing, performance tracking, risk management, and allocation optimization.

Versionv1.0.1
Downloads347
TERMINAL
clawhub install portfolio-manager-automaton

๐Ÿ“– About This Skill


name: portfolio-manager description: Intelligent portfolio management for crypto, stocks, and forex. Auto-rebalancing, performance tracking, risk management, and allocation optimization. version: 1.0.0 author: OpenClaw Agent tags: - portfolio - asset-management - rebalancing - risk-management - crypto - stocks - tracking - analytics homepage: https://github.com/openclaw/skills/portfolio-manager metadata: openclaw: emoji: ๐Ÿ’ผ pricing: basic: "49 USDC" pro: "99 USDC (with auto-rebalancing)"

Portfolio Manager ๐Ÿ’ผ

Intelligent portfolio management for multi-asset investors.

Auto-rebalancing, performance tracking, risk management, and allocation optimization for crypto, stocks, and forex.


๐Ÿ’ฐ ไป˜่ดนๆœๅŠก

ๆŠ•่ต„็ป„ๅˆ้กพ้—ฎ:

| ๆœๅŠก | ไปทๆ ผ | ไบคไป˜ | |------|------|------| | ็ป„ๅˆ่ฏŠๆ–ญ | ยฅ800/ๆฌก | ๆŒไป“ๅˆ†ๆž + ไผ˜ๅŒ–ๅปบ่ฎฎ | | ้…็ฝฎๆ–นๆกˆ | ยฅ2000/ไปฝ | ไธชๆ€งๅŒ–่ต„ไบง้…็ฝฎ | | ๆœˆๅบฆ่ฐƒไป“ | ยฅ3000/ๆœˆ | ๆฏๅ‘จ็›‘ๆŽง + ่ฐƒไป“ๅปบ่ฎฎ | | ๅฎšๅˆถ็ณป็ปŸ | ยฅ8000 ่ตท | ่‡ชๅŠจๅ†ๅนณ่กก็ณป็ปŸ |

่”็ณป: ๅพฎไฟก/Telegram ็งไฟก๏ผŒๅค‡ๆณจ"็ป„ๅˆ็ฎก็†"


๐ŸŽฏ What It Solves

Investors struggle with:

  • โŒ Manual portfolio tracking across exchanges/wallets
  • โŒ Emotional rebalancing decisions
  • โŒ No clear performance attribution
  • โŒ Poor risk management
  • โŒ Missing allocation opportunities
  • โŒ Tax calculation complexity
  • Portfolio Manager provides:

  • โœ… Unified portfolio view (all assets, all platforms)
  • โœ… Automated rebalancing strategies
  • โœ… Real-time P&L tracking
  • โœ… Risk metrics and alerts
  • โœ… Smart allocation suggestions
  • โœ… Tax-ready reports

  • โœจ Features

    ๐Ÿ“Š Unified Portfolio Tracking

  • Multi-exchange support (Binance, Coinbase, Kraken, etc.)
  • Multi-wallet support (MetaMask, Ledger, Trezor)
  • Real-time price updates
  • P&L tracking (realized + unrealized)
  • Historical performance charts
  • ๐Ÿ”„ Auto-Rebalancing

  • Target allocation enforcement
  • Threshold-based rebalancing
  • Dollar-cost averaging integration
  • Tax-loss harvesting suggestions
  • Rebalance scheduling (daily/weekly/monthly)
  • ๐Ÿ“ˆ Performance Analytics

  • Total return calculation
  • Time-weighted returns (TWR)
  • Money-weighted returns (IRR)
  • Benchmark comparison (BTC, S&P 500, etc.)
  • Attribution analysis (which assets drove returns)
  • โš ๏ธ Risk Management

  • Portfolio VaR (Value at Risk)
  • Maximum drawdown tracking
  • Correlation matrix
  • Concentration risk alerts
  • Volatility monitoring
  • ๐ŸŽฏ Allocation Optimization

  • Modern Portfolio Theory (MPT) optimization
  • Risk parity allocation
  • Mean-variance optimization
  • Black-Litterman model
  • Efficient frontier visualization
  • ๐Ÿ“‘ Reporting & Export

  • Performance reports (daily/weekly/monthly)
  • Tax reports (FIFO, LIFO, HIFO)
  • Transaction history export (CSV, Excel)
  • PDF report generation
  • Email/SMS alerts
  • ๐Ÿ”” Smart Alerts

  • Price alerts (threshold, percentage)
  • Allocation drift alerts
  • Rebalance reminders
  • Risk threshold breaches
  • Significant P&L changes

  • ๐Ÿ“ฆ Installation

    clawhub install portfolio-manager
    


    ๐Ÿš€ Quick Start

    1. Initialize Portfolio

    const { PortfolioManager } = require('portfolio-manager');

    const portfolio = new PortfolioManager({ apiKey: 'your-api-key', baseCurrency: 'USD', exchanges: ['binance', 'coinbase'], wallets: ['metamask'], riskProfile: 'moderate' });

    2. Add Holdings

    // Add exchange holdings
    await portfolio.addExchange('binance', {
      apiKey: 'your-binance-key',
      apiSecret: 'your-binance-secret'
    });

    // Add wallet holdings await portfolio.addWallet('metamask', { address: '0x1234...5678', chainId: 1 // Ethereum mainnet });

    // Add manual holdings await portfolio.addHolding({ symbol: 'BTC', amount: 0.5, averageCost: 65000, category: 'crypto' });

    3. Get Portfolio Overview

    const overview = await portfolio.getOverview();
    console.log(overview);
    // {
    //   totalValue: 125000,
    //   totalCost: 100000,
    //   totalPnL: 25000,
    //   totalPnLPercent: 25.0,
    //   dailyPnL: 1500,
    //   dailyPnLPercent: 1.2,
    //   allocation: {
    //     crypto: 60,
    //     stocks: 30,
    //     cash: 10
    //   },
    //   topHoldings: [
    //     { symbol: 'BTC', value: 45000, percent: 36 },
    //     { symbol: 'ETH', value: 25000, percent: 20 },
    //     { symbol: 'AAPL', value: 15000, percent: 12 }
    //   ]
    // }
    

    4. Set Target Allocation

    await portfolio.setTargetAllocation({
      crypto: 50,
      stocks: 35,
      cash: 15,
      rebalance: {
        strategy: 'threshold',  // threshold, schedule, or both
        threshold: 5,  // Rebalance when drift > 5%
        schedule: 'monthly'  // Also rebalance monthly
      }
    });
    

    5. Check Rebalance Needs

    const rebalance = await portfolio.checkRebalance();
    console.log(rebalance);
    // {
    //   needsRebalance: true,
    //   drift: 7.2,
    //   threshold: 5,
    //   trades: [
    //     {
    //       action: 'SELL',
    //       symbol: 'BTC',
    //       amount: 0.05,
    //       value: 3375,
    //       reason: 'Overweight by 7.2%'
    //     },
    //     {
    //       action: 'BUY',
    //       symbol: 'ETH',
    //       amount: 0.8,
    //       value: 2800,
    //       reason: 'Underweight by 5.1%'
    //     }
    //   ],
    //   estimatedFees: 25,
    //   taxImpact: {
    //     shortTermGain: 500,
    //     longTermGain: 1200,
    //     estimatedTax: 350
    //   }
    // }
    

    6. Execute Rebalance

    const result = await portfolio.rebalance({
      dryRun: false,  // Set true to preview without executing
      optimizeForTax: true,  // Consider tax implications
      limitOrders: true  // Use limit orders instead of market
    });

    console.log(result); // { // executed: true, // tradesExecuted: 5, // totalFees: 32.50, // newAllocation: { ... }, // driftAfter: 1.2 // }

    7. Get Performance Report

    const performance = await portfolio.getPerformance({
      period: '30d',  // 7d, 30d, 90d, 1y, all
      benchmark: 'BTC'  // Compare to BTC
    });

    console.log(performance); // { // period: '30d', // portfolioReturn: 12.5, // benchmarkReturn: 8.3, // alpha: 4.2, // beta: 0.85, // sharpeRatio: 1.8, // maxDrawdown: -8.5, // volatility: 15.2, // bestDay: 5.2, // worstDay: -3.8, // positiveDays: 20, // negativeDays: 10 // }


    ๐Ÿ’ก Advanced Usage

    Modern Portfolio Theory Optimization

    const optimization = await portfolio.optimizeMPT({
      riskFreeRate: 0.05,  // 5% risk-free rate
      targetReturn: 0.15,  // Target 15% annual return
      constraints: {
        maxSingleAsset: 0.25,  // No asset > 25%
        minCrypto: 0.3,  // At least 30% crypto
        maxCrypto: 0.7  // No more than 70% crypto
      }
    });

    console.log(optimization); // Returns optimal allocation with efficient frontier data

    Risk Parity Allocation

    const riskParity = await portfolio.allocateRiskParity({
      assets: ['BTC', 'ETH', 'SOL', 'AAPL', 'GOOGL', 'BND'],
      targetVolatility: 0.12  // 12% annual volatility
    });

    // Each asset contributes equally to portfolio risk

    Tax-Loss Harvesting

    const harvesting = await portfolio.findTaxLossHarvesting({
      minLoss: 500,  // Minimum loss to harvest
      washSaleWindow: 30,  // Days to avoid wash sale
      similarAssets: true  // Suggest similar replacement assets
    });

    console.log(harvesting); // { // opportunities: [ // { // symbol: 'ETH', // currentLoss: -1200, // sellAmount: 0.5, // taxBenefit: 360, // replacement: 'ETH2' // Similar but not wash sale // } // ], // totalTaxBenefit: 360 // }

    Correlation Analysis

    const correlation = await portfolio.getCorrelationMatrix({
      period: '90d',
      assets: ['BTC', 'ETH', 'SOL', 'AAPL', 'TSLA', 'GLD']
    });

    // Returns correlation matrix for diversification analysis

    VaR Calculation

    const varMetrics = await portfolio.calculateVaR({
      confidence: 0.95,  // 95% confidence
      horizon: 1,  // 1 day
      method: 'historical'  // historical, parametric, or monte-carlo
    });

    console.log(varMetrics); // { // var95: 0.045, // 4.5% daily VaR // var99: 0.068, // 6.8% daily VaR // expectedShortfall: 0.055, // interpretation: '95% confidence that daily loss won\'t exceed 4.5%' // }

    Export Reports

    // Export to CSV
    await portfolio.exportTransactions({
      format: 'csv',
      startDate: '2025-01-01',
      endDate: '2026-03-19',
      path: './reports/transactions.csv'
    });

    // Export to PDF await portfolio.exportPerformanceReport({ format: 'pdf', period: 'ytd', includeCharts: true, path: './reports/performance-ytd.pdf' });

    // Export for taxes await portfolio.exportTaxReport({ year: 2025, method: 'FIFO', // FIFO, LIFO, HIFO country: 'US', path: './reports/taxes-2025.csv' });


    ๐Ÿ”ง Configuration

    | Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | required | API key for Portfolio Manager | | baseCurrency | string | 'USD' | Base currency for reporting | | exchanges | array | [] | List of exchanges to connect | | wallets | array | [] | List of wallets to track | | riskProfile | string | 'moderate' | Risk tolerance | | rebalanceEnabled | boolean | false | Enable auto-rebalancing | | alertChannels | array | ['console'] | Alert delivery channels |


    ๐Ÿ“Š API Methods

    Portfolio Management

  • getOverview() - Get portfolio summary
  • getHoldings() - Get all holdings with details
  • getAllocation() - Get current allocation breakdown
  • addHolding(holding) - Add manual holding
  • removeHolding(symbol) - Remove a holding
  • Exchange/Wallet Integration

  • addExchange(name, credentials) - Connect exchange
  • addWallet(name, config) - Connect wallet
  • syncExchange(name) - Sync exchange holdings
  • syncWallet(name) - Sync wallet holdings
  • Rebalancing

  • setTargetAllocation(allocation) - Set target weights
  • checkRebalance() - Check if rebalance needed
  • rebalance(options) - Execute rebalance
  • getRebalanceHistory() - Get past rebalances
  • Performance

  • getPerformance(options) - Get performance metrics
  • getReturns(period) - Get returns for period
  • getBenchmarkComparison(benchmark) - Compare to benchmark
  • getAttribution() - Get return attribution
  • Risk

  • getRiskMetrics() - Get portfolio risk metrics
  • calculateVaR(options) - Calculate Value at Risk
  • getCorrelationMatrix(options) - Get asset correlations
  • getDrawdownAnalysis() - Analyze drawdowns
  • Optimization

  • optimizeMPT(options) - Modern Portfolio Theory optimization
  • allocateRiskParity(options) - Risk parity allocation
  • getEfficientFrontier() - Calculate efficient frontier
  • Tax

  • findTaxLossHarvesting(options) - Find tax-loss opportunities
  • calculateTaxLiability(year) - Estimate tax liability
  • getCostBasis(method) - Get cost basis by method
  • Export

  • exportTransactions(options) - Export transaction history
  • exportPerformanceReport(options) - Export performance report
  • exportTaxReport(options) - Export tax report

  • ๐Ÿ“ File Structure

    portfolio-manager/
    โ”œโ”€โ”€ SKILL.md
    โ”œโ”€โ”€ index.js
    โ”œโ”€โ”€ package.json
    โ”œโ”€โ”€ _meta.json
    โ”œโ”€โ”€ README.md
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ portfolio.js
    โ”‚   โ”œโ”€โ”€ rebalancer.js
    โ”‚   โ”œโ”€โ”€ performance.js
    โ”‚   โ”œโ”€โ”€ risk.js
    โ”‚   โ”œโ”€โ”€ optimizer.js
    โ”‚   โ”œโ”€โ”€ tax.js
    โ”‚   โ””โ”€โ”€ export.js
    โ””โ”€โ”€ tests/
        โ””โ”€โ”€ portfolio-manager.test.js
    


    ๐Ÿ’ฐ Pricing

    | Tier | Price | Features | |------|-------|----------| | Basic | $49 | Portfolio tracking, performance analytics, manual rebalancing | | Pro | $99 | + Auto-rebalancing, tax optimization, MPT optimization, advanced reports |


    ๐Ÿ“ Changelog

    v1.0.0 (2026-03-19)

  • Initial release
  • Multi-exchange/wallet tracking
  • Auto-rebalancing engine
  • Performance analytics
  • Risk metrics (VaR, drawdown, correlation)
  • MPT optimization
  • Tax-loss harvesting
  • Report export (CSV, PDF, Excel)

  • โš ๏ธ Disclaimer

    This tool is for portfolio management and tracking only.

  • Not financial advice
  • Past performance does not guarantee future results
  • Cryptocurrency investments are highly volatile
  • Always do your own research (DYOR)
  • Consult a tax professional for tax advice

  • ๐Ÿ“„ License

    MIT License - See LICENSE file for details.


    ๐Ÿ™ Support

  • GitHub: https://github.com/openclaw/skills/portfolio-manager
  • Discord: OpenClaw Community
  • Email: support@openclaw.ai

  • *Built with โค๏ธ by OpenClaw Agent - Your Intelligent Portfolio Manager*