weekly-performance-digest
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWeekly Performance Digest
每周绩效摘要
Overview
概述
Weekly Performance Digest aggregates the trades you closed during a week into a single
performance report. It reads CLOSED theses tracked by
(), computes headline metrics (win rate, expectancy, profit
factor, R-multiple, MAE/MFE), breaks results down across several pattern dimensions
(source skill, exit reason, thesis type, sector, mechanism tag, screening grade), and
surfaces the week's biggest winners, losers, and lessons. Output is a JSON record plus
a human-readable Markdown report. Pure calculation — no API key required.
trader-memory-corestate/theses/th_*.yaml每周绩效摘要将您一周内平仓的交易汇总成一份绩效报告。它读取由追踪的已平仓交易记录(),计算核心指标(胜率、期望收益、利润因子、R-multiple、MAE/MFE),从多个维度(来源skill、退出原因、交易类型(thesis type)、行业、机制标签、筛选等级)拆分结果,并呈现本周的最大盈利、最大亏损及经验教训。输出为JSON记录和易读的Markdown报告。纯计算操作——无需API密钥。
trader-memory-corestate/theses/th_*.yamlWhen to Use
使用场景
- At the end of a trading week to review aggregate realized performance
- To measure win rate and expectancy across all closed positions
- To see which source skills, exit reasons, sectors, or mechanisms drove wins vs losses
- To feed a month-end review (combine four weekly digests) or a postmortem
- For a quick "what worked / what didn't" snapshot grounded in real closed trades
- 交易周结束时,复盘整体已实现绩效
- 衡量所有平仓头寸的胜率和期望收益
- 查看哪些来源skill、退出原因、行业或机制主导了盈利与亏损
- 为月末复盘提供数据(合并四份周度摘要)或用于事后分析
- 获取基于真实平仓交易的快速“有效/无效策略”快照
When Not to Use
不适用场景
- For a single-trade deep review — use
trade-performance-coach - For signal-level true/false-positive classification — use
signal-postmortem - For buy/sell recommendations or position sizing — this skill is descriptive only
- 单交易深度复盘——使用
trade-performance-coach - 信号层面的真假阳性分类——使用
signal-postmortem - 买卖建议或头寸规模计算——本skill仅作描述性分析
Prerequisites
前置条件
- Python 3.9+ with (already a repo dependency)
PyYAML - A state directory of thesis YAML files (
trader-memory-core)state/theses/ - No API key required
- Python 3.9+ 及(已作为仓库依赖项)
PyYAML - 包含交易记录YAML文件的状态目录(
trader-memory-core)state/theses/ - 无需API密钥
Workflow
工作流程
Step 1: Run the digest for a week
步骤1:生成某一周的绩效摘要
bash
python3 skills/weekly-performance-digest/scripts/generate_weekly_digest.py \
--state-dir state/theses \
--from-date 2026-06-13 --to-date 2026-06-20 \
--output-dir reports/ -vDefaults: , = 7 days before ,
= today, . With no date flags it digests the
trailing 7 days.
--state-dir state/theses--from-date--to-date--to-date--output-dir reports/bash
python3 skills/weekly-performance-digest/scripts/generate_weekly_digest.py \
--state-dir state/theses \
--from-date 2026-06-13 --to-date 2026-06-20 \
--output-dir reports/ -v默认参数:, = 前7天, = 今日,。若未指定日期参数,则默认分析过去7天的数据。
--state-dir state/theses--from-date--to-date--to-date--output-dir reports/Step 2: Read the report
步骤2:查看报告
The run writes and
. Review the Markdown for the executive summary,
metrics table, pattern breakdowns, and top winners/losers; consume the JSON downstream.
reports/weekly_digest_<to-date>.jsonreports/weekly_digest_<to-date>.md运行后会生成和。查看Markdown报告获取执行摘要、指标表格、模式细分及最大盈利/亏损记录;JSON文件可用于下游处理。
reports/weekly_digest_<to-date>.jsonreports/weekly_digest_<to-date>.mdStep 3 (optional): Feed downstream
步骤3(可选):下游处理
Combine several weekly JSON digests for a monthly review, or pass the JSON to a
postmortem/coach step. The skill is descriptive — act on its findings via your normal
review process.
合并多份周度JSON摘要用于月度复盘,或将JSON文件传入事后分析/指导步骤。本skill仅作描述性分析——需通过您的常规复盘流程根据分析结果采取行动。
How It Works
工作原理
- Trade selection. A trade counts in a week if its falls in
exit.actual_dateand[from-date, to-date].status == CLOSED - Win/loss. is a winner,
outcome.pnl_dollars > 0a loser,< 0breakeven;== 0.win_rate = winners / total_trades - R-multiple. . (Stop-loss is read from
pnl_dollars / ((entry.actual_price − exit.stop_loss) × position.shares), per the real thesis schema.)exit.stop_loss - Double-counting safeguard. A CLOSED thesis's is the cumulative realized P&L across all trims plus the final leg. Headline metrics use that cumulative value over CLOSED theses only. The separate
outcome.pnl_dollarsblock scanspartial_trimsof PARTIALLY_CLOSED theses only (still open) and is reported for information — it is never added into the headline totals/win-rate. A position trimmed in week 1 then closed in week 2 therefore shows as a partial trim in week 1 and inside week 2's CLOSED headline; that is intended, not a duplicate.status_history[]
- 交易筛选:若交易的落在
exit.actual_date区间且[from-date, to-date],则计入当周统计。status == CLOSED - 盈亏判定:为盈利,
outcome.pnl_dollars > 0为亏损,< 0为盈亏平衡;== 0。win_rate = 盈利交易数 / 总交易数 - R-multiple:。(止损价取自
pnl_dollars / ((entry.actual_price − exit.stop_loss) × position.shares),遵循真实交易记录 schema。)exit.stop_loss - 重复计数防护:已平仓交易记录的是所有分批平仓加上最终平仓的累计已实现盈亏。核心指标仅使用已平仓交易记录的该累计值。单独的
outcome.pnl_dollars模块仅扫描**PARTIALLY_CLOSED(仍持仓)**交易记录的partial_trims,仅作信息展示——绝不会计入核心指标的总数/胜率。因此,第1周分批平仓、第2周全部平仓的头寸会在第1周显示为分批平仓记录,在第2周计入核心指标;此为预期设计,并非重复计数。status_history[]
Output Format
输出格式
JSON (weekly_digest_<to-date>.json
)
weekly_digest_<to-date>.jsonJSON(weekly_digest_<to-date>.json
)
weekly_digest_<to-date>.jsonjson
{
"schema_version": "1.0",
"report_type": "weekly_performance_digest",
"period": {"from": "2026-06-13", "to": "2026-06-20"},
"generated_at": "2026-06-20T21:39:07Z",
"summary": {
"total_trades": 2, "winners": 1, "losers": 1, "breakeven": 0,
"win_rate": 0.5, "expectancy": 25.0, "profit_factor": 2.0,
"total_realized_pnl": 50.0, "total_realized_pnl_pct": 4.17
},
"metrics": {
"avg_winner": 100.0, "avg_loser": -50.0,
"largest_winner": 100.0, "largest_loser": -50.0,
"avg_holding_days_winners": 9.0, "avg_holding_days_losers": 6.0,
"r_multiple_avg": 0.25, "r_multiple_stdev": 1.06,
"avg_mae_pct": -3.75, "avg_mfe_pct": 4.5
},
"pattern_analysis": {
"by_source_skill": {"...": {"wins": 1, "losses": 0, "total": 1, "win_rate": 1.0}},
"by_exit_reason": {}, "by_thesis_type": {}, "by_sector": {},
"by_mechanism_tag": {}, "by_screening_grade": {}
},
"partial_trims": {"count": 0, "total_realized_pnl": 0.0, "trims": []},
"lessons": {"top_wins": [], "top_losses": [], "process_improvements": []}
}json
{
"schema_version": "1.0",
"report_type": "weekly_performance_digest",
"period": {"from": "2026-06-13", "to": "2026-06-20"},
"generated_at": "2026-06-20T21:39:07Z",
"summary": {
"total_trades": 2, "winners": 1, "losers": 1, "breakeven": 0,
"win_rate": 0.5, "expectancy": 25.0, "profit_factor": 2.0,
"total_realized_pnl": 50.0, "total_realized_pnl_pct": 4.17
},
"metrics": {
"avg_winner": 100.0, "avg_loser": -50.0,
"largest_winner": 100.0, "largest_loser": -50.0,
"avg_holding_days_winners": 9.0, "avg_holding_days_losers": 6.0,
"r_multiple_avg": 0.25, "r_multiple_stdev": 1.06,
"avg_mae_pct": -3.75, "avg_mfe_pct": 4.5
},
"pattern_analysis": {
"by_source_skill": {"...": {"wins": 1, "losses": 0, "total": 1, "win_rate": 1.0}},
"by_exit_reason": {}, "by_thesis_type": {}, "by_sector": {},
"by_mechanism_tag": {}, "by_screening_grade": {}
},
"partial_trims": {"count": 0, "total_realized_pnl": 0.0, "trims": []},
"lessons": {"top_wins": [], "top_losses": [], "process_improvements": []}
}Markdown (weekly_digest_<to-date>.md
)
weekly_digest_<to-date>.mdMarkdown(weekly_digest_<to-date>.md
)
weekly_digest_<to-date>.mdSections: , ,
, ,
( / / ).
# Weekly Performance Digest## Executive Summary## Performance Metrics## Pattern Analysis## Lessons Learned### Top Winners### Top Losers### Process ImprovementsAn empty week still produces a valid report with zeroed metrics (exit code 0).
包含章节:、、、、( / / )。
# 每周绩效摘要## 执行摘要## 绩效指标## 模式分析## 经验教训### 最大盈利### 最大亏损### 流程改进建议空交易周仍会生成指标全为0的有效报告(退出码为0)。
Resources
资源
- — digest generator (JSON + Markdown)
scripts/generate_weekly_digest.py - — metric formulas and interpretation
references/weekly-digest-metrics.md
- —— 摘要生成器(JSON + Markdown)
scripts/generate_weekly_digest.py - —— 指标公式及解读
references/weekly-digest-metrics.md
Key Principles
核心原则
- Closed trades only for headline numbers — cumulative , keyed on exit date.
outcome.* - No double-counting — partial trims are informational and excluded from totals.
- Pattern attribution — every win/loss is attributed across multiple dimensions.
- Descriptive, not prescriptive — the digest reports; you decide.
- 核心指标仅统计已平仓交易——累计,按平仓日期统计。
outcome.* - 无重复计数——分批平仓记录仅作信息展示,不计入总数。
- 模式归因——每笔盈亏均从多个维度进行归因分析。
- 仅作描述,不提供指令——摘要仅作报告,决策由您自行做出。