merton.exceptions

Exception hierarchy for merton.

Every numerical or operational failure raises a MertonError subclass. Each carries an optional suggested_fix attribute that gets rendered when the exception is printed.

Examples

>>> raise CalibrationConvergenceError(
...     "Vassalou-Xing did not converge after 200 steps",
...     suggested_fix="Increase max_iter or relax tol.",
... )
Traceback (most recent call last):
    ...
merton.exceptions.CalibrationConvergenceError: Vassalou-Xing did not converge ...

Exceptions

MertonError

Base class for every error raised by merton.

MertonInputError

Invalid input values supplied by the caller (NaN, negative debt, etc.).

DimensionMismatchError

Two or more input arrays have incompatible shapes.

NonFiniteInputError

An input contains NaN or infinity where finite values are required.

DataQualityError

A passed-in panel of market data is too sparse or contains stale ticks.

InsufficientDataError

Not enough observations to fit / calibrate.

CalibrationError

Calibration failed for some reason.

CalibrationConvergenceError

Iterative calibration did not converge inside max_iter.

BackendError

Something went wrong with the array-backend dispatch layer.

BackendNotAvailableError

The requested backend extra is not installed.

BackendDispatchError

A function could not be dispatched to any available backend.

ExtensionError

An extension model (Black-Cox, Geske, …) raised an error.

ExcelError

Something went wrong with the Excel integration path.

ManifestInstallError

The Office.js add-in manifest could not be installed.

ServerStartupError

The xlwings Server failed to start.

MertonWarning

Base class for non-fatal warnings emitted by merton.

MertonBackendFallbackWarning

A requested backend was unavailable; we fell back to another.

MertonNumericalWarning

Iterative solver hit a numerical edge case (near-zero σ, etc.).

Module Contents

exception merton.exceptions.MertonError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: Exception

Base class for every error raised by merton.

suggested_fix = None[source]
exception merton.exceptions.MertonInputError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError, ValueError

Invalid input values supplied by the caller (NaN, negative debt, etc.).

exception merton.exceptions.DimensionMismatchError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonInputError

Two or more input arrays have incompatible shapes.

exception merton.exceptions.NonFiniteInputError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonInputError

An input contains NaN or infinity where finite values are required.

exception merton.exceptions.DataQualityError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError

A passed-in panel of market data is too sparse or contains stale ticks.

exception merton.exceptions.InsufficientDataError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: DataQualityError

Not enough observations to fit / calibrate.

exception merton.exceptions.CalibrationError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError

Calibration failed for some reason.

exception merton.exceptions.CalibrationConvergenceError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: CalibrationError

Iterative calibration did not converge inside max_iter.

exception merton.exceptions.BackendError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError

Something went wrong with the array-backend dispatch layer.

exception merton.exceptions.BackendNotAvailableError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: BackendError

The requested backend extra is not installed.

exception merton.exceptions.BackendDispatchError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: BackendError

A function could not be dispatched to any available backend.

exception merton.exceptions.ExtensionError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError

An extension model (Black-Cox, Geske, …) raised an error.

exception merton.exceptions.ExcelError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: MertonError

Something went wrong with the Excel integration path.

exception merton.exceptions.ManifestInstallError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: ExcelError

The Office.js add-in manifest could not be installed.

exception merton.exceptions.ServerStartupError(message: str = '', *, suggested_fix: str | None = None)[source]

Bases: ExcelError

The xlwings Server failed to start.

exception merton.exceptions.MertonWarning[source]

Bases: UserWarning

Base class for non-fatal warnings emitted by merton.

exception merton.exceptions.MertonBackendFallbackWarning[source]

Bases: MertonWarning

A requested backend was unavailable; we fell back to another.

exception merton.exceptions.MertonNumericalWarning[source]

Bases: MertonWarning

Iterative solver hit a numerical edge case (near-zero σ, etc.).