Polish web demo tests and refresh notebooks

- add README live-demo badge
- tighten engine validation for jump grids and detector indices
- replace flaky FastAPI TestClient web tests with direct handler tests
- remove unused httpx dev dependency
- clean stale frontend comments
- re-execute notebooks with clean sequential outputs
This commit is contained in:
2026-08-03 08:15:22 -04:00
parent 8e6c98945b
commit e5d785f511
13 changed files with 277 additions and 238 deletions
+17
View File
@@ -52,6 +52,16 @@ def test_detection_deadline_is_enforced():
assert detect_barrier_event(samples, values, 1, 90.0, "down", 3) == (True, 3, 4)
def test_detection_rejects_invalid_indices():
values = np.array([100.0, 89.0, 88.0])
with pytest.raises(ValueError, match="within the path"):
detect_barrier_event(np.array([0, 3]), values, 1, 90.0, "down", 2)
with pytest.raises(ValueError, match="ascending"):
detect_barrier_event(np.array([2, 1]), values, 1, 90.0, "down", 2)
with pytest.raises(ValueError, match="integer grid indices"):
detect_barrier_event(np.array([0.5, 1.0]), values, 1, 90.0, "down", 2)
def test_fixed_indices_have_exact_requested_count():
for n in (2, 10, 101):
for k in range(1, n + 1):
@@ -74,6 +84,13 @@ def test_zero_jump_intensity_matches_gbm_for_same_seed():
assert np.array_equal(gbm, jump)
def test_merton_jump_diffusion_validates_time_grid_before_sampling():
with pytest.raises(ValueError, match="T"):
merton_jump_diffusion(100.0, 0.0, 100)
with pytest.raises(ValueError, match="n_steps"):
merton_jump_diffusion(100.0, 5 / TRADING_MINUTES_PER_YEAR, 0)
def test_simulation_baseline_has_exact_per_path_budget():
result = run_monte_carlo_simulation(
n_paths=12,