aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/basket_index.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/basket_index.py')
-rw-r--r--python/analytics/basket_index.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/analytics/basket_index.py b/python/analytics/basket_index.py
index 8a2a7766..ef3df15d 100644
--- a/python/analytics/basket_index.py
+++ b/python/analytics/basket_index.py
@@ -2,6 +2,7 @@ from .index_data import get_index_quotes, get_singlenames_curves
from .db import serenitas_engine
from .utils import tenor_t
from functools import partial
+from pyisda.cdsone import upfront_charge, spread_from_upfront
from pyisda.credit_index import CreditIndex
from pyisda.date import previous_twentieth
from typing import List
@@ -12,7 +13,7 @@ import pandas as pd
from math import exp
from scipy.optimize import brentq
from pandas.tseries.offsets import Day, BDay
-from pyisda.cdsone import upfront_charge
+
def make_index(t, d, args):
@@ -272,6 +273,14 @@ class BasketIndex(CreditIndex):
self.step_in_date, self.start_date, maturity,
coupon, self.yc, spread, recov)
+ def _snacspread(self, coupon, recov, maturity):
+ return spread_from_upfront(self.value_date, self.cash_settle_date,
+ self.start_date, self.step_in_date,
+ self.start_date, maturity,
+ coupon, self.yc,
+ self.pv(maturity), recov)
+
+
class MarkitBasketIndex(BasketIndex):
def __init__(self, index_type: str, series: int, tenors: List[str], *,