诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。
数据分析
avanza-investment-tracker
试用解析 Avanza 交易 CSV,计算 TWRR 与 Modified Dietz 收益率,并在本地 SQLite 数据库中跟踪组合持仓。
它能做什么
把 Avanza 导出的 CSV 交易导入本地 SQLite 数据库,按入金分组计算 TWRR 与 Modified Dietz 收益率、配置比例和 APY。支持虚拟子组合、历史快照(--as-of),以及夏普、索提诺、最大回撤、相对基准的 Beta 等风险指标。价格与汇率通过 HTTPS 联网从 Avanza、Riksbanken、Yahoo Finance 拉取;并提供 reset --hard、delete-tx、account delete 等不可逆的删除命令用于修正导入错误。
什么时候用它
- 导入新一批 Avanza CSV 交易记录
- 按入金分组对比 TWRR 与 Modified Dietz 回报
- 删除重复或未结算交易后重建持仓数据
- 生成虚拟组合与父账户、基准对比的投资报告
技能文档
Avanza Investment Tracker
Parse transaction CSVs and compute portfolio performance metrics.
Quick Start
Run commands from your workspace root, specifying the paths to your database and CSV:
# 1. Import new transactions
python path/to/cli.py --database data/asset_data.db import path/to/transactions.csv
# 2. Update price cache and show statistics
python path/to/cli.py --database data/asset_data.db stats --update-prices auto
# 3. View portfolio allocation and APY
python path/to/cli.py --database data/asset_data.db portfolio --account default
Data Storage Pattern
User data lives OUTSIDE the skill directory. Recommended structure:
workspace-finance/
├── skills/avanza-investment-tracker/ # Portable skill logic
│ ├── SKILL.md
│ ├── scripts/
│ └── assets/
└── data/avanza/ # Private portfolio data
├── transactions.csv
├── special_cases.json
└── asset_data.db
CLI Reference
| Command | Description |
|---|---|
python scripts/cli.py import FILE [--allocate-virtual] [--allow-unsettled] | Import transaction entries from Avanza CSV (auto-allocate buys to virtuals; defers unsettled/pending-nota trades — see CSV Format Support) |
python scripts/cli.py stats [OPTIONS] | Calculate and display cohort performance statistics (TWRR, deposits) |
python scripts/cli.py accounts [OPTIONS] | Display summary of all accounts with asset values and cash |
python scripts/cli.py portfolio [OPTIONS] | Show portfolio holdings, market value, allocation %, and APY (alias to stats --positions --summary) |
python scripts/cli.py status | Display system status (transaction counts, price dates, date range) |
python scripts/cli.py settings SUBCOMMAND | Configure defaults and account nicknames |
python scripts/cli.py reset [--hard] | Reset database state (--hard deletes data; default only marks unprocessed) |
python scripts/cli.py delete-tx [OPTIONS] | Delete individual transaction(s) by --tx-id, --date+--asset, or --since, then rebuild derived tables (see below) |
python scripts/cli.py account SUBCOMMAND | Manage accounts — virtual sub-portfolios (create/allocate/transfer/list/close/delete) and nicknames (see below) |
python scripts/cli.py report [OPTIONS] | Investment report with a virtual-portfolio section and a virtual-vs-parent-vs-benchmark comparison |
Deleting transactions
delete-tx removes specific real transactions and rebuilds the derived assets / cohort tables, so there is no need to reset the whole database after a bad import (e.g. a duplicate, or a row that slipped in before an unsettled trade was deferred). Targeting is mutually exclusive:
delete-tx --tx-id ROWID— most precise (usestatus/exportto find the rowid).delete-tx --date YYYY-MM-DD --asset "Name" [--account ACCOUNT]— the common surgical case.delete-tx --since YYYY-MM-DD [--account ACCOUNT]— remove everything from a date onward (e.g. undo today's import).
--cascade widens a --date+--asset match across the account family (parent + its virtuals) so a trade and its allocated split are removed together; --dry-run previews the deletion. When an allocated buy on a virtual is deleted, its orphaned funding Intern överföring transfer is removed automatically (mirroring account allocate --undo). After every deletion all transactions are reprocessed, so the assets/cohort tables always reflect the remaining transactions — never a half-deleted state.
Global Options
--database PATH(default:data/asset_data.db)--special-cases PATH(default:data/special_cases.json)
Calculation & Output Options
--account ACCOUNTS: Limit to specific accounts (e.g.12345,67890,default, orall). Omitting the flag (default) shows physical accounts only (excludes virtual portfolios); passallto include virtual portfolios in aggregates.--update-prices {auto,always,never}(stats only): Controls when to fetch latest stock/fund prices from Avanza API--update-all(stats only): Update prices for all assets in the database, held or not--as-of DATE: View snapshot/stats as of a historical date (YYYY-MM-DD)--cohorts-start DATE --cohorts-end DATE: Filter which deposit cohorts are displayed--cohort DATE: Shorthand to filter by a single cohort month (YYYY-MM) or year (YYYY) (e.g.--cohort 2024groups yearly,--cohort 2024-12groups monthly)--from DATE --to DATE: Set the performance valuation window (double snapshot)--positions,-p(stats only): Show positions holdings breakdown under each cohort (or summary)--summary,-s(stats only): Consolidate cohort statistics into a single overview block--apy-mode {mwrr,twrr}: APY calculation method (mwrruses Modified Dietz;twrruses Time-Weighted)--format {table,json}: Output formatting (default:table)--quiet,-q: Suppress price data staleness warnings--no-interpolation: Disable linear interpolation for sparse historical price data (falls back to nearest prior price, which may trigger staleness warnings)--risk: Calculate and display portfolio-level risk metrics (Annualized Standard Deviation, Sharpe Ratio, Sortino Ratio, Maximum Drawdown with peak/trough calendar months)--beta [TICKER]: Include the portfolio Beta calculation vs the specified benchmark (e.g.^OMXSPI,ACWI). Defaults to^OMXSPIif the flag is passed without a ticker value. Specifying--betaautomatically enables risk metrics.
Guidelines: When to use what date boundaries
- To see how cohorts from a certain period look today:
Use
--cohorts-start YYYY-MM/--cohorts-end YYYY-MMExample:python scripts/cli.py stats --cohorts-start 2024-01 - To see all cohorts' performance over a specific valuation window:
Use
--from YYYY-MM/--to YYYY-MM(or--as-of YYYY-MM) Example:python scripts/cli.py stats --from 2024-01 --to 2024-12 - To see only a single cohort month or year:
Use
--cohort YYYY-MMor--cohort YYYYExample:python scripts/cli.py stats --cohort 2024-12(sets date range to2024-12and default grouping to monthly) Example:python scripts/cli.py stats --cohort 2024(sets date range to2024-01to2024-12and default grouping to yearly)
[!NOTE] In double-snapshot mode (
--from/--to), the cohort-level output displaysStart Valueinstead ofDepositedfor any cohorts created before the start date. Additionally, theWithdrawalline displays withdrawals made specifically within the selected date range, while withdrawals made prior to the start date are already accounted for inStart Value.
Settings Subcommands
default-accounts ACCOUNTS: Set default accounts (comma-separated list of IDs, orall)default-stats-period {month,year}: Set default period for performance reports
Special Cases
Corporate actions (splits, spin-offs, zero-priced deposits) can be overridden by copying the template and defining rules:
cp assets/special_cases_template.json ../data/avanza/special_cases.json
See Also
- Detailed workflows: references/workflows.md
- Troubleshooting guide: references/troubleshooting.md
相关技能
在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
从 AdMapix API 拉取广告创意、应用、榜单和收入预估等数据,原样返回结构化 JSON。
以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。
编写、调试与调优 Playwright 测试,涵盖定位器策略、追踪诊断与 CI 友好的超时配置。
patello 的更多技能
浏览全部技能Fetch real-time SL (Stockholm public transport) departures and deviation information using a Python CLI tool. Use when checking departures, querying transit delays, or saving favorite sites and routes for quick status checks.
Process bank transaction CSV exports (Nordea, ICA), auto-categorize transactions using configurable rules, manage transaction links, and generate analytical database views.
Guides users through configuring OpenClaw, Nginx, and GitHub Actions to establish a secure, autonomous GitHub integration pipeline.
Log and track daily calorie intake, macronutrients, body weight, and waist measurements locally in a SQLite database. Provides granular statistics, weekly averages, and future calorie budgets.
Interact with the USDA FoodData Central (FDC) API to search for foods and retrieve detailed nutritional information. Use when the user asks to look up food n...
Interact with the Open Food Facts API to search for packaged food products by barcode and retrieve nutritional information. Use when the user asks to look up...