aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/index.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/index.py')
-rw-r--r--python/analytics/index.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/python/analytics/index.py b/python/analytics/index.py
index 75a6e2a6..a8c9a8ef 100644
--- a/python/analytics/index.py
+++ b/python/analytics/index.py
@@ -299,6 +299,8 @@ class Index(object):
@trade_date.setter
def trade_date(self, d):
+ if isinstance(d, pd.Timestamp):
+ d = d.date()
prebuilt_curves = getattr(yieldcurve, '_{}_curves'.format(self.currency))
self.start_date = previous_twentieth(d)
if d in prebuilt_curves:
@@ -484,7 +486,10 @@ class ForwardIndex(object):
'__weakref__']
def __init__(self, index, forward_date):
self.index = index
- self.forward_date = forward_date
+ if isinstance(forward_date, pd.Timestamp):
+ self.forward_date = forward_date.date()
+ else:
+ self.forward_date = forward_date
self.exercise_date_settle = pd.Timestamp(forward_date) + 3* BDay()
self.df = index._yc.discount_factor(self.exercise_date_settle)
self._update()