Skip to content
portfolio-management logo

Portfolio Management

portfolio-management

Manages investment portfolios with quantitative models, risk metrics, and optimization algorithms.

SKILL.md

Full skill instructions

portfolio-management

Purpose

This skill enables the AI to manage investment portfolios using quantitative models, calculate risk metrics like Value at Risk (VaR), and apply optimization algorithms such as mean-variance optimization. It processes portfolio data to generate actionable insights, supporting decisions in finance by integrating with data sources and executing trades based on predefined strategies.

When to Use

Use this skill for tasks involving portfolio rebalancing, risk assessment, or performance analysis in financial contexts. Apply it when handling user queries about investment strategies, such as diversifying assets or responding to market volatility. Ideal for scenarios with real-time data feeds or when optimizing allocations under constraints like budget limits.

Key Capabilities

  • Quantitative Models: Implement models like CAPM or Black-Litterman; e.g., calculate expected returns with claw portfolio model capm --assets AAPL,GOOG.
  • Risk Metrics: Compute VaR or Sharpe ratio; use API endpoint GET /​api/​portfolios/​risk/​var?confidence=0.95 to get 95% VaR for a portfolio.
  • Optimization Algorithms: Run mean-variance optimization; configure via JSON file: {"assets": ["AAPL", "MSFT"], "weights": [0.5, 0.5]}.
  • Data Integration: Pull market data from external APIs; supports formats like CSV or JSON for portfolio inputs.
  • Performance Tracking: Generate reports on portfolio returns; e.g., claw portfolio track --period monthly --metric sharpe.

Usage Patterns

Always initialize with authentication via $PORTFOLIO_API_KEY environment variable. For CLI usage, pipe data inputs directly; e.g., start with claw portfolio load --file portfolio.json then chain commands like claw portfolio optimize --risk-level high. In API patterns, use POST requests for modifications and GET for queries; handle asynchronous operations by polling endpoints. For scripts, wrap in try-catch blocks to manage API failures, and use config files for reusable parameters like asset lists.

Common Commands/​API

  • CLI Commands: Use claw portfolio manage --action optimize --config config.json to optimize a portfolio; flags include --action (optimize, analyze), --config (path to JSON), and --verbose for detailed logs.
  • API Endpoints: Send requests to POST /​api/​portfolios/​create with body {"name": "my-portfolio", "assets": ["AAPL", "TSLA"]}; authenticate via header Authorization: Bearer $PORTFOLIO_API_KEY.
  • Code Snippets:
    import requests
    response = requests.post('https://api.openclaw.ai/​api/​portfolios/​optimize', headers={'Authorization': f'Bearer {os.environ["PORTFOLIO_API_KEY"]}'}, json={'assets': ['AAPL', 'GOOG']})
    print(response.json()['optimized_weights'])
    
    claw portfolio analyze --assets AAPL,MSFT --metric var --confidence 0.99
    
  • Config Formats: Use JSON for inputs, e.g., {"portfolio": {"assets": [{"symbol": "AAPL", "quantity": 100}], "constraints": {"max_risk": 0.05}}}; validate with claw portfolio validate --file config.json.

Integration Notes

Integrate by setting $PORTFOLIO_API_KEY in your environment before running commands. For external systems, use webhooks to sync data; e.g., connect to a brokerage API by mapping endpoints like POST /​api/​portfolios/​update to trigger updates. Ensure compatibility with financial libraries like NumPy for calculations; import as a module in Python scripts and handle rate limits by adding delays, e.g., time.sleep(1) between API calls. Test integrations in a sandbox environment using mock data.

Error Handling

Check for authentication errors by verifying $PORTFOLIO_API_KEY is set; if missing, prompt user with os.environ.get('PORTFOLIO_API_KEY') or raise ValueError("API key required"). For API failures, catch HTTP errors like 401 or 429 using try-except in code:

try:
    response = requests.get('https://api.openclaw.ai/​api/​portfolios/​risk')
except requests.exceptions.HTTPError as e:
    print(f"Error: {e.response.status_code} - {e.response.text}")

Handle invalid inputs by validating configs first with claw portfolio validate; log errors to file with --log-file errors.log flag, and retry transient errors up to 3 times with exponential backoff.

Graph Relationships

  • Related to cluster: financial
  • Connected via tags: finance, investments, risk-management, quant-analysis
  • Links to other skills: depends on data-analysis for data processing; enhances trading-execution for automated trades

More Finance & Trading skills

ponytail-debt logo
Finance & Trading

ponytail-debt

Harvest every `ponytail:` comment in the codebase into a debt ledger, so the deliberate shortcuts and deferrals ponytail leaves behind get tracked instead of rotting into "later means never". One-shot report, changes nothing.

155.5K 27.9K
View
stripe-integration logo
Finance & Trading

stripe-integration

Stripe payment processing with checkout sessions, subscriptions, webhooks, and customer management.

40.2K 12.9K
View

Build comprehensive 3-5 year financial models with revenue projections, cost structures, cash flow analysis, and scenario planning for early-stage startups. Use this skill when creating financial projections, calculating burn rate or runway, modeling fundraising scenarios, or preparing investor-r...

40.2K 12K
View
stock-analysis logo
Finance & Trading

stock-analysis

Stock and cryptocurrency analysis with portfolio management and multi-dimensional scoring.

46 11.9K
View
coinglass logo
Finance & Trading

coinglass

Real-time crypto derivatives positioning, whale tracking, liquidations, and institutional ETF flows across 37 specialized tools.

27 11.5K
View

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

40.2K 10.5K
View

Finance AI tools

C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Finalle.ai logo
Finance

Finalle.ai

Stay Ahead with Finalle.ai: The Ultimate Financial News and Tools Platform

Free
View

AI-powered Pine Script code generator for TradingView

Paid
View
TradeUI logo
Finance

TradeUI

Empower your investment strategies with AI signals, option flow data, and advanced chart patterns.

Paid
View
D
Finance

Danelfin

Danelfin review covering its AI stock and ETF scores, rankings, portfolio tools, current pricing, strengths, risks, and alternatives for investors.

Freemium
View
E
Finance

Ellisense

A software for comprehensive market sentiment analysis.

Paid
View

'Stock Correlations' App by Freshly.ai: Reveal Stock Patterns and Trends

Free
View