diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/exploration/swaption_calendar_spread.py | 4 | ||||
| -rw-r--r-- | python/notebooks/Option Trades.ipynb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/python/exploration/swaption_calendar_spread.py b/python/exploration/swaption_calendar_spread.py index a1a244d6..f3c1aaf0 100644 --- a/python/exploration/swaption_calendar_spread.py +++ b/python/exploration/swaption_calendar_spread.py @@ -143,13 +143,13 @@ def plot_time_color_map(df, spread_shock, attr="pnl", path=".", color_map = cm.R 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): +def plot_trade_scenarios(portf, shock_min = -.15, shock_max = .2): portf.reset_pv() earliest_date = min(portf.swaptions,key=attrgetter('exercise_date')).exercise_date date_range = pd.bdate_range(portf.indices[0].trade_date, earliest_date - BDay(), freq = '5B') vol_shock = np.arange(-0.15, 0.3, 0.01) - spread_shock = np.arange(-0.15, 0.2, 0.01) + spread_shock = np.arange(shock_min, shock_max, 0.01) index = portf.indices[0].name.split()[1] series = portf.indices[0].name.split()[3][1:] vs = VolatilitySurface(index, series, trade_date=portf.indices[0].trade_date) diff --git a/python/notebooks/Option Trades.ipynb b/python/notebooks/Option Trades.ipynb index 2e45602c..939d4cce 100644 --- a/python/notebooks/Option Trades.ipynb +++ b/python/notebooks/Option Trades.ipynb @@ -45,7 +45,7 @@ "option_delta.direction = 'Seller' if option_delta.notional > 0 else 'Buyer'\n", "option_delta.notional = abs(option_delta.notional)\n", "portf = Portfolio([option1, option2, option_delta])\n", - "spread.plot_trade_scenarios(portf)" + "spread.plot_trade_scenarios(portf, -.15, .8)" ] }, { |
