diff options
Diffstat (limited to 'python/exploration/swaption_calendar_spread.py')
| -rw-r--r-- | python/exploration/swaption_calendar_spread.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/python/exploration/swaption_calendar_spread.py b/python/exploration/swaption_calendar_spread.py index 51a22d42..7d6083ce 100644 --- a/python/exploration/swaption_calendar_spread.py +++ b/python/exploration/swaption_calendar_spread.py @@ -143,7 +143,7 @@ def plot_time_color_map(df, spread_shock, attr="pnl", path=".", color_map=cm.RdY fig.colorbar(chart, shrink=.8) #fig.savefig(os.path.join(path, "spread_time_color_map_"+ attr+ "_{}.png".format(val_date))) -def plot_trade_scenarios(portf, shock_min=-.15, shock_max=.2): +def plot_trade_scenarios(portf, shock_min=-.15, shock_max=.2, period = -1, vol_time_roll=True): portf.reset_pv() earliest_date = min(portf.swaptions,key=attrgetter('exercise_date')).exercise_date @@ -158,18 +158,19 @@ def plot_trade_scenarios(portf, shock_min=-.15, shock_max=.2): vol_surface = vs[vol_select] df = run_portfolio_scenarios(portf, date_range, spread_shock, vol_shock, vol_surface, - params=["pnl","delta"], vol_time_roll=True) + params=["pnl","delta"]) hy_plot_range = 100 + (500 - portf.indices[0].spread * (1 + spread_shock)) * \ abs(portf.indices[0].DV01) / portf.indices[0].notional * 100 shock = hy_plot_range if index == 'HY' else portf.indices[0].spread * (1 + spread_shock) - period = -1 plot_time_color_map(df[round(df.vol_shock,2)==0], shock, 'pnl', index=index) - plot_time_color_map(df[round(df.vol_shock,2)==0], shock, 'delta', color_map = cm.coolwarm_r, index=index) + plot_time_color_map(df[round(df.vol_shock,2)==.2], shock, 'pnl', index=index) + #plot_time_color_map(df[round(df.vol_shock,2)==0], shock, 'delta', color_map = cm.coolwarm_r, index=index) plot_color_map(df.loc[date_range[period]], shock, vol_shock, 'pnl', index=index) #plot_df(df.loc[date_range[period]], shock, vol_shock) + return df def exercise_probability(): |
