diff options
Diffstat (limited to 'python/analytics/portfolio.py')
| -rw-r--r-- | python/analytics/portfolio.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/python/analytics/portfolio.py b/python/analytics/portfolio.py index a4ed393d..ef1d5578 100644 --- a/python/analytics/portfolio.py +++ b/python/analytics/portfolio.py @@ -166,10 +166,14 @@ class Portfolio: def theta(self): return sum(t.theta for t in self.trades) + @property + def hy_equiv(self): + return sum(t.hy_equiv for t in self.trades) + def _todf(self): headers = ["Product", "Index", "Notional", "Ref", "Strike", "Direction", "Type", "Expiry", "Vol", "PV", "Delta", "Gamma", "Theta", - "Vega", "attach", "detach", "Attach Rho", "Detach Rho"] + "Vega", "attach", "detach", "Attach Rho", "Detach Rho", "HY Equiv"] rec = [] for t in self.trades: if isinstance(t, CreditIndex): @@ -177,19 +181,19 @@ class Portfolio: r = ("Index", name, t.notional, t.ref, "N/A", t.direction, "N/A", "N/A", None, t.pv, 1., 0., t.theta, 0., - None, None, None, None) + None, None, None, None, t.hy_equiv) elif isinstance(t, BlackSwaption): name = f"{t.index.index_type}{t.index.series} {t.index.tenor}" r = ("Swaption", name, t.notional, t.ref, t.strike, t.direction, t.option_type, t.forward_date, t.sigma, t.pv, t.delta, t.gamma, t.theta, t.vega, - None, None, None, None) + None, None, None, None, t.hy_equiv) elif isinstance(t, DualCorrTranche): name = f"{t.index_type}{t.series} {t.tenor}" r = ("Tranche", name, t.notional, None, None, t.direction, None, None, None, t.upfront, t.delta, t.gamma, None, None, - t.attach, t.detach, t.rho[0], t.rho[1]) + t.attach, t.detach, t.rho[0], t.rho[1], t.hy_equiv) else: raise TypeError rec.append(r) |
