当前位置: 首页 > Skill >

portfolio tracking

portfolio tracking

portfolio tracking

一个完全本地运行的投资组合追踪器,所有数据保存在 ~/.portfolio-tracker/ 目录中。

1.0.0 2026.11.26 333
获取Skill文件查看使用说明
作 者:陈安 许可证: 更新时间:2026.11.26
本文目录展开

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

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

  1. Load data via data-store.ts load
  2. Find current portfolio by currentPortfolioId
  3. Calculate total value using quantity * currentPrice per asset
  4. Convert to display currency using exchangeRates
  5. Present as a formatted table

Adding Assets

  1. Load data
  2. Search for the asset using fetch-prices.ts search <query>
  3. Get current price via fetch-prices.ts crypto/stock <symbol>
  4. Add asset to current portfolio with a generated unique ID
  5. Save data

Refreshing Prices

  1. Load data
  2. Pipe current portfolio assets to fetch-prices.ts refresh via stdin
  3. Also run fetch-prices.ts fx for exchange rates
  4. Update each asset's currentPrice and the exchangeRates
  5. Set lastPriceRefresh to current ISO timestamp
  6. Save data

Syncing from Exchange/Wallet

  1. Load config to get credentials
  2. Run the appropriate sync script
  3. Merge results: update existing assets (match by symbol+source), add new ones
  4. 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

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,016
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,004
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,002
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,001
PHP集成RabbitMQ实现消息队列的完整步骤

使用 php-amqplib 库,通过建立连接、声明交换机与队列并绑定,即可在 PHP 中实现消息的发送与消费。

2026.05.24 1,001
Apache开启.htaccess及使用方法详解

本文介绍如何在本地Apache环境中启用.htaccess文件,主要涉及修改httpd.conf中的AllowOverride参数。同时详细解析.htaccess的多种实用功能,包括自定义错误页面、目录密码保护、IP访问限制、URL自动转向、默认首页设置以及防止图片盗链等配置方法,并分析了使用.htaccess对服务器性能和安全性的潜在影响。

2026.05.09 1,001
Skill 文件
  • SKILL.md
    • Portfolio Tracker Skill
    • Architecture
    • First-Time Setup
    • How Scripts Work
      • data-store.ts
      • fetch-prices.ts
      • binance-sync.ts
      • ibkr-sync.ts
      • blockchain-sync.ts
    • Data Types
      • Asset
      • Portfolio
    • Workflow Patterns
      • Viewing Portfolio
      • Adding Assets
      • Refreshing Prices
      • Syncing from Exchange/Wallet
    • Commands
  • 项目或源文件

相关 Skill

更多
您的私人股票分析师 您的私人股票分析师 Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
0605-tosr2-csig-03 0605-tosr2-csig-03 Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
Clawhub Stock Analysis Clawhub Stock Analysis Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
A Clawdbot skill that gives your agent native access to DWLF — a market analysis platform for crypto and stocks. A Clawdbot skill that gives your agent native access to DWLF — a market analysis platform for crypto and stocks. Interact with DWLF (dwlf.co.uk), a market analysis platform for crypto and stocks. Use for: market data, price charts, technical indicators (EMA, RSI, DSS, S/R, trendlines, candlestick patterns, SMC), strategies (visual signal builder), backtesting, custom events, trade signals, portfolio tracking, watchlists, trade journaling, chart annotations, trade plans, position sizing, and academy content. Trigger on: market analysis, trading signals, backtests, portfolio, DWLF, chart indicators, support/
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.