Exemplo n.º 1
0
 def Curvature(self, t_value):
     ''':param t_value: A time value
     :type t_value: a positive integer, float or decimal
     :return: The curvature in a nelson Siegel curve at time t_value
     '''
     weight = t_value * self.scale
     if weight:
         return (self.curvature *
                 ((1 - _exp(-weight)) / weight - _exp(-weight)))
     else:
         return 0
Exemplo n.º 2
0
 def discount_factor(self, t_value):
     ''':param t_value: A time value
     :type t_value: a positive integer, float or decimal
     :return: The discount factor at time t_value
     '''
     if t_value >= 0:
         return _exp(-self.continous_forward_rate(t_value) * t_value)
     else:
         return 0
Exemplo n.º 3
0
 def Slope(self, t_value):
     ''':param t_value: A time value
     :type t_value: a positive integer, float or decimal
     :return: The Slope in a nelson Siegel curve at time t_value
     '''
     weight = t_value * self.scale
     if weight:
         return self.slope * (1 - _exp(-weight)) / weight
     else:
         return self.slope
Exemplo n.º 4
0
 def discrete_forward_rate(self, t1_value, t2_value):
     ''':param t1_value: A time value
     :type t1_value: a positive integer, float or decimal,
                     t1_value < t2_value
     :param t2_value: A time value
     :type t2_value: a positive integer, float or decimal,
                     t1_value < t2_value
     :return: The discrete forward rate between time t1_value and t2_value
     '''
     rate1 = self.continous_forward_rate(t1_value)
     rate2 = self.continous_forward_rate(t2_value)
     average_rate = ((t2_value * rate2 - t1_value * rate1) /
                     (t2_value - t1_value))
     return _exp(average_rate) - 1
Exemplo n.º 5
0
 def zero_coupon_rate(self, t_value):
     ''':param t_value: A time value
     :type t_value: a positive integer, float or decimal
     :return: The zero coupon rate at time t_value
     '''
     return _exp(self.continous_forward_rate(t_value)) - 1