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.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index e47343fb..fafc2d70 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -124,6 +124,10 @@ class TrancheBasket(BasketIndex):
return Legs(tranche_cl(L, R, cs, 0., K), tranche_pl(L, cs, 0., K))
def tranche_pvs(self, protection=False, complement=False, shortened=0):
+ """ computes coupon leg, protection leg and bond price.
+
+ coupon leg is *dirty*.
+ bond price is *clean*."""
cl = np.zeros(self.rho.size)
pl = np.zeros(self.rho.size)
i = 0
@@ -137,9 +141,9 @@ class TrancheBasket(BasketIndex):
pl *= -1
cl *= -1
if protection:
- bp = -pl -cl
+ bp = -pl - cl + self._accrued
else:
- bp = 1 + pl + cl
+ bp = 1 + pl + cl - self._accrued
Pvs = namedtuple('TranchePvs', 'coupon_leg, protection_leg, bond_price')
return Pvs(cl, pl, bp)