Portfolio Tracking Skill
An investment portfolio tracker that runs entirely locally.
- Rating
- 4.8 (409 reviews)
- Downloads
- 2,008 downloads
- Version
- 1.0.0
Overview
An investment portfolio tracker that runs entirely locally.
Complete Documentation
View Source →
Portfolio Tracker Skill
An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.
Architecture
- Data:
~/.portfolio-tracker/data.json(portfolios, assets, prices) - Config:
~/.portfolio-tracker/config.json(API keys, wallet addresses, user profile) - Scripts: TypeScript CLI tools in
, run via/scripts/ npx tsx
First-Time Setup
Before running any script, ensure dependencies are installed:
npm install --prefix <skill-path>/scripts
Replace 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
load— Read portfolio data (creates default if missing)save— Write portfolio data (JSON from stdin)load-config— Read configsave-config— Write config (JSON from stdin)
fetch-prices.ts
crypto— Get crypto price (Binance → CoinGecko)stock— Get stock price (Yahoo Finance)fx— Get USD/CNY/HKD exchange rateshistorical— Get 3yr monthly historical datasearch— Search for assets by name/symbolrefresh— Batch refresh prices (assets JSON from stdin)
binance-sync.ts
sync— Fetch all Binance balances (6 account types)validate— Validate API credentials
ibkr-sync.ts
sync— Fetch IBKR positions via Flex Queryvalidate— Validate IBKR credentials
blockchain-sync.ts
sync [chain]— Fetch wallet balances (single chain or all 5 EVM chains)validate— Validate EVM 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
quantity * currentPriceper asset - Convert to display currency using
exchangeRates - Present as a formatted table
Adding Assets
- Load data
- Search for the asset using
fetch-prices.ts search - Get current price via
fetch-prices.ts crypto/stock - Add asset to current portfolio with a generated unique ID
- Save data
Refreshing Prices
- Load data
- Pipe current portfolio assets to
fetch-prices.ts refreshvia stdin - Also run
fetch-prices.ts fxfor exchange rates - Update each asset's
currentPriceand theexchangeRates - Set
lastPriceRefreshto current ISO timestamp - 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:
/portfolio— View and manage portfolios/prices— Refresh all prices/setup— Configure API keys and wallets/sync-binance— Sync from Binance/sync-ibkr— Sync from Interactive Brokers/sync-wallet— Sync from blockchain wallet/advise— Get AI investment advice
Installation
openclaw install portfolio-tracking-skill
💻Code Examples
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
- `load` — Read portfolio data (creates default if missing)
- `save` — Write portfolio data (JSON from stdin)
- `load-config` — Read config
- `save-config` — Write config (JSON from stdin)
### fetch-prices.ts
- `crypto <symbol>` — Get crypto price (Binance → CoinGecko)
- `stock <symbol>` — Get stock price (Yahoo Finance)
- `fx` — Get USD/CNY/HKD exchange rates
- `historical <symbol>` — Get 3yr monthly historical data
- `search <query>` — Search for assets by name/symbol
- `refresh` — Batch refresh prices (assets JSON from stdin)
### binance-sync.ts
- `sync <apiKey> <apiSecret>` — Fetch all Binance balances (6 account types)
- `validate <apiKey> <apiSecret>` — Validate API credentials
### ibkr-sync.ts
- `sync <token> <queryId>` — Fetch IBKR positions via Flex Query
- `validate <token> <queryId>` — Validate IBKR credentials
### blockchain-sync.ts
- `sync <address> [chain]` — Fetch wallet balances (single chain or all 5 EVM chains)
- `validate <address>` — Validate EVM 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" }
}{
"id": "unique-id",
"name": "Main",
"assets": [...]
}Tags
Quick Info
Ready to Install?
Get started with this skill in seconds
Related Skills
4claw
4claw — a moderated imageboard for AI agents.
Aap Passport
Agent Attestation Protocol - The Reverse Turing Test.
Acestep Lyrics Transcription
Transcribe audio to timestamped lyrics using OpenAI Whisper or ElevenLabs Scribe API.
Adaptive Suite
A continuously adaptive skill suite that empowers Clawdbot.