Skip to main content

ResolvedCurve

Struct ResolvedCurve 

pub struct ResolvedCurve<'a, R: Scalar> {
    inner: Lifted<'a, Curve, CurveView<'a, R>>,
    overlay: Option<Box<Overlay<'a, R>>>,
    ratio: Option<Box<[ResolvedCurve<'a, R>; 2]>>,
}
Expand description

A curve resolved for one pricing call, lifted into mode R.

Carries the storage alongside the lifted view, which is what makes passive possible: projecting re-lifts the same borrowed storage rather than going back to the market to resolve a key again, and the passive lift borrows its parameters, so the projection allocates nothing for them.

Fields§

§inner: Lifted<'a, Curve, CurveView<'a, R>>§overlay: Option<Box<Overlay<'a, R>>>

What was composed onto this curve at resolution, if anything.

§ratio: Option<Box<[ResolvedCurve<'a, R>; 2]>>

The numerator and denominator of a discount ratio this curve is the base of, D = D_self · D_num / D_den, each resolved on its own key. Beneath any overlay: a security spread composes onto the ratio.

Implementations§

§

impl<'a, R: Scalar> ResolvedCurve<'a, R>

pub fn lift(storage: &'a Curve) -> Self

storage lifted into mode R.

pub fn substituted( storage: &'a Curve, params: &'a [R], ) -> Result<Self, PricingError>

storage lifted over params in place of its stored ones — how a risk pass installs registered handles.

§Errors

PricingError::Curve if params is the wrong length for storage.

pub(crate) fn with_ratio(self, numerator: Self, denominator: Self) -> Self

This curve as the base of a discount ratio, D = D_self · D_numerator / D_denominator — how resolution composes a triangulated discount key. Each piece stays its own resolved curve, so its parameters keep their own risk axis.

fn core_log_discount(&self, date: NaiveDate) -> Result<R, CurveError>

The log discount factor beneath any overlay: the curve’s own, plus a ratio’s numerator less its denominator.

fn core_log_discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>

fn core_discount(&self, date: NaiveDate) -> Result<R, CurveError>

The discount factor beneath any overlay.

pub fn with_spread(self, spread: ResolvedCurve<'a, R>) -> Self

This curve with spread composed onto it — how resolve honours a declared security spread. The spread stays its own resolved curve, so its parameters keep their own risk axis.

pub(crate) fn with_repo_spreads( self, spreads: Vec<ResolvedCurve<'a, R>>, ) -> Self

This curve as the base of a repo spread chain: 1/P = 1/P_self + Σ s_k(t)·τ_k(t), each spread resolved on its own repo key — how resolution composes a repo key declared over a base. Each spread must be a RepoSpread; resolution checks that, and that they share one basis.

fn repo_spread_term(&self, date: NaiveDate) -> Result<R, CurveError>

The spread and its accrual at date, for a curve resolved over a RepoSpread leaf.

fn simple_inverse( &self, spreads: &[ResolvedCurve<'a, R>], date: NaiveDate, ) -> Result<R, CurveError>

1/P(date) under the simple overlay: the base’s inverse discount factor plus every spread’s accrued spread, refused where it is not positive.

pub fn storage(&self) -> &'a Curve

The stored curve this resolved against.

pub fn view(&self) -> &CurveView<'a, R>

The lifted view, for a caller that wants the curve itself.

pub fn without_spread(&self) -> Self

This curve without the security spread composed at resolution — the risk-free curve a spread-marked product’s coupons still project off.

pub fn has_spread(&self) -> bool

Whether a security spread or a repo spread chain was composed onto this curve.

pub fn passive(&self) -> ResolvedCurve<'a, f64>

The same curve, carrying no derivatives — spread included, so a passive kernel over a spread-composed curve prices what the active valuation prices.

Trait Implementations§

§

impl<'a, R: Clone + Scalar> Clone for ResolvedCurve<'a, R>

§

fn clone(&self) -> ResolvedCurve<'a, R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a, R: Debug + Scalar> Debug for ResolvedCurve<'a, R>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<R: Scalar> YieldCurve<R> for ResolvedCurve<'_, R>

§

fn reference_date(&self) -> NaiveDate

The date at which the discount factor is 1.
§

fn discount(&self, date: NaiveDate) -> Result<R, CurveError>

The discount factor to date. Read more
§

fn log_discount(&self, date: NaiveDate) -> Result<R, CurveError>

The log discount factor to date. Read more
§

fn discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>

The discount factor to the proleptic-Gregorian day number ordinal. Read more
§

fn log_discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>

The log discount factor at ordinal; see discount_at_ordinal. Read more
§

fn zero_rate(&self, date: NaiveDate) -> Result<R, CurveError>

The continuously-compounded zero rate to date. Read more
§

fn forward_rate( &self, start: NaiveDate, end: NaiveDate, ) -> Result<R, CurveError>

The continuously-compounded forward rate between start and end. Read more
§

fn rate_day_count(&self) -> DayCountFraction

The day count this curve forms a rate under. Read more

Auto Trait Implementations§

§

impl<'a, R> !Freeze for ResolvedCurve<'a, R>

§

impl<'a, R> !RefUnwindSafe for ResolvedCurve<'a, R>

§

impl<'a, R> !Sync for ResolvedCurve<'a, R>

§

impl<'a, R> Send for ResolvedCurve<'a, R>

§

impl<'a, R> Unpin for ResolvedCurve<'a, R>
where R: Unpin,

§

impl<'a, R> UnsafeUnpin for ResolvedCurve<'a, R>
where R: UnsafeUnpin,

§

impl<'a, R> UnwindSafe for ResolvedCurve<'a, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.