Python for Finance: Analyze Big Financial Data

(Elle) #1
Figure 17-1. Present value, Delta, and Vega estimates for European call option

This illustrates that working with the DX library — although heavy numerics are involved


— boils down to an approach that is comparable to having a closed-form option pricing


formula available. However, this approach does not only apply to such simple payoffs as


the one considered so far. With exactly the same approach, we can handle much more


complex payoffs. To this end, consider the following payoff, a mixture of a regular and an


Asian payoff:


In  [ 18 ]: payoff_func =   ‘np.maximum(0.33    *   (maturity_value +   max_value)  -   40, 0)’
# payoff dependent on both the simulated maturity value
# and the maximum value

Everything else shall remain the same:


In  [ 19 ]: eur_as_call =   valuation_mcs_european(‘eur_as_call’,   underlying=gbm,
mar_env=me_call, payoff_func=payoff_func)

All statistics, of course, change in this case:


In  [ 20 ]: %%time
s_list = np.arange(34., 46.1, 2.)
p_list = []; d_list = []; v_list = []
for s in s_list:
eur_as_call.update(s)
p_list.append(eur_as_call.present_value(fixed_seed=True))
d_list.append(eur_as_call.delta())
v_list.append(eur_as_call.vega())
Out[20]: CPU times: user 286 ms, sys: 14.5 ms, total: 300 ms
Wall time: 303 ms

Figure 17-2 shows that Delta becomes 1 when the initial value of the underlying reaches


the strike price of 40 in this case. Every (marginal) increase of the initial value of the


underlying leads to the same (marginal) increase in the option’s value from this particular


point on:


In  [ 21 ]: plot_option_stats(s_list,   p_list, d_list, v_list)
Free download pdf