diff options
| -rw-r--r-- | python/analytics/basket_index.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/analytics/basket_index.py b/python/analytics/basket_index.py index baaa23a2..3295c018 100644 --- a/python/analytics/basket_index.py +++ b/python/analytics/basket_index.py @@ -161,12 +161,15 @@ class BasketIndex(CreditIndex): return super().duration(self.step_in_date, self.value_date, maturity, self.yc) - def theta(self, maturity=None, coupon=None): + def theta(self, maturity=None, coupon=None, theta_date=None): """ index thetas if maturity is None, returns a series of theta for all tenors. Otherwise computes the theta for that specific maturity (which needs - not be an existing tenor)""" + not be an existing tenor) + + if theta_date is provided, computes the theta to that specific date + instead of one-year theta""" if hasattr(self, "index_quotes"): index_quotes = self.index_quotes.loc[self.value_date] else: @@ -178,7 +181,7 @@ class BasketIndex(CreditIndex): index_quote = np.nan if index_quotes is None else index_quotes[m] r.append(super().theta(self.step_in_date, self.cash_settle_date, m, self.yc, self.recovery, coupon, - index_quote)) + index_quote, theta_date)) return pd.Series(r, index=self.index_desc.tenor, name='theta') else: if coupon is None: @@ -188,7 +191,7 @@ class BasketIndex(CreditIndex): raise ValueError("Non standard maturity: coupon must be provided") return super().theta(self.step_in_date, self.cash_settle_date, maturity, self.yc, self.recovery, coupon, - np.nan) + np.nan, theta_date) def coupon(self, maturity=None): if maturity is None: |
