Numerical Methods and Optimization in Finance

by Manfred Gilli, Dietmar Maringer and Enrico Schumann; 2019 (2nd edition)

NMOF2 cover The book explains and provides tools for computational finance. It covers fundamental numerical analysis and computational techniques; but two topics receive most attention: simulation and optimization. Several chapters provide case studies for problems such as portfolio insurance or risk estimation; in particular, several chapters explain optimization heuristics and how to use them for portfolio selection or for the calibration of option-pricing models. Such practical examples allow readers to learn the required steps for solving specific problems, and to apply these steps to other problems, too. At the same time, the chosen applications are relevant enough to make the book a reference for how to handle given problems.

The second edition is available directly from the publisher or from book sellers such as Amazon. The first edition is still available too.

Some highlights:

How to create random variates with specific marginal distributions, and how to induce cross-sectional (beyond Cholesky for Gaussian variates) and serial dependencies; examples for copulae; resampling: bootstrapping data sets.
Optimization [sample chapter]
Focus on evolutionary algorithms/heuristics, such as Genetic Algorithms and Differential Evolution.
Option pricing
Trees, finite differences and Monte-Carlo techniques; also integration methods for pricing with the characteristic function (e.g. Heston, Bates, Variance-Gamma). Calibration of surfaces under such models.
Yield-curve calibration
Various strategies for calibrating yield-curve models: through fitting to bootstrapped yields, to bond prices or to yields-to-maturity.
Portfolio optimization
Methods for optimizing portfolio under any essentially any objective function, such as drawdown or partial moments, and constraints, such as cardinality restrictions. Sample programs for classical mean-variance analysis are provided too.
Backtesting [sample chapter]
Testing trading and investment strategies: overfitting, data preparation, and the effects of randomness. Software for backtesting; running backtests in parallel; sensitivity and robustness checks.

Additional materials

MATLAB and R sample code is provided in the text and can be downloaded from the GitLab repository. An R-package – named NMOF – is also available (some Notes; see also below for further documentation and examples for the package).

The NMOF-news mailing list announces new versions of the package and other news regarding the book. To browse the archives or to subscribe, visit 'About NMOF-news'.

NMOF manual

The NMOF manual describes how to use the NMOF package, which accompanies the book 'Numerical Methods and Optimization in Finance' by Manfred Gilli, Dietmar Maringer and Enrico Schumann. It is still a draft, and comments are very welcome.

version 2020-05-09    cropped   R code

Examples and Extensions for the NMOF package

The report gives a number of examples (portfolio optimization, selecting variables for a regression model) for the R-package NMOF that accompanies the book 'Numerical Methods and Optimization in Finance' by Manfred Gilli, Dietmar Maringer and Enrico Schumann.

Keywords: Heuristics, Portfolio optimization, Asset selection, Model selection, Threshold Accepting, Differential Evolution, Genetic Algorithms, Particle Swarm, R, Distributed computing

version 2012-02-10    R code   (This report is now superseded by the NMOF manual.)

Distributed computations with the NMOF package

The report showcases functions in the R-package NMOF that allow the use of distributed computing; examples are the distribution of restarts of an optimisation algorithm, or the distributed evaluation of the objective function in a Genetic Algorithm.

Keywords: Heuristics, Threshold Accepting, Genetic Algorithms, R, Distributed computing

version 2014-10-23     R code

Slides/R Code for the tutorial at R/Rmetrics Meielisalp Workshop

We give a brief introduction to optimisation models in finance, and to how such models can be handled with heuristics. Through the example of a simple combinatorial problem, we demonstrate how different optimisation strategies can be implemented in R (making use of the NMOF package). The emphasis will be on principles, both for how heuristics work and how they should be applied (in particular, we stress that these methods are stochastic). As a concrete financial example, we show how we can solve a portfolio-optimisation model with Threshold Accepting.

handout (pdf)     R code

Notes and examples

First edition, 2011

NMOF1 cover The publisher's website of the first edition. It is still available, also from booksellers such as Amazon.

MATLAB and R sample code is provided in the text and can be downloaded from the GitLab repository. An R-package (named NMOF) is also available. All code examples of the first edition still work with the current version of the NMOF package.

A list of errors in the first printing of the first edition.