Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
domokane committed Oct 6, 2024
1 parent fc575a2 commit f7757a2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions financepy/market/curves/discount_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def _zero_to_df(

def _df_to_zero(
self,
dfs: float | np.ndarray,
maturity_dts: Date | list,
dfs: (float, np.ndarray),
maturity_dts: (Date, list),
freq_type: FrequencyTypes,
dc_type: DayCountTypes,
):
Expand Down Expand Up @@ -183,7 +183,7 @@ def _df_to_zero(

def zero_rate(
self,
dts: list | Date,
dts: (list, Date),
freq_type: FrequencyTypes = FrequencyTypes.CONTINUOUS,
dc_type: DayCountTypes = DayCountTypes.ACT_360,
):
Expand All @@ -210,7 +210,7 @@ def zero_rate(

###########################################################################

def cc_rate(self, dts: list | Date, dc_type: DayCountTypes = DayCountTypes.SIMPLE):
def cc_rate(self, dts: (list, Date), dc_type: DayCountTypes = DayCountTypes.SIMPLE):
"""Calculation of zero rates with continuous compounding. This
function can return a vector of cc rates given a vector of
dates so must use Numpy functions."""
Expand Down Expand Up @@ -295,7 +295,7 @@ def swap_rate(

###########################################################################

def df(self, dt: list | Date, day_count=DayCountTypes.ACT_ACT_ISDA):
def df(self, dt: (list, Date), day_count=DayCountTypes.ACT_ACT_ISDA):
"""Function to calculate a discount factor from a date or a
vector of dates. The day count determines how dates get converted to
years. I allow this to default to ACT_ACT_ISDA unless specified."""
Expand All @@ -310,7 +310,7 @@ def df(self, dt: list | Date, day_count=DayCountTypes.ACT_ACT_ISDA):

###########################################################################

def _df(self, t: float | np.ndarray):
def _df(self, t: (float, np.ndarray)):
"""Hidden function to calculate a discount factor from a time or a
vector of times. Discourage usage in favour of passing in dates."""

Expand Down Expand Up @@ -368,7 +368,7 @@ def fwd(self, dts: Date):

###########################################################################

def _fwd(self, times: np.ndarray | float):
def _fwd(self, times: (np.ndarray, float)):
"""Calculate the continuously compounded forward rate at the forward
time provided. This is done by perturbing the time by a small amount
and measuring the change in the log of the discount factor divided by
Expand Down

0 comments on commit f7757a2

Please sign in to comment.