Logo Backtest Reporting Standardized Tearsheet

Backtest Reporting Standardized Tearsheet

Cộng đồng
HimanshuJ16
backtest-reporting-standardized-tearsheet

Dùng khi kết thúc một lần chạy backtest để tạo bảng hiệu suất tiêu chuẩn (Sharpe, Sortino, Calmar, mức sụt giảm tối đa, tỷ lệ thắng, hệ số lợi nhuận) từ mảng lợi nhuận theo từng kỳ, giúp so sánh các chiến lược bằng cùng một bộ chỉ số.

Add to TypingMind

Tổng quan

Nhà phát hànhHimanshuJ16
Kho mãAlgo-Trading-Skills
Tên kỹ năngbacktest-reporting-standardized-tearsheet
Sao
50
Bản fork
7
Tệp đi kèm
5
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được HimanshuJ16 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Backtest Reporting Standardized Tearsheet trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-reporting-standardized-tearsheet
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/backtest-reporting-standardized-tearsheet .claude/skills/backtest-reporting-standardized-tearsheet
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Backtest Reporting Standardized Tearsheet trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Backtest Reporting Standardized Tearsheet ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Backtest Reporting Standardized Tearsheet với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

When to Use

Invoke this skill at the conclusion of every backtest run. Reporting fragmented or customized performance metrics makes comparing different trading strategies subject to cherry-picking bias. Generating a standardized performance tearsheet ensures every strategy is benchmarked against identical risk-adjusted returns, downside risk, trade statistics, and drawdown distribution rules.

"Standardized" only holds if the conventions are pinned down, because the same returns produce different Sharpe and Calmar values under different defensible choices. This implementation fixes them explicitly and references/standards.md records each one with its source.

When NOT to Use

  • Not a trade-level analysis. The generator consumes a per-period returns array. Hit Rate is the fraction of periods that were positive, which is not the same number as a per-trade win rate — a strategy holding one winning trade across 20 flat days has a 100% trade win rate and a 5% daily hit rate. For per-trade statistics, aggregate the trade log first and feed per-trade returns with periods_per_year set accordingly.
  • Not a compliance-ready performance presentation. Under the SEC Marketing Rule, 17 CFR § 275.206(4)-1(e)(8), backtested results are hypothetical performance: "performance results that were not actually achieved by any portfolio of the investment adviser". A US-registered investment adviser putting this tearsheet in an advertisement must satisfy the conditions in § 275.206(4)-1(d)(6). This is a US adviser-advertising rule; it does not govern internal research. Check the rule and your own jurisdiction before distributing.
  • Not a correction for selection bias. These are descriptive statistics for one backtest. If the parameters were chosen by searching many configurations, the reported Sharpe is the maximum of many noisy estimates and overstates expectation. See backtest-parameter-sensitivity-analysis and factor-research-multiple-testing-correction.
  • Not a verdict. Nothing here says a strategy is deployable. Pair it with out-of-sample and regime evidence.
  • Not for log returns. Inputs must be simple per-period returns; the equity curve compounds them as $\prod(1+R_t)$.

Prerequisites

  • Daily portfolio returns series $R_t$ as simple decimal returns, chronologically ordered, with no gaps.
  • Annual risk-free rate $r_f$ (e.g. 0.04) on the same annualization basis as periods_per_year.
  • At least 2 observations; annualized figures from less than one year are flagged, not suppressed.

Workflow

  1. Set the Annualization Basis First: periods_per_year must match the sampling frequency — 252 daily, 52 weekly, 12 monthly. Using 365 on a trading-day series overstates annualized volatility by roughly 20% and understates Sharpe by the same factor.
  2. Calculate Risk-Adjusted Ratios: Sharpe uses arithmetic annualized excess return over annualized sample standard deviation (ddof=1). Sortino replaces the denominator with target downside deviation, averaging the squared below-target shortfalls over all periods rather than only the losing ones. Calmar divides CAGR by the absolute maximum drawdown; the excess-return variant is available via calmar_uses_excess_return and the report labels which was used.
  3. Compute Drawdown Statistics: Maximum drawdown is measured on an equity curve seeded at 1.0, so a decline starting on the first period counts against starting capital. Also reported: periods from peak to trough, and periods from trough back to the prior peak (None if never recovered).
  4. Compute Per-Period Trade Statistics: Hit rate, profit factor (gross win / gross loss) and average win/loss, all on periods, not trades.
  5. Read the Degenerate Values Literally: A zero denominator returns $\pm\infty$ or nan, never 0.0. An infinite Sharpe means zero variance, not a bad strategy; a nan profit factor means there were neither gains nor losses.
  6. Format Tearsheet Summary: Generate structured report dictionary for standardized presentation, carrying Periods, Calmar Convention and Annualization Extrapolated alongside the metrics so the numbers stay interpretable.

Full procedure: see references/workflows.md. Standards reference: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Annualizing Sharpe with Wrong Frequency: Multiplying daily Sharpe by $\sqrt{365}$ instead of trading days $\sqrt{252}$.
  • Ignoring Downside Volatility: Reporting high Sharpe for strategies with severe left-tail crash risk (negative skewness).
  • Unseeded Drawdown Curve: Starting the running maximum at the first period's close instead of at starting capital. A series that opens $-50%$ then recovers slightly reports a maximum drawdown of zero, and three consecutive $-10%$ periods report $-19%$ instead of the true $-27.1%$.
  • Dividing Downside Deviation by the Losing Periods: Averaging squared shortfalls over only the below-target observations instead of all of them inflates Sortino — by a factor of 2 in a series where a quarter of the periods are losses.
  • Silent NaN: A NaN return leaves hit rate and profit factor looking perfectly normal while every risk statistic becomes nan, producing a report that is half plausible. Reject it at the boundary.
  • Annualizing a Handful of Periods: One $+5%$ day compounds to over $20{,}000{,}000%$ per year. The figure is arithmetically correct and completely meaningless.
  • Reporting 0.0 for a Degenerate Denominator: A flawless constant-return curve has infinite Sharpe and infinite Calmar. Collapsing those to 0.0 makes the best possible result look like one of the worst. Note also that numpy.std of a constant series returns rounding error near $10^{-18}$, not exact zero, so an unguarded division yields an absurd finite value like $8.7\times10^{16}$.
  • Comparing Calmar Across Sources: Both $\text{CAGR}/|\text{maxDD}|$ and $(\text{CAGR}-r_f)/|\text{maxDD}|$ are in circulation. They differ whenever $r_f \neq 0$; always state which one produced the number.
  • Returns Below $-100%$: These drive the equity curve negative, where CAGR and drawdown are undefined. Before this was guarded, a $-150%$ return produced a reported drawdown of $-151%$.

Verification

  • Submit test return series, verify tearsheet output contains Sharpe, Sortino, Calmar, and Max Drawdown.
  • Assert the seeded-curve drawdown: returns $[-0.50, +0.10, +0.05]$ must report a maximum drawdown of exactly $-0.50$.
  • Assert the Sharpe closed form: returns $[a, 0, a, 0]$ with periods_per_year=4 and $r_f=0$ give exactly $\sqrt{3}$, independent of $a$.
  • Assert the Sortino convention: returns $[0.02, 0, 0.02, -0.02]$ with periods_per_year=4 and $r_f=0$ give exactly $1.0$; dividing by the losing-period count instead would give $0.5$.
  • Cross-check maximum drawdown against a brute-force $O(n^2)$ peak-to-trough scan on real data.
  • Run python -m unittest discover -s skills/backtest-reporting-standardized-tearsheet/scripts and confirm 100% pass rate.

Related Skills

  • benchmark-relative-performance-attribution
  • paper-to-live-promotion-checklist
  • backtest-parameter-sensitivity-analysis
  • monte-carlo-strategy-robustness-testing

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Backtest Reporting Standardized Tearsheet làm được gì?

Dùng khi kết thúc một lần chạy backtest để tạo bảng hiệu suất tiêu chuẩn (Sharpe, Sortino, Calmar, mức sụt giảm tối đa, tỷ lệ thắng, hệ số lợi nhuận) từ mảng lợi nhuận theo từng kỳ, giúp so sánh các chiến lược bằng cùng một bộ chỉ số.

Vì sao nên dùng Backtest Reporting Standardized Tearsheet trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Backtest Reporting Standardized Tearsheet là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Backtest Reporting Standardized Tearsheet trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-reporting-standardized-tearsheet. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Backtest Reporting Standardized Tearsheet?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Backtest Reporting Standardized Tearsheet với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Backtest Reporting Standardized Tearsheet với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Backtest Reporting Standardized Tearsheet có miễn phí không?

Có. Kỹ năng này được HimanshuJ16 phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇