-
Black-Scholes 2
-
Lecture1.1
-
Lecture1.2
-
-
Binomial Model 3
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
-
Monte Carlo 3
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
Monte Carlo Part 3
Solution
from ipywidgets import interact, fixed
#Make a dashboard function to both find the payoffs and also create the graphs
def call_dashboard(strike1, strike2, strike3, periods, rf):
payoffs = call_payoffs(strike1, strike2, strike3, periods, rf)
graph_call_options(payoffs, strike1, strike2, strike3)
strike1 = widgets.IntSlider(value=90,
min=1,
max=1000,
step = 10,
description='Strike 1:'
)
strike2 = widgets.IntSlider(value=95,
min=1,
max=1000,
step = 10,
description='Strike 2:'
)
strike3 = widgets.IntSlider(value=100,
min=1,
max=1000,
step = 10,
description='Strike 3:'
)
interact(call_dashboard, strike1=strike1,
strike2=strike2, strike3=strike3,
periods=fixed(periods.value), rf=fixed(rf.value));
Now everything is done! We can recreate the two dashboards in two separate cells to play with.
#For ease of use, pull grab the dashboard for simulating returns
interact_manual(simulate_returns, price0=price0, periods=periods, rf=rf, sigma=sigma, runs=runs,
time_step = widgets.fixed(1/252));
#And then down here put the call option dashboard
strike1 = widgets.IntSlider(value=90,
min=1,
max=1000,
step = 10,
description='Strike 1:'
)
strike2 = widgets.IntSlider(value=95,
min=1,
max=1000,
step = 10,
description='Strike 2:'
)
strike3 = widgets.IntSlider(value=100,
min=1,
max=1000,
step = 10,
description='Strike 3:'
)
interact(call_dashboard, strike1=strike1,
strike2=strike2, strike3=strike3,
periods=fixed(periods.value), rf=fixed(rf.value));
Prev
Monte Carlo Part 2