diff options
Diffstat (limited to 'python/analytics/scenarios.py')
| -rw-r--r-- | python/analytics/scenarios.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/python/analytics/scenarios.py b/python/analytics/scenarios.py index def1668b..1fc554fb 100644 --- a/python/analytics/scenarios.py +++ b/python/analytics/scenarios.py @@ -79,11 +79,8 @@ def run_portfolio_scenarios(portf, date_range, spread_shock, vol_shock, if nproc > 0 run with nproc processes. """ portf = deepcopy(portf) - for index in portf.indices: - if 'IG' in index.name: - spreads = np.hstack([index.spread * (1 + spread_shock)]) - else: - spreads = np.hstack([100 + (500- index.spread * (1 + spread_shock))*index.DV01/index.notional*100]) + spreads = np.hstack([index.spread * (1 + spread_shock) for index in portf.indices]) + t = [swaption.T for swaption in portf.swaptions] r = [] with MaybePool(nproc) as pool: @@ -93,7 +90,7 @@ def run_portfolio_scenarios(portf, date_range, spread_shock, vol_shock, if vol_time_roll: t = [swaption.T for swaption in portf.swaptions] for s in spreads: - portf.ref = s + portf.spread = s mon = [swaption.moneyness for swaption in portf.swaptions] curr_vols = np.maximum(vol_surface.ev(t, mon), 0) temp = pmap(partial(_aux, portf, curr_vols, params), vol_shock) |
