[go: up one dir, main page]

Skip to content

Commit

Permalink
Fixed bug introduced by mkdocs guy
Browse files Browse the repository at this point in the history
  • Loading branch information
domokane committed Sep 2, 2024
1 parent 13c0045 commit b6c4f58
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion financepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cr = "\n"

s = "####################################################################" + cr
s += "# FINANCEPY BETA Version " + str('0.360') + " - This build: 01 Aug 2024 at 13:01 #" + cr
s += "# FINANCEPY BETA Version " + str('0.360') + " - This build: 02 Sep 2024 at 12:10 #" + cr
s += "# This software is distributed FREE AND WITHOUT ANY WARRANTY #" + cr
s += "# Report bugs as issues at https://github.com/domokane/FinancePy #" + cr
s += "####################################################################"
Expand Down
67 changes: 35 additions & 32 deletions financepy/utils/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import numpy as np
import datetime

# import math
import math

# from financepy.utils.error import FinError
from .error import FinError
Expand Down Expand Up @@ -790,37 +790,40 @@ def add_tenor(self, tenor: Union[list, str, Tenor]):

new_dts = []

for tenor_str in tenor:

tenor_str = tenor_str.upper()
DAYS = 1
WEEKS = 2
MONTHS = 3
YEARS = 4

period_type = 0
num_periods = 0

if tenor_str == "ON": # overnight - should be used only if spot days = 0
period_type = DAYS
num_periods = 1
elif tenor_str == "TN": # overnight - should be used when spot days > 0
period_type = DAYS
num_periods = 1
elif tenor_str[-1] == "D":
period_type = DAYS
num_periods = int(tenor_str[0:-1])
elif tenor_str[-1] == "W":
period_type = WEEKS
num_periods = int(tenor_str[0:-1])
elif tenor_str[-1] == "M":
period_type = MONTHS
num_periods = int(tenor_str[0:-1])
elif tenor_str[-1] == "Y":
period_type = YEARS
num_periods = int(tenor_str[0:-1])
else:
raise FinError("Unknown tenor type in " + tenor)
for tenor_string in tenor:
tenor_obj = Tenor.as_tenor(str_or_tenor=tenor_string)

# for tenor_str in tenor:

# tenor_str = tenor_str.upper()
# DAYS = 1
# WEEKS = 2
# MONTHS = 3
# YEARS = 4

# period_type = 0
# num_periods = 0

# if tenor_str == "ON": # overnight - should be used only if spot days = 0
# period_type = DAYS
# num_periods = 1
# elif tenor_str == "TN": # overnight - should be used when spot days > 0
# period_type = DAYS
# num_periods = 1
# elif tenor_str[-1] == "D":
# period_type = DAYS
# num_periods = int(tenor_str[0:-1])
# elif tenor_str[-1] == "W":
# period_type = WEEKS
# num_periods = int(tenor_str[0:-1])
# elif tenor_str[-1] == "M":
# period_type = MONTHS
# num_periods = int(tenor_str[0:-1])
# elif tenor_str[-1] == "Y":
# period_type = YEARS
# num_periods = int(tenor_str[0:-1])
# else:
# raise FinError("Unknown tenor type in " + tenor)

new_dt = Date(self.d, self.m, self.y)

Expand Down

0 comments on commit b6c4f58

Please sign in to comment.