watch-my-money
Analyze transactions, categorize spending, track budgets, flag overspending.
Workflow
1. Get Transactions
Ask user for bank/card CSV export OR pasted text.
Common sources:
- - Download CSV from your bank's online portal
- Export from budgeting apps
- Copy/paste transactions from statements
Supported formats:
- - Any CSV with date, description, amount columns
- Pasted text: "2026-01-03 Starbucks -5.40 CHF"
2. Parse & Normalize
Read input, normalize to standard format:
- - Auto-detect delimiter (comma, semicolon, tab)
- Parse dates (YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY)
- Normalize amounts (expenses negative, income positive)
- Extract merchant from description
- Detect recurring transactions (subscriptions)
3. Categorize Transactions
For each transaction, assign category:
Categories:
- - rent, utilities, subscriptions, groceries, eating_out
- transport, travel, shopping, health
- income, transfers, other
Categorization order:
- 1. Check saved merchant overrides
- Apply deterministic keyword rules (see common-merchants.md)
- Pattern matching (subscriptions, utilities)
- Heuristic fallback
For ambiguous merchants (batch of 5-10), ask user to confirm.
Save overrides for future runs.
4. Check Budgets
Compare spending against user-defined budgets.
Alert thresholds:
- - 80% - approaching limit (yellow)
- 100% - at limit (red)
- 120% - over budget (red, urgent)
See budget-templates.md for suggested budgets.
5. Detect Anomalies
Flag unusual spending:
- - Category spike: spend > 1.5x baseline AND delta > 50
- Subscription growth: subscriptions up > 20%
- New expensive merchant: first appearance AND spend > 30
- Potential subscriptions: recurring same-amount charges
Baseline = previous 3 months average (or current month if no history).
6. Generate HTML Report
Create local HTML file with:
- - Month summary (income, expenses, net)
- Category breakdown with budget status
- Top merchants
- Alerts section
- Recurring transactions detected
- Privacy toggle (blur amounts/merchants)
Copy template.html and inject data.
7. Save State
Persist to ~/.watch_my_money/:
- -
state.json - budgets, merchant overrides, history - INLINECODE2 - machine-readable monthly data
- INLINECODE3 - interactive report
CLI Commands
CODEBLOCK0
Output Structure
Console shows:
- - Month summary with income/expenses/net
- Category table with spend vs budget
- Recurring transactions detected
- Top 5 merchants
- Alerts as bullet points
Files written:
- - INLINECODE4
- INLINECODE5
- INLINECODE6
HTML Report Features
- - Collapsible category sections
- Budget progress bars
- Recurring transaction list
- Month-over-month comparison
- Privacy toggle (blur sensitive data)
- Dark mode (respects system preference)
- Floating action button
- Screenshot-friendly layout
- Auto-hide empty sections
Privacy
All data stays local. No network calls. No external APIs.
Transaction data is analyzed locally and stored only in ~/.watch_my_money/.
watch-my-money
分析交易记录,对支出进行分类,追踪预算,标记超支情况。
工作流程
1. 获取交易记录
要求用户提供银行/信用卡CSV导出文件或粘贴的文本。
常见来源:
- - 从银行在线门户下载CSV文件
- 从预算管理应用导出
- 从账单中复制/粘贴交易记录
支持的格式:
- - 任何包含日期、描述、金额列的CSV文件
- 粘贴文本:2026-01-03 星巴克 -5.40 CHF
2. 解析与标准化
读取输入,标准化为标准格式:
- - 自动检测分隔符(逗号、分号、制表符)
- 解析日期(YYYY-MM-DD、DD/MM/YYYY、MM/DD/YYYY)
- 标准化金额(支出为负数,收入为正数)
- 从描述中提取商户名称
- 检测周期性交易(订阅服务)
3. 交易分类
为每笔交易分配类别:
类别:
- - 房租、水电费、订阅服务、食品杂货、外出就餐
- 交通、旅行、购物、医疗健康
- 收入、转账、其他
分类顺序:
- 1. 检查已保存的商户覆盖规则
- 应用确定性关键词规则(参见 common-merchants.md)
- 模式匹配(订阅服务、水电费)
- 启发式回退
对于模糊商户(每批5-10个),要求用户确认。
保存覆盖规则以供后续运行使用。
4. 检查预算
将支出与用户定义的预算进行比较。
预警阈值:
- - 80% - 接近限额(黄色)
- 100% - 达到限额(红色)
- 120% - 超出预算(红色,紧急)
参见 budget-templates.md 获取建议预算。
5. 检测异常
标记异常支出:
- - 类别激增:支出 > 1.5倍基线 且 差值 > 50
- 订阅增长:订阅费用增长 > 20%
- 新出现的高消费商户:首次出现 且 支出 > 30
- 潜在订阅:重复相同金额的扣款
基线 = 过去3个月的平均值(若无历史数据则使用当月数据)。
6. 生成HTML报告
创建本地HTML文件,包含:
- - 月度摘要(收入、支出、净额)
- 按类别划分的支出明细及预算状态
- 主要商户
- 预警部分
- 检测到的周期性交易
- 隐私切换(模糊金额/商户名称)
复制 template.html 并注入数据。
7. 保存状态
持久化存储至 ~/.watchmymoney/:
- - state.json - 预算、商户覆盖规则、历史记录
- reports/YYYY-MM.json - 机器可读的月度数据
- reports/YYYY-MM.html - 交互式报告
CLI命令
bash
分析CSV文件
python -m watch
mymoney analyze --csv path/to/file.csv --month 2026-01
从标准输入分析
cat transactions.txt | python -m watch
mymoney analyze --stdin --month 2026-01 --default-currency CHF
比较月份
python -m watch
mymoney compare --months 2026-01 2025-12
设置预算
python -m watch
mymoney set-budget --category groceries --amount 500 --currency CHF
查看预算
python -m watch
mymoney budgets
导出月度数据
python -m watch
mymoney export --month 2026-01 --out summary.json
重置所有状态
python -m watch
mymoney reset-state
输出结构
控制台显示:
- - 月度摘要(收入/支出/净额)
- 类别表格(支出 vs 预算)
- 检测到的周期性交易
- 前5大商户
- 预警列表
写入的文件:
- - ~/.watchmymoney/state.json
- ~/.watchmymoney/reports/2026-01.json
- ~/.watchmymoney/reports/2026-01.html
HTML报告功能
- - 可折叠的类别部分
- 预算进度条
- 周期性交易列表
- 月度对比
- 隐私切换(模糊敏感数据)
- 深色模式(遵循系统偏好)
- 浮动操作按钮
- 适合截图的布局
- 自动隐藏空部分
隐私保护
所有数据保留在本地。无网络调用。无外部API。
交易数据在本地分析,仅存储在 ~/.watchmymoney/ 中。