Skip to content

fix(examples): use real backtest-harness API in adapter example/test - #16

Merged
mrnicholasbcarter-code merged 1 commit into
masterfrom
fix/backtest-adapter-real-api
Sep 24, 2026
Merged

mrnicholasbcarter-code merged 1 commit into
masterfrom
fix/backtest-adapter-real-api

Conversation

@mrnicholasbcarter-code

Copy link
Copy Markdown
Owner

examples/backtest_adapter.py and tests/integration/test_backtest_adapter.py called backtest_harness.load_kalshi_sample_trades() and passed seed= to MonteCarloSimulator.simulate_equity_paths. Neither exists in verdict-backtest (git log --all -S load_kalshi_sample_trades in verdict-backtest: no hits).

The breakage was hidden: CI does not install verdict-backtest, so pytest.importorskip always skipped the test.

Proof on master with verdict-backtest (origin/master 537c3d1) installed:

  • python examples/backtest_adapter.py → ImportError: cannot import name 'load_kalshi_sample_trades'
  • pytest tests/integration → 1 failed

Fix: use the real public, seeded entry point backtest_harness.run_counterfactual. The test now also checks that the same seed gives the same results_hash across the package boundary.

After the fix, with verdict-backtest installed: the example runs, and pytest tests/integration gives 3 passed, 1 skipped. In the default CI env: 53 passed, 3 skipped. Ruff check and format pass.

Follow-up, not in this PR: install verdict-backtest in one CI job so the skip no longer hides failures.
(The marker warning is fixed separately in #14.)

@mrnicholasbcarter-code
mrnicholasbcarter-code merged commit bd56e69 into master Sep 24, 2026
10 checks passed
@mrnicholasbcarter-code
mrnicholasbcarter-code deleted the fix/backtest-adapter-real-api branch September 24, 2026 10:48
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