portfolio
Manage investment portfolios. Use when adding positions, analyzing allocation, calculating returns, or generating rebalance advice.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/bytesagain1/portfolioPortfolio
Investment portfolio manager. Add and remove holdings, list positions, analyze allocation weights, generate rebalance suggestions against target weights, and calculate performance returns over configurable time periods. All data is stored locally in JSON files — no external API calls required.
Commands
| Command | Description | Flags |
|---|---|---|
add <ticker> <qty> <price> | Buy shares — adds to holdings and records a buy transaction | --date YYYY-MM-DD (defaults to today) |
remove <ticker> | Sell shares — removes from holdings and records a sell transaction | --quantity N (partial sell; omit to sell all) |
list | Display all current holdings in a formatted table | --format table|json|csv |
analyze | Analyze portfolio allocation with value and weight percentages | --by ticker|sector --format table|json |
rebalance | Generate buy/sell suggestions to reach target allocation weights | --target TICKER:PCT,... --threshold PCT (default 5) |
performance | Calculate portfolio returns (invested, sold, current value, gain/loss) | --period 1d|1w|1m|3m|1y|all --format table|json |
help | Show the built-in help message with all command examples | — |
Data Storage
All data is stored locally in ~/.portfolio/:
holdings.json— Array of current positions, each withticker,quantity,avg_price, anddate_addedtransactions.json— Array of all buy/sell transactions withtype,ticker,quantity,price, anddate
Both files are auto-created as empty JSON arrays ([]) on first use. The add command automatically merges duplicate tickers by recalculating the weighted average price.
Requirements
- bash (4.0+)
- python3 (standard library only —
json,os,sys,datetime) - No external APIs, no pip packages, no network access needed
When to Use
- Tracking purchases — When you buy stocks, ETFs, or crypto and want to record ticker, quantity, and price with automatic cost-basis averaging
- Reviewing holdings — When you need a quick snapshot of your current portfolio in table, JSON, or CSV format
- Allocation analysis — When you want to see how your portfolio is weighted across assets, with percentage breakdowns and visual bars
- Rebalancing — When you need buy/sell recommendations to reach target allocation weights (e.g.,
AAPL:40,GOOG:30,BTC:30), with configurable drift thresholds - Performance tracking — When you want to calculate total invested, total sold, current value, and gain/loss percentage over a specific time period (1 day to all-time)
Examples
# Add 100 shares of AAPL at $150.50, purchased on Jan 15, 2024
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15
# Add 0.5 BTC at $42,000 (today's date auto-applied)
bash scripts/script.sh add BTC 0.5 42000
# Sell 50 shares of AAPL (partial sell)
bash scripts/script.sh remove AAPL --quantity 50
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-bytesagain1-portfolio": {
"enabled": true,
"auto_update": true
}
}
}Tags
Related Skills
vynn-backtester
Run trading strategy backtests with natural language — powered by Vynn
q-kdb-code-review
AI-powered code review for Q/kdb+ — catch bugs in the most terse language in finance
olo-sec-scanner
SEC EDGAR filing analysis for M&A due diligence — extract financials, detect risks, and track corporate events from 10-K, 10-Q, and 8-K filings
skill-market-fit-ranker
对一批 Skill 选题按高频、低门槛、传播性、ROI 和风险做排序。;use for skills, market-fit, prioritization workflows;do not use for 只按个人偏好排序, 忽略发布风险.
web3-weekly-report
自动抓取数据并生成 Web3 行业资本运作周报,涵盖融资事件、监管动态、上市公司 DAT 动态、并购交易与 RWA 项目追踪。当用户提到"写周报"、"生成周报"、"整理本周融资"、"Web3 周报"、"资本运作周报"、"采编周报",或请求整理加密行业本周动态时,立即激活此 skill。即使用户只说"帮我写本周的",只要上下文涉及 Web3、加密、融资、RWA、DAT,也应激活。