🧪 Skills
portfolio tracking
An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.
v1.0.0
Description
name: portfolio-tracker description: An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.
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
<skill-path>/scripts/, run vianpx 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
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 <symbol>— Get crypto price (Binance → CoinGecko)stock <symbol>— Get stock price (Yahoo Finance)fx— Get USD/CNY/HKD exchange rateshistorical <symbol>— Get 3yr monthly historical datasearch <query>— Search for assets by name/symbolrefresh— 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 Queryvalidate <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" }
}
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 <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
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
Reviews (0)
Sign in to write a review.
No reviews yet. Be the first to review!
Comments (0)
No comments yet. Be the first to share your thoughts!