Skip to Content
Python for Finance
book

Python for Finance

by Yves Hilpisch
December 2014
Intermediate to advanced
606 pages
13h 46m
English
O'Reilly Media, Inc.
Content preview from Python for Finance

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Python for Finance

Hands-On Python for Finance

Matthew Macarty

Publisher Resources

ISBN: 9781491945360Errata