# Manchester Finance Day 6th February 2009

**Note**: This page demonstrates a specific event that we participated in, since then the products mentioned have been updated hence the removal of their download links.

This page supports the NAG Financial Mathematics Day hosted by Manchester Business School on the 6th February 2009

## Copy of the lectures given

- NAG Financial Maths Student Prize - John Holden
- NAG Toolbox for MATLAB - Craig Lucas
- Using Excel, Visual Basic and NAG's Numerical Libraries - David Sayers, Mike Croucher
- Correlation in practice: products, estimation and importance of being positive semi-definite - Simon Acomb
- Structured Nearest Correlation Matrix Problems - Nicholas Higham
- NAG's Option Pricing Routines - Robert Tong
- Optimisation and Finance - David Sayers

## Software used during the day including the "hands on" session

NAG C Library and NAG Fortran Library were used with Excel

NAG C Library - CLDLL084ZL

NAG Fortran Library - FLDLL214ML

A pre-release version of NAG's option pricing functions were made available for use with the NAG Fortran Library (FLDLL214ML) - you can download from S30betaFL_LM.zip (these routines are now a standard part of current NAG Fortran Libraries)

The DLL should be placed in the following directory C:\Program Files\NAG\FL21\fldll214ml\bin (after the main Library has been installed).

## Visual Basic Headers for NAG Option Pricing DLL “S30betaFL_LM”

## S30 - Option Pricing functions Fortran Library documentation

- S30AAF Black-Scholes-Merton option pricing formula
- S30ABF Black-Scholes-Merton option pricing formula with Greeks
- S30BAF Floating-strike lookback option pricing formula
- S30BBF Floating-strike lookback option pricing formula with Greeks
- S30CAF Binary option: cash-or-nothing pricing formula
- S30CBF Binary option: cash-or-nothing pricing formula with Greeks
- S30CCF Binary option: asset-or-nothing pricing formula
- S30CDF Binary option: asset-or-nothing pricing formula with Greeks
- S30FAF Standard barrier option pricing formula
- S30JAF Jump-diffusion, Merton's model, option pricing formula
- S30JBF Jump-diffusion, Merton's model, option pricing formula with Greeks
- S30NAF Heston's model option pricing formula
- S30QCF American option: Bjerksund and Stensland pricing formula
- S30SAF Asian option: geometric continuous average rate pricing formula

## NAG Toolbox for MATLAB

Please note you will need to have valid licences for the NAG C Library, NAG Fortran Library and/or the NAG Toolbox for MATLAB. Please contact support@nag.co.uk to request a licence key.

- NAG Toolbox for MATLAB, MBW3221DCL
- A pre-release version of NAG's option pricing functions (S30) were made available for use with the NAG Toolbox for MATLAB (MBW3221DCL) - you can download from here
- Option Pricing (S30) Mex files for the NAG Toolbox for MATLAB
- The S30betaFL_DLL and Mex files should be saved to the appropriate directory e.g. C:\Program Files\MATLAB\R2008a\toolbox\NAG\mex.w32
**(after the NAG Toolbox has been installed)** - Option Pricing (S30) help files. These should be saved to the appropriate directory e.g. C:\Program Files\MATLAB\R2008a\help\toolbox\NAG(after the NAG Toolbox has been installed)
- When these files have been unzipped this will result in C:\Program Files\MATLAB\R2008a\help\toolbox\NAG\NAGS30 So that you can use the new files you will need to add a new path in MATLAB... File, Set Path, Add Folder and then browse to "C:\Program Files\MATLAB\R2008a\help\toolbox\NAG\NAGS30"

**The user may need to "rehash" and "rehash toolbox"**- S30 example files

## Exercises and Solutions

## Excel Exercises

- Listing 1 Spreadsheet
- Listing 2 Spreadsheet
- Listing 3 Spreadsheet
- Listing 4 Spreadsheet
- Listing 5 Spreadsheet
- Listing 6 Spreadsheet

These files are taken from the technical paper “Using the NAG Fortran Library with Microsoft Excel 2003” - A step by step guide.

## NAG Toolbox for MATLAB® Exercises

- NAG Toolbox for MATLAB Optimisation Question
- NAG Toolbox for MATLAB Curve Fitting Question
- NAG Toolbox for MATLAB Option Pricing Question
- NAG Toolbox for MATLAB Short Questions

## Excel Solutions

- Excel Miscellaneous Solutions
- Solution for Excel Option Pricing

## NAG Toolbox for MATLAB® Solutions

- Solution for NAG Toolbox for MATLAB Optimisation Question
- Solution for NAG Toolbox for MATLAB Curve Fitting Question
- Solution for NAG Toolbox for MATLAB Option Pricing Question
- Solution for NAG Toolbox for MATLAB Short Questions

## Additional example files

In response to various exchanges of information post event we are delighted to share additional example files that have been volunteered by attendees and contributors.

**1) Implied Volatility Examples**

1a) Black Scholes Implied using (i) Newton Raphson and (ii) Li Method

1b) Heston Implied.

**2) Option Pricing “workbook”**

NAG's option pricing functions can be called using a menu wizard of the function wizard. Please download the workbook here.

**3) Nearest Correlation Matrix**

A pre-release version of NAG's Nearest Correlation Matrix function is available for use with the NAG Fortran Library (FLDLL214ML) - you can download from here. The DLL should be placed in the following directory C:\Program Files\NAG\FL21\fldll214ml\bin (after the main Library has been installed). An Excel workbook illustrating use of this DLL may be downloaded from here.

*Note all the above examples required the Fortran DLL* - FLDLL214ML to be installed.

Examples in (1) & (2) also requires S30betaFL_LM.DLL to be installed. Nearest Correlation Matrix also requires NCM.DLL to be installed.

If you have any comments or questions or would like to contribute relevant example files please contact nagmarketing@nag.co.uk.