Yield Curves
Yield Term Structure Types
DiffFusion.YieldTermstructure — Typeabstract type YieldTermstructure <: Termstructure endAn abstract yield term structure that provides methods to calculate discount factors zero rates and forward rates.
DiffFusion.FlatForward — Typestruct FlatForward <: YieldTermstructure
alias::String
rate
endA constant yield term structure.
DiffFusion.flat_forward — Functionflat_forward(alias::String, rate)Create a FlatForward yield curve.
flat_forward(rate)Create a FlatForward yield curve without alias.
DiffFusion.ZeroCurve — Typestruct ZeroCurve <: YieldTermstructure
alias::String
times::AbstractVector
values::AbstractVector
interpolation
endA yield term structure based on interpolated continuous compounded zero rates.
DiffFusion.zero_curve — Functionzero_curve(
alias::String,
times::AbstractVector,
values::AbstractVector,
interp_method = (x,y) -> linear_interpolation(x, y, extrapolation_bc = Line()),
)Create a ZeroCurve object.
zero_curve(
times::AbstractVector,
values::AbstractVector,
interp_method = (x,y) -> linear_interpolation(x, y, extrapolation_bc = Line()),
)Create a ZeroCurve object without alias.
zero_curve(
alias::String,
times::AbstractVector,
values::AbstractVector,
method_alias::String,
)Create a ZeroCurve object using interpolation string.
zero_curve(
times::AbstractVector,
values::AbstractVector,
method_alias::String,
)Create a ZeroCurve object using interpolation string.
DiffFusion.LinearZeroCurve — Typestruct LinearZeroCurve <: YieldTermstructure
alias::String
times::AbstractVector
values::AbstractVector
endA yield term structure based on continuous compounded zero rates with linear interpolation and flat extrapolation.
This curve aims at mitigating limitations of Zygote and ZeroCurve.
DiffFusion.linear_zero_curve — Functionlinear_zero_curve(
alias::String,
times::AbstractVector,
values::AbstractVector,
)Create a LinearZeroCurve.
linear_zero_curve(
times::AbstractVector,
values::AbstractVector,
)Create a LinearZeroCurve with empty alias.
Functions
Discount Factor Calculation
Call operator for YieldTermstructure is defined as
(ts::YieldTermstructure)(args...) = discount(ts, args...)DiffFusion.discount — Methoddiscount(ts::YieldTermstructure, t::ModelTime)Return the discount factor with observation time t.
DiffFusion.discount — Methoddiscount(ts::FlatForward, t::ModelTime)Calculate discount factor.
DiffFusion.discount — Methoddiscount(ts::ZeroCurve, t::ModelTime)Calculate discount factor.
DiffFusion.discount — Methoddiscount(ts::LinearZeroCurve, t::ModelTime)Calculate discount factor.
Zero Rate Calculation
DiffFusion.zero_rate — Methodzero_rate(ts::YieldTermstructure, t::ModelTime)Return the continuous compounded zero rate as of today with observation time t.
DiffFusion.zero_rate — Methodzero_rate(ts::YieldTermstructure, t0::ModelTime, t1::ModelTime)Return the continuous compounded zero rate over a period t0 to t1.
Forward Rate Calculation
DiffFusion.forward_rate — Functionforward_rate(ts::YieldTermstructure, t::ModelTime, dt=1.0e-6)Return the instantaneous forward rate with observation time t.