Repository navigation
Fix the VaR quick start install and var-backtest on long samples - #5
Merged
Merged
Conversation
Review of the VaR model validation release (#4) found three problems. The README quick start told users to pip install the v0.1.0 release wheel. That release predates quantkit.var. Followed as written, the third README doctest block fails with ModuleNotFoundError: No module named 'quantkit.var', and `quantkit var-backtest` is an invalid choice. Cutting a release is out of scope, so the quick start now installs from GitHub and says what the v0.1.0 wheel lacks. CI gains a step that builds the wheel, installs it in a clean environment and runs the README doctests against it. `quantkit var-backtest` printed its table, then exited with status 1 when the sample was too long for null_rejection_rates to enumerate. One case is 20 years of daily returns at 95%: "enumerating 4789 days with up to 369 exceptions is too slow". The command now only leaves out the exact-size note. `quantkit --help` now mentions VaR model validation. Verification: - New test_var_backtest_handles_samples_too_long_for_the_exact_size fails on main (main() returns 1) and passes with the fix. - The v0.1.0 wheel, installed in a fresh venv: the README doctests fail in the VaR block and var-backtest is rejected. The wheel built from this branch, and pip install of git+https://github.com/ult666666/ quantkit.git, pass the README doctests (about 6 s for the CI step). - uv run pytest --doctest-glob=README.md --cov=quantkit: 435 passed, 99.62% coverage. ruff check, ruff format --check and mypy pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016h2RvhZFj77hPxFn8TQUqq
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.
Independent review of the VaR model validation release (#4). The forecasts, tests, Basel table and Z2 code held up. The quick start install and one CLI path needed fixes.
What changes
d0d304b, 2026-10-24). That release predatesquantkit.var(merged 2026-11-01). Following the README as written, the VaR doctest block fails withModuleNotFoundError: No module named 'quantkit.var', andquantkit var-backtestisinvalid choice.quantkit/var/. Installed it in a fresh Python 3.12 venv and ranpython -m doctest README.mdandquantkit var-backtest --help.pip install "git+https://github.com/ult666666/quantkit.git") and says what the v0.1.0 wheel lacks. New CI step: build the wheel, install it in a clean venv, run the README doctests andvar-backtest --helpagainst it (about 6 s).quantkit var-backtestprinted its table, then exited with status 1 whenever the sample was too long fornull_rejection_ratesto enumerate. The message was advice meant for library users.quantkit simulate --days 5040), thenquantkit var-backtest ... --level 0.95:quantkit: error: enumerating 4789 days with up to 369 exceptions is too slow; simulate i.i.d. Bernoulli exceptions instead.quantkit --helpdescribed the tool as "Options pricing, portfolio optimization and backtesting".quantkit --help.CHANGELOG.mdhas an Unreleased "Fixed" section. The README's sentence about what CI runs mentions the wheel doctests.Verification
test_var_backtest_handles_samples_too_long_for_the_exact_sizefails onmain(main()returns 1) and passes here.pip install "git+https://github.com/ult666666/quantkit.git"with pip in a fresh Python 3.13 venv, which also runsquantkit var-backtest.uv run pytest --doctest-glob=README.md --cov=quantkit: 435 passed, 99.62% coverage.uv run ruff check .,uv run ruff format --check .anduv run mypypass.Checked in the review with no change needed:
main:uv sync,uv run quantkit --helpand the README doctests pass;$commands in the README's console blocks print exactly the documented output;examples/var_backtest.pyandexamples/var_size_power.py(36 s) print exactly the README tables.tests/test_var_forecasts.pytests this for all four methods.(1 + #{Z_sim <= Z_obs}) / (N + 1).Limits
quantkit.var. The README now says so.Generated by Claude Code