Python for Finance: Analyze Big Financial Data

(Elle) #1

Conclusions


This chapter is about the numerical valuation of both European and American options


based on Monte Carlo simulation. The chapter introduces a generic valuation class, called


valuation_class. This class provides methods, for example, to estimate the most


important Greeks (Delta, Vega) for both types of options, independent of the simulation


object (risk factor/stochastic process) used for the valuation.


Based on the generic valuation class, the chapter presents two specialized classes,


valuation_mcs_european and valuation_mcs_american. The class for the valuation of


European options is mainly a straightforward implementation of the risk-neutral valuation


approach presented in Chapter 15 in combination with the numerical estimation of an


expectation term (i.e., an integral by Monte Carlo simulation, as discussed in Chapter 9).


The class for the valuation of American options needs a certain kind of regression-based


valuation algorithm. This is due to the fact that for American options an optimal exercise


policy has to be derived for a valuation. This is theoretically and numerically a bit more


involved. However, the respective present_value method of the class is still concise.


The approach taken with the DX derivatives analytics library proves to be beneficial.


Without too much effort we are able to value a pretty large class of options with the


following features:


Single risk factor options


European or American exercise


Arbitrary payoff


In addition, we can estimate the most important Greeks for this class of options. To


simplify future imports, we will again use a wrapper module, this time called


dx_valuation.py, as presented in Example 17-5.


Example 17-5. Wrapper module for all components of the library including valuation


classes



DX Library Valuation


dx_valuation.py



import numpy as np
import pandas as pd


from dx_simulation import *
from valuation_class import valuation_class
from valuation_mcs_european import valuation_mcs_european
from valuation_mcs_american import valuation_mcs_american


Again, let us enhance the init file in the dx directory (see Example 17-6) to stay


consistent here.


Example 17-6. Enhanced Python packaging file



DX Library


packaging file


init.py



import numpy as np

Free download pdf