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>
impl<'a, R: Scalar> ResolvedCurve<'a, R>
pub fn substituted(
storage: &'a Curve,
params: &'a [R],
) -> Result<Self, PricingError>
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
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>
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>
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
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
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>
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>
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 without_spread(&self) -> Self
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
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>
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>
impl<'a, R: Clone + Scalar> Clone for ResolvedCurve<'a, R>
§fn clone(&self) -> ResolvedCurve<'a, R>
fn clone(&self) -> ResolvedCurve<'a, R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<'a, R: Debug + Scalar> Debug for ResolvedCurve<'a, R>
impl<'a, R: Debug + Scalar> Debug for ResolvedCurve<'a, R>
§impl<R: Scalar> YieldCurve<R> for ResolvedCurve<'_, R>
impl<R: Scalar> YieldCurve<R> for ResolvedCurve<'_, R>
§fn reference_date(&self) -> NaiveDate
fn reference_date(&self) -> NaiveDate
§fn log_discount(&self, date: NaiveDate) -> Result<R, CurveError>
fn log_discount(&self, date: NaiveDate) -> Result<R, CurveError>
date. Read more§fn discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>
fn discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>
ordinal. Read more§fn log_discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>
fn log_discount_at_ordinal(&self, ordinal: i32) -> Result<R, CurveError>
§fn zero_rate(&self, date: NaiveDate) -> Result<R, CurveError>
fn zero_rate(&self, date: NaiveDate) -> Result<R, CurveError>
date. Read more