# Implementing Models of Financial Derivatives: Object Oriented Applications with VBA, with CD-ROM

# Implementing Models of Financial Derivatives: Object Oriented Applications with VBA, with CD-ROM

ISBN: 978-0-470-66184-0

Sep 2011

692 pages

$74.99

## Description

Implementing Models of Financial Derivatives is a comprehensive treatment of advanced implementation techniques in VBA for models of financial derivatives. Aimed at readers who are already familiar with the basics of VBA it emphasizes a fully object oriented approach to valuation applications, chiefly in the context of Monte Carlo simulation but also more broadly for lattice and PDE methods. Its unique approach to valuation, emphasizing effective implementation from both the numerical and the computational perspectives makes it an invaluable resource. The book comes with a library of almost a hundred Excel spreadsheets containing implementations of all the methods and models it investigates, including a large number of useful utility procedures. Exercises structured around four application streams supplement the exposition in each chapter, taking the reader from basic procedural level programming up to high level object oriented implementations. Written in eight parts, parts 1-4 emphasize application design in VBA, focused around the development of a plain Monte Carlo application. Part 5 assesses the performance of VBA for this application, and the final 3 emphasize the implementation of a fast and accurate Monte Carlo method for option valuation. Key topics include: ?Fully polymorphic factories in VBA; ?Polymorphic input and output using the TextStream and FileSystemObject objects; ?Valuing a book of options; ?Detailed assessment of the performance of VBA data structures; ?Theory, implementation, and comparison of the main Monte Carlo variance reduction methods; ?Assessment of discretization methods and their application to option valuation in models like CIR and Heston; ?Fast valuation of Bermudan options by Monte Carlo. Fundamental theory and implementations of lattice and PDE methods are presented in appendices and developed through the book in the exercise streams. Spanning the two worlds of academic theory and industrial practice, this book is not only suitable as a classroom text in VBA, in simulation methods, and as an introduction to object oriented design, it is also a reference for model implementers and quants working alongside derivatives groups. Its implementations are a valuable resource for students, teachers and developers alike. Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.**Preface.**

**PART I A PROCEDURAL MONTE CARLO METHOD IN VBA.**

**1 The Monte Carlo Method**.

1.1 The Monte Carlo valuation method.

1.2 Issues with Monte Carlo.

1.3 Computational issues.

1.4 Summary.

1.5 Exercises

**2 Levels of Programming Sophistication.**

2.1 What makes a good application?

2.2 A high-level design.

2.3 Progressing towards the ideal.

2.4 Summary.

2.5 Exercises

**3 Procedural Programming: Level 1**.

3.1 Designing a Monte Carlo valuation application.

3.2 Deficiencies of the level 1 code.

3.3 Summary.

3.4 Exercises

**4 Validation and Error Handling: Level 2**.

4.1 Validation and error handling.

4.2 Encapsulating functionality.

4.3 The level 2 main.

4.4 Summary.

4.5 Exercises.

**PART II OBJECTS AND POLYMORPHISM.**

**5 Introducing Objects: Level 3.**

5.1 Objects in VBA.

5.2 An example: The StopWatch object.

5.3 Further helpful VBA features.

5.4 Objects in the Monte Carlo application.

5.5 Summary.

5.6 Exercises.

**6 Polymorphism and Interfaces: Level 4**.

6.1 Polymorphism.

6.2 Interfaces in VBA.

6.3 Implementing a polymorphic stopwatch.

6.4 Polymorphism and the Monte Carlo application.

6.5 Assessment of the polymorphic design.

6.6 Summary.

6.7 Exercises

**7 A Slice-Based Monte Carlo.**

7.1 The revised Monte Carlo application object.

7.2 The option object.

7.3 The evolver object.

7.4 Summary.

7.5 Exercises

**8 An Embryonic Factory: Level 5.**

8.1 Events.

8.2 The Level 5 Monte Carlo application.

8.3 The Factory object.

8.4 Output.

8.5 Summary.

8.6 Exercises.

**PART III USING FILES WITH VBA.**

**9 Input and Output to File in VBA.**

9.1 File handling in VBA.

9.2 The TextStream and FileSystemObject objects.

9.3 Intrinsic VB language functions.

9.4 Example: Reading and writing to sequential and random files.

9.5 Summary.

9.6 Exercises

**10 Valuing a Book of Options.**

10.1 Outline of the application.

10.2 Timings.

10.3 Summary.

10.4 Exercises.

**PART IV POLYMORPHIC FACTORIES IN VBA.**

**11 The VBE Object Library and a Simple Polymorphic Factory.**

11.1 Using the VBE object library.

11.2 A simple factory illustration.

11.3 Summary.

11.4 Exercises.

**12 A Fully Polymorphic Factory: Level 6.**

12.1 Conceptual features.

12.2 The polymorphic factory.

12.3 Using the Factory object.

12.4 Summary.

12.5 Exercises

**13 A Semi-Polymorphic Factory: Meta-Classes.**

13.1 The structure of the application.

13.2 Meta-class objects.

13.3 The semi-polymorphic factory.

13.4 Summary.

13.5 Exercises.

**PART V PERFORMANCE ISSUES IN VBA.**

**14 Performance and Cost in VBA.**

14.1 Arithmetic operations.

14.2 Procedure calls.

14.3 Data typing issues.

14.4 Summary.

14.5 Exercises.

**15 Level and Performance**.

15.1 Variations of the level application.

15.2 Effect of level on times.

15.3 Summary.

15.4 Exercises.

**16 Evolution and Data Structures.**

16.1 Data structures in VBA.

16.2 Using VBA containers.

16.3 Numerical comparisons.

16.4 Summary.

16.5 Exercises.

**PART VI VARIANCE REDUCTION IN THE MONTE CARLO METHOD.**

**17 Wiener Sample Paths and Antithetic Variates**.

17.1 Generating Wiener sample paths.

17.2 Antithetic variates.

17.3 Numerical assessment.

17.4 Summary.

17.5 Exercises.

**18 The Wiener Process and Stratified Sampling**.

18.1 Stratified sampling.

18.2 Implementing stratified sampling.

18.3 Numerical assessment.

18.4 Summary.

18.5 Exercises.

**19 Low-Discrepancy Sampling.**

19.1 Low-discrepancy sampling.

19.2 Implementing LD sampling.

19.3 Numerical assessment.

19.4 Summary.

19.5 Exercises.

**20 Variance Reduction with Control Variates**.

20.1 Control variates.

20.2 Examples of control variates.

20.3 Auxiliary model control variates.

20.4 Summary.

20.5 Exercises.

**21 Implementing Control Variates**.

21.1 A control variate application.

21.2 Numerical assessment.

21.3 Summary.

21.4 Exercises.

**22 Extreme Options and Importance Sampling.**

22.1 Importance Sampling.

22.2 Valuing an OTM digital option.

22.3 Choices for the IS density.

22.4 Implementing importance sampling.

22.5 Numerical assessment.

22.6 Summary.

22.7 Exercises.

**23 Combining Variance Reduction Methods**.

23.1 Combining CV and IS.

23.2 Implementing variance reduction methods in combination.

23.3 Numerical assessment.

23.4 Summary.

23.5 Exercises.

**PART VII THE MONTE CARLO METHOD: CONVERGENCE AND BIAS.**

**24 The Monte Carlo Method: Convergence and Bias.**

24.1 Reducing bias.

24.2 Bias reduction methods.

24.3 Bias and barrier options.

24.4 Summary.

24.5 Exercises.

**25 Discretization Methods.**

25.1 Discretization and convergence.

25.2 Itō–Taylor discretization schemes.

25.3 Schemes in 1-dimension.

25.4 Predictor–corrector simulation.

25.5 Numerical assessment for benchmark processes.

25.6 Summary.

25.7 Exercises.

**26 Applications to Models.**

26.1 The CIR process.

26.2 Simulating discount factors.

26.3 Summary.

26.4 Exercises.

**27 Valuation in the Heston Model.**

27.1 Discretizing the Heston model.

27.2 Convergence in the Heston model.

27.3 Option valuation in the Heston model.

27.4 Summary.

27.5 Exercises.

**PART VIII VALUING AMERICAN OPTIONS BY SIMULATION.**

**28 Valuing American and Bermudan Options.**

28.1 American options.

28.2 Monte Carlo and American options.

28.3 Summary.

28.4 Exercises.

**29 Estimating the Early Exercise Boundary.**

29.1 Approximating the continuation value function.

29.2 Choices for basis functions.

29.3 The early exercise boundary.

29.4 Effect on valuation.

29.5 Summary.

29.6 Exercises.

**30 The Plain LSLS Method.**

30.1 Implementation in VBA.

30.2 Valuing the American put?

30.3 Summary.

30.4 Exercises.

**31 Control Variates and the LSLS Method.**

31.1 Control variates and the American put.

31.2 Control variates and the EEB.

31.3 A two-pass LSLS.

31.4 Summary.

31.5 Exercises.

**Afterword.**

**APPENDICES.**

**A VBA and Excel.**

A.1 Setting up Excel.

A.2 Compiler problems in VBA.

**B Some Option Formulae.**

B.1 Geometrically averaged average rate options.

B.2 A quadratic payoff option.

B.3 A Bermudan option.

**C The Utility Code Modules.**

C.1 The utility procedures.

C.2 The complex number object.

C.3 Quadrature.

**D Running DLLs from VBA.**

**E Object-Oriented Programming.**

E.1 Motivation for objects.

E.2 Properties of objects.

E.3 Implementing objects in VBA.

E.4 Patterns of object use.

E.5 Summary.

**F A Yukky Level 0 Monolithic Lattice Implementation.**

F.1 Lattice methods.

F.2 Implementing a level 0 lattice method.

F.3 Summary.

**G A Level 1 Crank–Nicolson PDE Implementation.**

G.1 PDE methods for derivative valuation.

G.2 The Crank–Nicolson finite difference method.

G.3 Implementing Crank–Nicolson.

G.4 Assessment of the design.

G.5 Successive over-relaxation (SOR).

G.6 Summary.

**H Root-Finding and Minimization Algorithms.**

H.1 Root finding algorithms.

H.2 Minimization algorithms.

H.3 Summary.

**VBA, Modelling, and Computing Glossary.**

**Abbreviations.**

**Coding, Notational, and Typographical Conventions.**

**Index to Code.**

**Index to Spreadsheets.**

**Index to Implementations.**

**Index to Library Functions.**

**Bibliography.**

**Index.**