aboutsummaryrefslogtreecommitdiffstats
path: root/python/risk/bonds.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/risk/bonds.py')
-rw-r--r--python/risk/bonds.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/risk/bonds.py b/python/risk/bonds.py
index b0af1767..0f398bcf 100644
--- a/python/risk/bonds.py
+++ b/python/risk/bonds.py
@@ -5,6 +5,8 @@ import datetime
from enum import Enum, auto
from serenitas.analytics.yieldcurve import YC
+from serenitas.analytics.index import CreditIndex
+from serenitas.analytics import on_the_run
class AssetClass(Enum):
@@ -232,7 +234,7 @@ def get_portfolio(date, conn, asset_class: AssetClass, fund="SERCGMAST"):
def crt_risk(date, dawn_conn, crt_engine, fund="SERCGMAST"):
- analytics.init_ontr(date, ("HY", "IG"))
+ hy_ontr = CreditIndex("HY", on_the_run("HY", date), "5yr", date)
yc = YC(evaluation_date=date)
df = get_portfolio(date, dawn_conn, AssetClass.CRT, fund)
scen = {
@@ -274,7 +276,7 @@ def crt_risk(date, dawn_conn, crt_engine, fund="SERCGMAST"):
curr_ntl=df.notional * df.factor,
hy_equiv=(
df.modDur
- / analytics._ontr["HY"].risky_annuity
+ / hy_ontr.risky_annuity
* analytics._beta["CRT"]
* df.notional
* df.factor