aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics')
-rw-r--r--python/analytics/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/python/analytics/utils.py b/python/analytics/utils.py
index 4db12854..c1da64b7 100644
--- a/python/analytics/utils.py
+++ b/python/analytics/utils.py
@@ -73,12 +73,19 @@ def next_third_wed(d):
def prev_business_day(d: datetime.date):
- if ((offset := d.weekday() - 4) > 0):
+ if (offset := d.weekday() - 4) > 0:
return d - datetime.timedelta(days=offset)
else:
return d
+def next_business_day(d: datetime.date):
+ if (offset := 7 - d.weekday()) > 3:
+ return d + datetime.timedelta(days=1)
+ else:
+ return d + datetime.timedelta(days=offset)
+
+
def tenor_to_float(t: str):
if t == "6m":
return 0.5