aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/analytics/tranche_basket.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index b7039d1c..6ab730a3 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -257,7 +257,13 @@ class DualCorrTranche:
def value_date(self, d: pd.Timestamp):
self._index.value_date = d
start_date = pd.Timestamp(d) + Day()
- self.cs = self.cs[self.cs.index > start_date]
+ self.cs = credit_schedule(
+ start_date,
+ 1.0,
+ self._index.yc,
+ self.maturity,
+ rule=OldCDS if self.index_type == "BS" else CDS2015,
+ )
self._accrued = (
(start_date - self.cs.start_dates[0]).days
/ 360
@@ -484,8 +490,8 @@ class DualCorrTranche:
)
def mark(self, **args):
- if "spread" in args:
- spread = args["spread"]
+ if "ref" in args:
+ ref = args["ref"]
else:
if not self.index_type == "BS":
col_ref = "close_price" if self.index_type == "HY" else "close_spread"
@@ -652,7 +658,7 @@ class DualCorrTranche:
r = self.pv - pv_orig
self.rho = rho_orig
self.maturity += relativedelta(years=1)
- return r / abs(self.notional) + self.tranche_running * 1e-4
+ return -r / self.notional + self.tranche_running * 1e-4
def expected_loss(self, discounted=True, shortened=0):
if shortened > 0: