All the code from the book can be downloaded here. There is one page per chapter. For documentation on each piece of code, please consult the book.

Each piece of code is labeled by the last date it got updated. If the date is 25/02/11 then it is identical to the book. If it is more recent, some bug fix or improvement has been implemented.

Some of the book code, especially that implementing GARCH reflects the state of the available libraries in 2011. All code was verified in August 2016 to run on Matlab 2016a and R 3.3.0. Some of the code was updated in August 2017.

There are 2 utility functions that can be useful.

- Black-Scholes routines that can be downloaded for R and Matlab
- To download data in Matlab from yahoo finance, hist_stock_data.m

If anybody suggests alternative implementations to what is here we would be happy to include a link.

Any bug fixes are more than welcome.

Chapter 1. Financial Markets, Prices and Risk

Chapter 2. Univariate Volatility Modeling

Chapter 3. Multivariate Volatility Models

Chapter 4. Risk Measures

Chapter 5. Implementing Risk Forecasts

Chapter 6. Analytical Value–at–Risk for Options and Bonds

Chapter 7. Simulation Methods for VaR for Options and Bonds

Chapter 8. Backtesting and Stress Testing

Chapter 9. Extreme Value Theory

Chapter B. An Introduction to R

Chapter C. An Introduction to Matlab

Financial Risk Forecasting

Copyright (C) 2011, 2016 Jon Danielsson. All Rights Reserved.