Repository navigation
DOC: Readme: Update example output to match current stats - #1428
Open
raohemdutt wants to merge 1 commit into
Open
raohemdutt wants to merge 1 commit into
raohemdutt wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
_strategySmaCross(n1=10, n2=20)SmaCrossThere'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 exactprint(stats)output. Only the README changes.TestDocs.test_readme_contains_stats_keysstill 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