Skills portfolio-tracker
An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/aigeneralstore/portfolio-tracking-skill" ~/.claude/skills/openclaw-skills-portfolio-tracker && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/aigeneralstore/portfolio-tracking-skill" ~/.openclaw/skills/openclaw-skills-portfolio-tracker && rm -rf "$T"
manifest:
skills/aigeneralstore/portfolio-tracking-skill/SKILL.mdsource content
Portfolio Tracker Skill
An investment portfolio tracker that runs entirely locally. All data stays in
~/.portfolio-tracker/.
Architecture
- Data:
(portfolios, assets, prices)~/.portfolio-tracker/data.json - Config:
(API keys, wallet addresses, user profile)~/.portfolio-tracker/config.json - Scripts: TypeScript CLI tools in
, run via<skill-path>/scripts/npx tsx
First-Time Setup
Before running any script, ensure dependencies are installed:
npm install --prefix <skill-path>/scripts
Replace
<skill-path> with the actual installed path of this skill.
How Scripts Work
Each script is a standalone CLI tool. Run them with:
npx tsx <skill-path>/scripts/<script>.ts <command> [args]
Scripts read from stdin when needed and output JSON to stdout.
data-store.ts
— Read portfolio data (creates default if missing)load
— Write portfolio data (JSON from stdin)save
— Read configload-config
— Write config (JSON from stdin)save-config
fetch-prices.ts
— Get crypto price (Binance → CoinGecko)crypto <symbol>
— Get stock price (Yahoo Finance)stock <symbol>
— Get USD/CNY/HKD exchange ratesfx
— Get 3yr monthly historical datahistorical <symbol>
— Search for assets by name/symbolsearch <query>
— Batch refresh prices (assets JSON from stdin)refresh
binance-sync.ts
— Fetch all Binance balances (6 account types)sync <apiKey> <apiSecret>
— Validate API credentialsvalidate <apiKey> <apiSecret>
ibkr-sync.ts
— Fetch IBKR positions via Flex Querysync <token> <queryId>
— Validate IBKR credentialsvalidate <token> <queryId>
blockchain-sync.ts
— Fetch wallet balances (single chain or all 5 EVM chains)sync <address> [chain]
— Validate EVM addressvalidate <address>
Data Types
Asset
{ "id": "unique-id", "type": "CRYPTO | USSTOCK | HKSTOCK | ASHARE | CASH", "symbol": "BTC", "name": "Bitcoin", "quantity": 1.5, "avgPrice": 40000, "currentPrice": 50000, "currency": "USD | CNY | HKD", "transactions": [], "source": { "type": "manual | binance | wallet | ibkr" } }
Portfolio
{ "id": "unique-id", "name": "Main", "assets": [...] }
Workflow Patterns
Viewing Portfolio
- Load data via
data-store.ts load - Find current portfolio by
currentPortfolioId - Calculate total value using
per assetquantity * currentPrice - Convert to display currency using
exchangeRates - Present as a formatted table
Adding Assets
- Load data
- Search for the asset using
fetch-prices.ts search <query> - Get current price via
fetch-prices.ts crypto/stock <symbol> - Add asset to current portfolio with a generated unique ID
- Save data
Refreshing Prices
- Load data
- Pipe current portfolio assets to
via stdinfetch-prices.ts refresh - Also run
for exchange ratesfetch-prices.ts fx - Update each asset's
and thecurrentPriceexchangeRates - Set
to current ISO timestamplastPriceRefresh - Save data
Syncing from Exchange/Wallet
- Load config to get credentials
- Run the appropriate sync script
- Merge results: update existing assets (match by symbol+source), add new ones
- Save data
Commands
Available user commands:
— View and manage portfolios/portfolio
— Refresh all prices/prices
— Configure API keys and wallets/setup
— Sync from Binance/sync-binance
— Sync from Interactive Brokers/sync-ibkr
— Sync from blockchain wallet/sync-wallet
— Get AI investment advice/advise