The following codes implement all the methods covered in the book, where possible.
In addition to the original R and MATLAB used in the book, Python and Julia implementations are also provided.
All code was verified in August 2019 to run on R 3.6, MATLAB 2018a, Python 3.6.5 and Julia 0.6.2.
The following utility functions and files can be useful:
If anybody suggests alternative implementations to what is here, we would be happy to include a link.
Any bug fixes are more than welcome.
The following code is presented pairwise (e.g. R and MATLAB, R and Python etc) for comparison.
Listing numbers correspond to the numbered R/MATLAB listing pairs in the book.
An additional Appendix section is provided as a short introduction, based on Appendix B/C in the book.
For more detailed documentation, please consult the book.
Each piece of code is labeled by the last date it got updated. If the date is 2011, 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 those implementing GARCH, reflects the state of the available libraries in 2011.
|1. Financial Markets, Prices and Risk||✔||✔||✔||✔||✔||✔|
|2. Univariate Volatility Modeling||✔||✔||✔||✔||✔||✔|
|3. Multivariate Volatility Models||✔||✔||✔||✔||✔||✔|
|4. Risk Measures||✔||✔||✔||✔||✔||✔|
|5. Implementing Risk Forecasts||✔||✔||✔||✔||✔||✔|
|6. Analytical Value–at–Risk for Options and Bonds||✔||✔||✔||✔||✔||✔|
|7. Simulation Methods for VaR for Options and Bonds||✔||✔||✔||✔||✔||✔|
|8. Backtesting and Stress Testing||✔||✔||✔||✔||✔||✔|
|9. Extreme Value Theory||✔||✔||✔||✔||✔||✔|
Below is an implementation of the code using Jupyter notebooks. The formatted output is also downloadable as a .html file, for reference.