Skip to main content

optionstratlib_pricing/error/
mod.rs

1//! Errors owned by the pricing layer.
2//!
3//! Each failure here is raised by a pricing model, a Greek or a volatility
4//! solver. Errors of the layers below (`DecimalError`, `OptionsError`,
5//! `CurveError`, …) stay with `optionstratlib-core` and `optionstratlib-math`,
6//! and the variants below that wrap them carry those types unchanged.
7//!
8//! # Canonical paths (#550)
9//!
10//! Every error type is exported flat from this module, for example
11//! `optionstratlib_pricing::error::PricingError`. The file module `pricing`
12//! is private: it held nothing the flat paths do not, and was public only
13//! because 0.21 exposed it. `GreeksResult` is flat too. `greeks` stays public
14//! because its detail enums (`InputErrorKind`, …) are not flattened: kind
15//! names collide across crates once the facade gathers every crate's errors
16//! (see `greeks`'s module docs).
17//!
18//! ```rust
19//! use optionstratlib_pricing::error::{GreeksError, GreeksResult, PricingError, PricingResult};
20//! ```
21//!
22//! ```compile_fail,E0603
23//! use optionstratlib_pricing::error::pricing::PricingError;
24//! ```
25//!
26//! ```compile_fail,E0603
27//! use optionstratlib_pricing::error::pricing::PricingResult;
28//! ```
29
30/// ### Greeks Errors (`GreeksError`)
31/// Handles:
32/// * Greeks calculations
33/// * Mathematical validation
34/// * Input parameter validation
35/// * Numerical computations
36pub mod greeks;
37
38/// ### Pricing Errors (`PricingError`)
39/// Handles:
40/// * Pricing method failures (Black-Scholes, Binomial, etc.)
41/// * Monte Carlo simulation errors
42/// * Invalid pricing engine configurations
43/// * Generic pricing-related errors
44mod pricing;
45
46/// ### Volatility Errors (`VolatilityError`)
47/// Handles:
48/// * Implied volatility calculation failures
49/// * Historical volatility estimation issues
50/// * Volatility model parameter validation
51mod volatility;
52
53pub use greeks::{GreeksError, GreeksResult};
54pub use pricing::{PricingError, PricingResult};
55pub use volatility::VolatilityError;