numerical-finance icon indicating copy to clipboard operation
numerical-finance copied to clipboard

Numerical Methods in Finance

Numerical Methods in Finance

This repository contains code examples from Numerical Methods in Finance and Advanced Methods in Derivatives Pricing, NMiF and AMiDP, as well as codes from MOOCs which contained an element of numerical methods or mathematical modelling:

Finance Related

  • Financial Markets
  • Pricing Options with Mathematical Models
  • Computational Finance
  • Mathematical Methods for Finance
  • Business Analytics

Non Finance Related

  • Statistical Mechanics
  • Ordinary Differential Equations
  • Calculus
  • Statistics
  • Complex Analysis
  • Linear Algebra
  • Scientific Computing
  • High Performance Scientific Computing
  • Practical Numerical Methods
  • Algorithms
  • Discrete Mathematical Modelling

Table of Contents

  1. Lattice (Tree) Methods
    • Discrete time metods for Option Pricing.
    • Includes CRR (Cox-Ross-Rubenstein) binomial options pricing model.
  2. Monte Carlo Methods
    • Random Paths Simulation of financial models using Monte Carlo techniques.
    • Includes simulation of CIR (Cox-Ingersoll- Ross) model for interest rates.
  3. Finite Difference Methods for PDEs
    • Discretisation schemes used to model the Black-Scholes (constant volatility) Heat (Diffusion) Equation.
    • Includes Explicit, Implicit, and Crank Nicolson schemes.
    • Includes Stability and Convergence analysis.
    • Includes numerical solutions of systems of linear equations (Gauss-Seidel, SOR, and Conjugate Gradient).
  4. Fourier Transform & Integration Methods
    • Stochastic Volatility with Complete Markets Example: CEV (Constant Elasticity of Variance) Model
    • Stochastic Volatility with Incomplete Markets Example: Heston Model and the Market Price of Risk.
    • Mathematical methods (Characteristic Function, Quadrature Methods, and Fast Fourier Transform) to derive and compute the Heston PDE.
    • Includes the Carr Madan formula, the analytical solution to the Heston PDE giving the European option price which is obtained once the explicit form of the characteristic function of log S, the price of the underlying asset, is available.
    • Includes (parallel) code for Quadrature Methods.
  5. Model Calibration
    • Root finding and optimisation techniques to compute implied volatility (Black-Scholes) and implied volatility surface (Heston) for model calibration.
  6. Linear Programming
    • Constrained Optimisation techniques to compute implied volatility and to maximise (optimise) expected portfolio returns.
    • Includes a R script computing Global Minimum Variance Portfolio, Global Maximum Return portfolio, and the Tangency portfolio.
  7. High Performance Computing
    • Estimate the integral of f(x) from a to b using the Trapezoid Rule with n points.
    • Estimate the Monte Carlo approximation to the integral of g(x) from a to b.
    • Random walk approximate solution to Laplace's equation uxx + uyy = 0.
    • Parallel version (MPI) of Random walk approximate solution to Laplace's equation uxx + uyy = 0.