O'Reilly logo

Python for Finance by Yves Hilpisch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Portfolio Valuation

Price is what you pay. Value is what you get.

Warren Buffet

By now, the whole approach for building the DX derivatives analytics library—and its associated benefits—should be rather clear. By strictly relying on Monte Carlo simulation as the only numerical method, we accomplish an almost complete modularization of the analytics library:

Discounting
The relevant risk-neutral discounting is taken care of by an instance of the constant_short_rate class.
Relevant data
Relevant data, parameters, and other input are stored in (several) instances of the market_environment class.
Simulation objects

Relevant risk factors (underlyings) are modeled as instances of one of three simulation classes:

  • geometric_brownian_motion
  • jump_diffusion
  • square_root_diffusion
Valuation objects

Options and derivatives to be valued are modeled as instances of one of two valuation classes:

  • valuation_mcs_european
  • valuation_mcs_american

One last step is missing: the valuation of possibly complex portfolios of options and derivatives. To this end, we require the following:

Nonredundancy
Every risk factor (underlying) is modeled only once and potentially used by multiple valuation objects.
Correlations
Correlations between risk factors have to be accounted for.
Positions
An options position, for example, can consist of certain multiples of an options contract.

However, although we have in principle allowed (and even required) providing a currency for both simulation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required