Skip to main content

TermStructure

Trait TermStructure 

Source
pub trait TermStructure: AsObservable {
Show 14 methods // Required methods fn base(&self) -> &TermStructureBase; fn max_date(&self) -> Date; // Provided methods fn day_counter(&self) -> Option<DayCounter> { ... } fn require_day_counter(&self) -> QlResult<DayCounter> { ... } fn calendar(&self) -> Option<Calendar> { ... } fn settlement_days(&self) -> QlResult<Natural> { ... } fn reference_date(&self) -> QlResult<Date> { ... } fn time_from_reference(&self, date: Date) -> QlResult<Time> { ... } fn max_time(&self) -> QlResult<Time> { ... } fn allows_extrapolation(&self) -> bool { ... } fn enable_extrapolation(&self) { ... } fn disable_extrapolation(&self) { ... } fn check_range_date(&self, date: Date, extrapolate: bool) -> QlResult<()> { ... } fn check_range_time(&self, t: Time, extrapolate: bool) -> QlResult<()> { ... }
}
Expand description

Basic term-structure functionality.

Mirrors QuantLib’s TermStructure interface; the provided methods delegate to the embedded TermStructureBase exactly as the C++ base class implements them, and a concrete curve overrides the ones it manages itself (typically reference_date when built via TermStructureBase::new).

Required Methods§

Source

fn base(&self) -> &TermStructureBase

The embedded shared holder.

Source

fn max_date(&self) -> Date

The latest date for which the curve can return values.

Provided Methods§

Source

fn day_counter(&self) -> Option<DayCounter>

The day counter used for date/time conversion, when provided.

Source

fn require_day_counter(&self) -> QlResult<DayCounter>

The day counter, or an error for structures built without one.

Source

fn calendar(&self) -> Option<Calendar>

The calendar used for reference-date calculation, when provided.

Source

fn settlement_days(&self) -> QlResult<Natural>

The settlement days used for reference-date calculation.

Source

fn reference_date(&self) -> QlResult<Date>

The date at which discount = 1.0 and/or variance = 0.0.

Source

fn time_from_reference(&self, date: Date) -> QlResult<Time>

The period from the reference date to date as a year fraction.

Source

fn max_time(&self) -> QlResult<Time>

The latest time for which the curve can return values.

Source

fn allows_extrapolation(&self) -> bool

Whether the curve answers dates/times beyond its maximum.

Source

fn enable_extrapolation(&self)

Allows extrapolation past the maximum date/time.

Source

fn disable_extrapolation(&self)

Forbids extrapolation past the maximum date/time.

Source

fn check_range_date(&self, date: Date, extrapolate: bool) -> QlResult<()>

Date-range check: date must not precede the reference date nor, unless extrapolation applies, exceed the maximum date.

Source

fn check_range_time(&self, t: Time, extrapolate: bool) -> QlResult<()>

Time-range check: t must be finite, non-negative and, unless extrapolation applies, within the maximum time.

The t >= 0 requirement is QuantLib’s checkRange (termstructure.cpp:66). Divergence: the finiteness clause. +inf passes t >= 0 in C++, and an extrapolating curve never compares it against maxTime(), so it reaches the interpolator unchecked.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TermStructure for BlackConstantVol

Source§

impl TermStructure for BlackVarianceSurface

Source§

impl TermStructure for CapFloorTermVolSurface

Source§

impl TermStructure for ConstantOptionletVolatility

Source§

impl TermStructure for ConstantSwaptionVolatility

Source§

impl TermStructure for FlatForward

Source§

impl TermStructure for FlatHazardRate

Source§

impl TermStructure for ForwardSpreadedTermStructure

Source§

impl TermStructure for ImpliedTermStructure

Source§

impl TermStructure for InterpolatedSwaptionVolatilityCube

Source§

impl TermStructure for LocalConstantVol

Source§

impl TermStructure for LocalVolSurface

Source§

impl TermStructure for SabrSwaptionVolatilityCube

Source§

impl TermStructure for StrippedOptionletAdapter

Source§

impl TermStructure for SwaptionVolatilityMatrix

Source§

impl TermStructure for ZeroSpreadedTermStructure

Source§

impl<I: Interpolator + 'static> TermStructure for LocalVolCurve<I>

Source§

impl<I: Interpolator + 'static> TermStructure for PiecewiseDefaultCurve<HazardRate, I>

Source§

impl<I: Interpolator + 'static> TermStructure for PiecewiseZeroInflationCurve<I>

Source§

impl<I: Interpolator> TermStructure for BlackVarianceCurve<I>

Source§

impl<I: Interpolator> TermStructure for InterpolatedDiscountCurve<I>

Source§

impl<I: Interpolator> TermStructure for InterpolatedForwardCurve<I>

Source§

impl<I: Interpolator> TermStructure for InterpolatedHazardRateCurve<I>

Source§

impl<I: Interpolator> TermStructure for InterpolatedZeroCurve<I>

Source§

impl<I: Interpolator> TermStructure for InterpolatedZeroInflationCurve<I>

Source§

impl<T: YieldBootstrapTraits + 'static, I: Interpolator + 'static> TermStructure for PiecewiseYieldCurve<T, I>