atelier_quant 0.0.12

Quantitative Finance Tools & Models for the atelier-rs engine
Documentation
//! Error types for the Hawkes process module.
//!
//! Covers parameter validation failures, simulation edge cases,
//! and MLE convergence diagnostics.

use thiserror::Error;

/// Errors that can arise when constructing, simulating, or estimating
/// a [`HawkesProcess`](super::HawkesProcess).
#[non_exhaustive]
#[derive(Error, Debug)]
pub enum HawkesError {
    /// One or more input parameters are invalid (negative μ, α, or non-positive β).
    #[error("The Hawkes process did not receive a valid number")]
    HawkesInputTypeFailure,

    /// MLE estimation failed to converge or produced invalid parameters.
    #[error("Estimation failed: {0}")]
    EstimationFailed(String),

    /// Optimizer did not converge within the iteration budget.
    #[error(
        "Not converged after {iterations} iterations (gradient norm = {gradient_norm:.6e})"
    )]
    NotConverged {
        iterations: usize,
        gradient_norm: f64,
    },

    /// Event times are invalid (empty, non-sorted, contain NaN, etc.).
    #[error("Invalid event times: {0}")]
    InvalidEventTimes(String),
}