Python for Finance: Analyze Big Financial Data

(Elle) #1

sanity checks implemented. For example, the following line of code is considered a


“success,” no matter if the content is indeed an instance of a discounting class or not.


Therefore, one has to be rather careful when compiling and passing market_environment


objects to any simulation class:


self.discount_curve =   mar_env.get_curve(‘discount_curve’)

Table 16-1 shows all components that a market_environment object must contain for the


generic and therefore for all other simulation classes.


Table 16-1. Elements of market environment for all simulation classes


Element Type Mandatory Description

initial_value

Constant

Yes

Initial value of process at pricing_date

volatility

Constant

Yes

Volatility coefficient of process

final_date

Constant

Yes

Simulation horizon

currency

Constant

Yes

Currency of the financial entity

frequency

Constant

Yes

Date frequency, as pandas freq parameter

paths

Constant

Yes

Number of paths to be simulated

discount_curve

Curve

Yes

Instance of constant_short_rate

time_grid

List

No

Time grid of relevant dates (in portfolio context)

random_numbers

List

No

Random number array (for correlated objects)

cholesky_matrix

List

No

Cholesky matrix (for correlated objects)

rn_set

List

No

dict object with pointer to relevant random number set

Everything that has to do with the correlation of model simulation objects is explained in


subsequent chapters. In this chapter, we focus on the simulation of single, uncorrelated


processes. Similarly, the option to pass a time_grid is only relevant in a portfolio context,


something also explained later.

Free download pdf