✓ Verified 💻 Development ✓ Enhanced Data

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 /scripts/, run via npx tsx

First-Time Setup

Before running any script, ensure dependencies are installed:

bash
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:

bash
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 — Get crypto price (Binance → CoinGecko)
  • stock — Get stock price (Yahoo Finance)
  • fx — Get USD/CNY/HKD exchange rates
  • historical — Get 3yr monthly historical data
  • search — Search for assets by name/symbol
  • refresh — 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 Query
  • validate — 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

json
{
  "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

json
{
  "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 * currentPrice per 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 refresh via stdin
  • Also run fetch-prices.ts fx for exchange rates
  • Update each asset's currentPrice and the exchangeRates
  • Set lastPriceRefresh to 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

Terminal bash

openclaw install portfolio-tracking-skill
    
Copied!

💻Code Examples

npm install --prefix <skill-path>/scripts

npm-install---prefix-skill-pathscripts.txt
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]

npx-tsx-skill-pathscriptsscriptts-command-args.txt
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
example.json
{
  "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" }
}
example.json
{
  "id": "unique-id",
  "name": "Main",
  "assets": [...]
}

Tags

#health_and-fitness

Quick Info

Category Development
Model Claude 3.5
Complexity One-Click
Author aigeneralstore
Last Updated 3/10/2026
🚀
Optimized for
Claude 3.5
🧠

Ready to Install?

Get started with this skill in seconds

openclaw install portfolio-tracking-skill