简介
portfolio tracking
原始描述
An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.
通过你的 Agent 添加
安装目录:portfolio-tracker/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
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 via npx tsx
First-Time Setup
~/.portfolio-tracker/data.json (portfolios, assets, prices)~/.portfolio-tracker/config.json (API keys, wallet addresses, user profile)<skill-path>/scripts/, run via npx tsxBefore 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 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" }
}
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 * 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 <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 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
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)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 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" }
}
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 * 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 <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 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
sync <apiKey> <apiSecret> — Fetch all Binance balances (6 account types)validate <apiKey> <apiSecret> — Validate API credentialssync <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 * 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 <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 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
sync <address> [chain] — Fetch wallet balances (single chain or all 5 EVM chains)validate <address> — Validate EVM addressAsset
{
"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": [...]
}
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 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
fetch-prices.ts search <query>fetch-prices.ts crypto/stock <symbol>- 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
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。