portfolio-management
Manages investment portfolios with quantitative models, risk metrics, and optimization algorithms.
What this skill does
## 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
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.