본문으로 건너뛰기
cccskills
무료GitHub에 공개

portfolio

Manage investment portfolios. Use when adding positions, analyzing allocation, calculating returns, or generating rebalance advice.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(4)

  • SKILL.md5.2 KB
  • _meta.json128 B
  • .clawhub/origin.json141 B
  • scripts/script.sh14.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Portfolio

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

CommandDescriptionFlags
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)
listDisplay all current holdings in a formatted table--format table|json|csv
analyzeAnalyze portfolio allocation with value and weight percentages--by ticker|sector --format table|json
rebalanceGenerate buy/sell suggestions to reach target allocation weights--target TICKER:PCT,... --threshold PCT (default 5)
performanceCalculate portfolio returns (invested, sold, current value, gain/loss)--period 1d|1w|1m|3m|1y|all --format table|json
helpShow 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 with ticker, quantity, avg_price, and date_added
  • transactions.json — Array of all buy/sell transactions with type, ticker, quantity, price, and date

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

  1. Tracking purchases — When you buy stocks, ETFs, or crypto and want to record ticker, quantity, and price with automatic cost-basis averaging
  2. Reviewing holdings — When you need a quick snapshot of your current portfolio in table, JSON, or CSV format
  3. Allocation analysis — When you want to see how your portfolio is weighted across assets, with percentage breakdowns and visual bars
  4. Rebalancing — When you need buy/sell recommendations to reach target allocation weights (e.g., AAPL:40,GOOG:30,BTC:30), with configurable drift thresholds
  5. 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

# Remove entire GOOG position
bash scripts/script.sh remove GOOG

# List holdings as a formatted table
bash scripts/script.sh list

# List holdings as JSON for programmatic use
bash scripts/script.sh list --format json

# List holdings as CSV for spreadsheet import
bash scripts/script.sh list --format csv

# Analyze allocation by ticker with visual weight bars
bash scripts/script.sh analyze --format table

# Get allocation as JSON
bash scripts/script.sh analyze --format json

# Generate rebalance suggestions with custom targets and 3% threshold
bash scripts/script.sh rebalance --target AAPL:40,GOOG:30,BTC:30 --threshold 3

# Equal-weight rebalance (no --target defaults to equal weight across all holdings)
bash scripts/script.sh rebalance

# Check performance over the last month
bash scripts/script.sh performance --period 1m

# All-time performance as JSON
bash scripts/script.sh performance --period all --format json

How It Works

The script uses embedded Python (standard library only) for JSON manipulation and calculations. Bash handles argument parsing and dispatches to the appropriate Python block. When you add a position that already exists, the script recalculates the weighted average price automatically. The rebalance command compares current allocation percentages against your targets and flags any drift exceeding the threshold, recommending dollar amounts to buy or sell. The performance command filters transactions by date range and computes total invested, total sold, current portfolio value, and the resulting gain/loss.

Output

All commands print to stdout. Use --format json for machine-readable output where supported. Redirect with standard shell operators:

bash scripts/script.sh list --format csv > portfolio.csv
bash scripts/script.sh performance --format json | jq .

Powered by BytesAgain | bytesagain.com | hello@bytesagain.com

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

监控 A 股基金实时估值与盘后净值,自动判断交易日并生成提醒或分析。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

Expert sales execution covering pipeline management, discovery, demos, negotiation, and deal closing. Use when qualifying opportunities, running MEDDIC discovery, building account plans, handling objections, structuring proposals, or forecasting pipeline.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

Support accounting understanding from basic bookkeeping to professional practice and research.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

Automate ActiveCampaign tasks via Rube MCP (Composio): manage contacts, tags, list subscriptions, automation enrollment, and tasks. Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

add-lead

무료

Add company/person/relationship to CRM

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aAAaqwq/openclaw-team22026년 6월 18일 업데이트

aAAaqwq의 스킬 모두 보기

이 스킬의 문제 신고