fix(tests,docs): chain fixtures + doc link (0.16.1)#384
Merged
Conversation
- Replace `get_tomorrow_formatted()` with `get_x_days_formatted(30)` in the three `create_test_option_chain` helpers in `src/chains/chain.rs`. `Actual365Fixed::day_count` in the `expiration_date` 0.2.0 crate truncates to integer days, so a chain whose expiration is tomorrow's fixed 18:30 UTC evaluated after that time of day collapsed to `t = 0` and broke every Black-Scholes-driven axis. Tests affected: `test_curve_multiple_axes`, `test_curve_price_short_put`, `test_surface_different_greeks`, `test_vanna_surface`. 30 days puts every fixture well above the integer-truncation boundary regardless of execution time. - `constants.rs`: `MAX_NEWTON_ITER` no longer intra-doc-links to the crate-private `MAX_ITERATIONS_IV`; the doc just names the counterpart in prose, so `cargo doc --no-deps` emits zero warnings. - Bump to `0.16.1` and document the hot-fix in `CHANGELOG.md`.
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Summary
Root cause
`cargo test --lib chains::chain::tests_basic_curves::test_curve_price_short_put` was failing depending on time of day:
```
[0] strike=90, iv=0.2, expiration=DateTime(2026-04-20T18:30:00Z), t2e=Ok(0)
[0] bs err: Pricing error using method 'unknown': Input validation error: Invalid time 0: Expiration date cannot be zero
```
Upstream `Actual365Fixed::day_count`:
```rust
Ok(duration.num_days() as f64) // integer truncation → 0 for sub-24h
```
Previous fixtures built a chain with tomorrow 18:30 UTC expiry, which is <24h away after 18:30 UTC today, yielding `t = 0` and breaking every BS-driven axis. Also fires up the 4 persistent failures on the coverage job.
Test plan