tf_quant_finance.rates.analytics.swap.ir_swap_par_rate_and_annuity

Contents

Last updated: 2023-03-16.

tf_quant_finance.rates.analytics.swap.ir_swap_par_rate_and_annuity#

View source

Utility function to compute par swap rate and annuity.

tf_quant_finance.rates.analytics.swap.ir_swap_par_rate_and_annuity(
    floating_leg_start_times, floating_leg_end_times, fixed_leg_payment_times,
    fixed_leg_daycount_fractions, reference_rate_fn, dtype=None, name=None
)

Args:#

  • floating_leg_start_times: A real Tensor of the same dtype as expiries. The times when accrual begins for each payment in the floating leg. The shape of this input should be expiries.shape + [m] where m denotes the number of floating payments in each leg.

  • floating_leg_end_times: A real Tensor of the same dtype as expiries. The times when accrual ends for each payment in the floating leg. The shape of this input should be expiries.shape + [m] where m denotes the number of floating payments in each leg.

  • fixed_leg_payment_times: A real Tensor of the same dtype as expiries. The payment times for each payment in the fixed leg. The shape of this input should be expiries.shape + [n] where n denotes the number of fixed payments in each leg.

  • fixed_leg_daycount_fractions: A real Tensor of the same dtype and compatible shape as fixed_leg_payment_times. The daycount fractions for each payment in the fixed leg.

  • reference_rate_fn: A Python callable that accepts expiry time as a real Tensor and returns a Tensor of shape input_shape + [dim]. Returns the continuously compounded zero rate at the present time for the input expiry time.

  • dtype: tf.Dtype. If supplied the dtype for the input and output Tensors. Default value: None which maps to the default dtype inferred from floating_leg_start_times.

  • name: Python str. The name to give to the ops created by this function. Default value: None which maps to ‘ir_swap_par_rate_and_annuity’.

Returns:#

A tuple with two elements containing par swap rate and swap annuities.