diff options
Diffstat (limited to 'python/analytics')
| -rw-r--r-- | python/analytics/index.py | 2 | ||||
| -rw-r--r-- | python/analytics/option.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/python/analytics/index.py b/python/analytics/index.py index 75e7202c..a4e70b15 100644 --- a/python/analytics/index.py +++ b/python/analytics/index.py @@ -478,6 +478,8 @@ class ForwardIndex(object): return hash(tuple(getattr(self, k) for k in ForwardIndex.__slots__ if k != '__weakref__')) def _update(self, *args): + if self.index.trade_date > self.forward_date: + return if self.index._sc is not None: step_in_date = self.forward_date + datetime.timedelta(days=1) a = self.index._fee_leg.pv(self.index.trade_date, step_in_date, diff --git a/python/analytics/option.py b/python/analytics/option.py index 14e64d54..0a0dd2b9 100644 --- a/python/analytics/option.py +++ b/python/analytics/option.py @@ -213,7 +213,10 @@ class BlackSwaption(ForwardIndex): if self._original_pv is None: raise ValueError("original pv not set") else: - return self.pv - self._original_pv + if self.index.trade_date > self.forward_date: #TODO: do the right thing + return 0 - self._original_pv + else: + return self.pv - self._original_pv @property def delta(self): @@ -470,7 +473,6 @@ class VolatilitySurface(ForwardIndex): quotedate, source, option_type, model = surface_id quotes = self._quotes[(self._quotes.quotedate == quotedate) & (self._quotes.quote_source == source)] - self._index.ref = quotes.ref.iat[0] if model == "black": swaption_class = BlackSwaption |
