aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/tranche_basket.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/tranche_basket.py')
-rw-r--r--python/analytics/tranche_basket.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 8235a153..e331f125 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -10,7 +10,7 @@ from .db import dawn_engine, serenitas_engine, serenitas_pool
from copy import deepcopy
from dateutil.relativedelta import relativedelta
from lru import LRU
-from pyisda.date import cds_accrued
+from pyisda.date import cds_accrued, next_twentieth
from scipy.optimize import brentq
from scipy.interpolate import CubicSpline, PchipInterpolator
from scipy.special import logit, expit
@@ -272,7 +272,12 @@ class DualCorrTranche():
@property
def pv(self):
pl, cl = self._pv()
- return -self.notional * self.tranche_factor * (pl + cl)
+ _pv = -self.notional * self.tranche_factor * (pl + cl)
+ if self.index_type == "BS":
+ if self.value_date < next_twentieth(self._trade_date):
+ stub = cds_accrued(self._trade_date, self.tranche_running * 1e-4) * self.notional
+ _pv -= stub
+ return _pv
@property
def clean_pv(self):