Skip to content

Commit f7757a2

Browse files
committed
Bug fix
1 parent fc575a2 commit f7757a2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

financepy/market/curves/discount_curve.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def _zero_to_df(
131131

132132
def _df_to_zero(
133133
self,
134-
dfs: float | np.ndarray,
135-
maturity_dts: Date | list,
134+
dfs: (float, np.ndarray),
135+
maturity_dts: (Date, list),
136136
freq_type: FrequencyTypes,
137137
dc_type: DayCountTypes,
138138
):
@@ -183,7 +183,7 @@ def _df_to_zero(
183183

184184
def zero_rate(
185185
self,
186-
dts: list | Date,
186+
dts: (list, Date),
187187
freq_type: FrequencyTypes = FrequencyTypes.CONTINUOUS,
188188
dc_type: DayCountTypes = DayCountTypes.ACT_360,
189189
):
@@ -210,7 +210,7 @@ def zero_rate(
210210

211211
###########################################################################
212212

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

296296
###########################################################################
297297

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

311311
###########################################################################
312312

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

@@ -368,7 +368,7 @@ def fwd(self, dts: Date):
368368

369369
###########################################################################
370370

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

0 commit comments

Comments
 (0)