aboutsummaryrefslogtreecommitdiffstats
path: root/python/reto.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/reto.py')
-rw-r--r--python/reto.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/python/reto.py b/python/reto.py
index 6bc16940..082d1f13 100644
--- a/python/reto.py
+++ b/python/reto.py
@@ -39,8 +39,17 @@ def vol_surface(portf, try_days_back):
def gen_spreads(shock_date, fund):
Trade.init_ontr(shock_date)
ana._local = False
- spread_shock = np.array([-100.0, -25.0, 1.0, +25.0, 100.0, 200.0, 500, 1000])
+ spread_shock = np.array([-25.0, 1.0, +25.0, 100.0, 200.0, 500, 1000])
spread_shock /= Trade._ontr["HY"].spread
+ # Add in 2020 HY Wides, 2021 HY Tights, 2022 HY Wides scenarios
+ spread_shock = np.append(
+ spread_shock,
+ [
+ (872 / Trade._ontr["HY"].spread - 1),
+ (269 / Trade._ontr["HY"].spread - 1),
+ (626 / Trade._ontr["HY"].spread - 1),
+ ],
+ )
portf, _ = build_portfolio(shock_date, shock_date, fund)
vol_surface = generate_vol_surface(portf, 10)
portf.reset_pv()
@@ -99,6 +108,12 @@ def gen_spreads(shock_date, fund):
temp["total"] = temp.sum(axis=1)
results[i] = temp
results = pd.concat(results)
+ results.index.set_levels(
+ results.index.levels[results.index.names.index("spread_shock")]
+ * Trade._ontr["HY"].spread,
+ level="spread_shock",
+ inplace=True,
+ )
return results