Skip to content

DOC: Readme: Update example output to match current stats - #1428

Open
raohemdutt wants to merge 1 commit into
kernc:masterfrom
raohemdutt:doc-readme-example-output
Open

raohemdutt wants to merge 1 commit into
kernc:masterfrom
raohemdutt:doc-readme-example-output

Conversation

@raohemdutt

@raohemdutt raohemdutt commented Oct 23, 2026 •

Copy link
Copy Markdown

The example output under Usage → Results in: in the README doesn't match what the example prints today. That block was last updated in 2020 (a95b259). Since then the stats code has changed. For example, commissions are now reported, and buy & hold now starts after the indicator warm-up (_stats.py, first_trading_bar).

I ran the README snippet exactly as written on current master (ca2e261) and got:

Stat README Actual
Equity Final [$] 68935.12 56263.52
Return [%] 589.35 462.64
Buy & Hold Return [%] 703.46 607.37
CAGR [%] 16.80 22.44
Sharpe Ratio 0.66 0.60
Max. Drawdown [%] -33.08 -33.93
Kelly Criterion 0.6134 0.2093
_strategy SmaCross(n1=10, n2=20) SmaCross

There's also a new Commissions [$] row. For someone new to the library, the first example not matching the README is confusing, and it makes it look like their install is broken. This PR replaces the block with the exact print(stats) output. Only the README changes.

TestDocs.test_readme_contains_stats_keys still passes. It only checks that each stat name appears in the README, not the values, which is probably why the old numbers were never caught.

Versions: Python 3.14.3, pandas 3.1.0, numpy 2.5.4, bokeh 3.10.1, macOS.

🤖 Generated with Claude Code

The "Results in:" block dates from 2020 (a95b259). Running the README
example on current master gives different values (e.g. Return 462.64%
vs 589.35%, Buy & Hold 607.37% vs 703.46%, Kelly 0.21 vs 0.61), adds the
Commissions [$] row, and prints _strategy as "SmaCross" since the
example class has no parameters. Replaced with the actual print(stats)
output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant