← 返回
数据分析 中文

Investment Portfolio

Track investments with buy/sell records, allocation charts, and P/L analysis. Use when managing a stock or crypto portfolio, rebalancing, or comparing assets.
记录买卖记录、分配图表和盈亏分析,用于管理股票或加密货币投资组合、再平衡或比较资产。
ckchzh
数据分析 clawhub v4.0.0 4 版本 99951.6 Key: 无需
★ 0
Stars
📥 2,066
下载
💾 72
安装
4
版本
#chinese#latest#productivity

概述

investment-portfolio

Investment portfolio tracker — record holdings with buy prices, track performance and P/L, view allocation charts, analyze risk, calculate DCA, manage dividends, rebalance to targets, compare assets, and view sector breakdown. All data stored locally in JSONL format.

Commands

add

Add a holding — specify ticker, number of shares, and purchase price.

scripts/script.sh add AAPL 10 175.50
scripts/script.sh add BTC 0.5 42000

remove

Remove a holding by ticker symbol.

scripts/script.sh remove TSLA

update

Update the current market price of a holding.

scripts/script.sh update AAPL 195.00

list

Show all holdings with shares, buy price, and current price.

scripts/script.sh list

summary

Portfolio summary — total value, total cost, overall P/L.

scripts/script.sh summary

allocation

ASCII bar chart showing portfolio allocation by ticker as percentage.

scripts/script.sh allocation

performance

Detailed gain/loss analysis per holding with percentage returns.

scripts/script.sh performance

risk

Risk metrics — standard deviation of returns and diversification score.

scripts/script.sh risk

rebalance

Generate buy/sell suggestions to match target allocation percentages.

scripts/script.sh rebalance '{"AAPL":40,"GOOGL":30,"BTC":30}'

dca

Dollar-cost averaging calculator — monthly investment table over 12 months.

scripts/script.sh dca AAPL 500

dividend

Calculate dividend yield from annual dividend and current price.

scripts/script.sh dividend AAPL 3.76 195.00

compare

Compare two holdings side by side — shares, prices, and P/L.

scripts/script.sh compare AAPL GOOGL

sectors

Sector breakdown with allocation chart. Uses built-in ticker-to-sector mapping.

scripts/script.sh sectors

export

Export portfolio data as CSV.

scripts/script.sh export csv

history

Show transaction history from the log file.

scripts/script.sh history

help

scripts/script.sh help

version

scripts/script.sh version

Examples

# Build a portfolio
scripts/script.sh add AAPL 10 175
scripts/script.sh add GOOGL 5 140
scripts/script.sh add BTC 0.1 42000
scripts/script.sh update AAPL 195

# Analyze
scripts/script.sh summary
scripts/script.sh allocation
scripts/script.sh performance
scripts/script.sh risk

# Rebalance
scripts/script.sh rebalance '{"AAPL":50,"GOOGL":30,"BTC":20}'
scripts/script.sh compare AAPL GOOGL
scripts/script.sh sectors

Configuration

VariableRequiredDescription
---------------------------------
PORTFOLIO_DIRNoData directory (default: ~/.local/share/investment-portfolio/)

Data Storage

All data saved in ~/.local/share/investment-portfolio/:

  • holdings.jsonl — Portfolio holdings (one JSON object per line)
  • history.log — Transaction log

Requirements

  • bash 4.0+
  • python3 (for JSONL processing and calculations)

All prices are manually entered — no external API calls.


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

版本历史

共 4 个版本

  • v4.0.0 当前
    2026-03-29 01:45 安全 安全
  • v1.0.0
    2026-03-26 22:24
  • v2.3.4
    2026-03-18 14:19
  • v1.0.2
    2026-03-14 01:34

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Legal Advisor

ckchzh
生成劳动、消费、租赁及交通纠纷法律模板,适用于撰写纠纷信函、审查租户权利、准备索赔等。
★ 4 📥 4,012
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,708
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 199 📥 65,213