Last updated: 2023-03-16.
tf_quant_finance.rates.analytics.forwards.forward_rates#
Computes forward rates from daycount fractions and discount factors.
tf_quant_finance.rates.analytics.forwards.forward_rates(
df_start_dates, df_end_dates, daycount_fractions, dtype=None, name=None
)
Example#
# Discount factors at start dates
df_start_dates = [[0.95, 0.9, 0.75], [0.95, 0.99, 0.85]]
# Discount factors at end dates
df_end_dates = [[0.8, 0.6, 0.5], [0.8, 0.9, 0.5]]
# Daycount fractions between the dates
daycount_fractions = [[0.5, 1.0, 2], [0.6, 0.4, 4.0]]
# Expected:
# [[0.375 , 0.5 , 0.25 ],
# [0.3125, 0.25 , 0.175 ]]
forward_rates(df_start_dates, df_end_dates, daycount_fractions,
dtype=tf.float64)
Args:#
df_start_dates: A realTensorrepresenting discount factors at the start dates.df_end_dates: A realTensorrepresenting discount factors at the end dates.daycount_fractions: A realTensorrepresenting year fractions for the coupon accrual.dtype:tf.Dtype. If supplied the dtype for the input and outputTensors. Default value: None which maps to the default dtype inferred fromdf_start_dates.name: Python str. The name to give to the ops created by this function. Default value: None which maps to ‘forward_rates’.
Returns: