aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/utils.py')
-rw-r--r--python/analytics/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/analytics/utils.py b/python/analytics/utils.py
index 3d5c0da4..c0da47f6 100644
--- a/python/analytics/utils.py
+++ b/python/analytics/utils.py
@@ -69,6 +69,13 @@ def next_third_wed(d):
return y
+def tenor_to_float(t: str):
+ if t == "6m":
+ return 0.5
+ else:
+ return float(t.rstrip("yr"))
+
+
def roll_date(d, tenor, nd_array=False):
""" roll date d to the next CDS maturity"""
cutoff = pd.Timestamp("2015-09-20")