Last updated: 2023-03-16.
tf_quant_finance.experimental.instruments.RateCurve#
Represents an interest rate curve.
tf_quant_finance.experimental.instruments.RateCurve(
maturity_dates, rates, valuation_date, compounding=None, interpolator=None,
dtype=None, name=None
)
Args:#
maturity_dates: ADateTensorcontaining the maturity dates on which the curve is specified.rates: ATensorof real dtype specifying the rates (or yields) corresponding to the input maturities. The shape of this input should match the shape ofmaturity_dates.valuation_date: A scalarDateTensorspecifying the valuation (or settlement) date for the curve.compounding: Optional scalarTensorof dtype int32 specifying the compounding frequency of the input rates. Use compounding=0 for continuously compounded rates. If compounding is different than 0, then rates are converted to continuously componded rates to perform interpolation. Default value: If omitted, the default value is 0.interpolator: Optional Python callable specifying the desired interpolation method. It should have the following interface: yi = interpolator(xi, x, y)x,y, ‘xi’, ‘yi’ are allTensorsof real dtype.xandyare the sample points and values (respectively) of the function to be interpolated.xiare the points at which the interpolation is desired andyiare the corresponding interpolated values returned by the function. Default value: None in which case linear interpolation is used.dtype:tf.Dtype. Optional input specifying the dtype of theratesinput.name: Python str. The name to give to the ops created by this function. Default value:Nonewhich maps to ‘rate_curve’.
Attributes:#
valuation_date
Methods#
get_discount_factor
get_discount_factor(
interpolation_dates
)
Returns discount factors at interpolation_dates.
get_forward_rate
get_forward_rate(
start_date, maturity_date, daycount_fraction=None
)
Returns the simply accrued forward rate between [start_dt, maturity_dt].
Args:#
start_date: ADateTensorspecifying the start of the accrual period for the forward rate.maturity_date: ADateTensorspecifying the end of the accrual period for the forward rate. The shape ofmaturity_datemust be the same as the shape of theDateTensorstart_date.daycount_fraction: An optionalTensorof real dtype specifying the time betweenstart_dateandmaturity_datein years computed using the forward rate’s day count basis. The shape of the input should be the same as that ofstart_dateandmaturity_date. Default value:None, in which case the daycount fraction is computed usingACTUAL_365convention.
Returns:#
A real tensor of same shape as the inputs containing the simply compounded forward rate.
get_rates
get_rates(
interpolation_dates
)
Returns interpolated rates at interpolation_dates.