Implementing Models of Financial Derivatives: Object Oriented Applications with VBA, with CD-ROM
DescriptionImplementing 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.
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.
2 Levels of Programming Sophistication.
2.1 What makes a good application?
2.2 A high-level design.
2.3 Progressing towards the ideal.
3 Procedural Programming: Level 1.
3.1 Designing a Monte Carlo valuation application.
3.2 Deficiencies of the level 1 code.
4 Validation and Error Handling: Level 2.
4.1 Validation and error handling.
4.2 Encapsulating functionality.
4.3 The level 2 main.
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.
6 Polymorphism and Interfaces: Level 4.
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.
7 A Slice-Based Monte Carlo.
7.1 The revised Monte Carlo application object.
7.2 The option object.
7.3 The evolver object.
8 An Embryonic Factory: Level 5.
8.2 The Level 5 Monte Carlo application.
8.3 The Factory object.
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.
10 Valuing a Book of Options.
10.1 Outline of the application.
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.
12 A Fully Polymorphic Factory: Level 6.
12.1 Conceptual features.
12.2 The polymorphic factory.
12.3 Using the Factory object.
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.
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.
15 Level and Performance.
15.1 Variations of the level application.
15.2 Effect of level on times.
16 Evolution and Data Structures.
16.1 Data structures in VBA.
16.2 Using VBA containers.
16.3 Numerical comparisons.
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.
18 The Wiener Process and Stratified Sampling.
18.1 Stratified sampling.
18.2 Implementing stratified sampling.
18.3 Numerical assessment.
19 Low-Discrepancy Sampling.
19.1 Low-discrepancy sampling.
19.2 Implementing LD sampling.
19.3 Numerical assessment.
20 Variance Reduction with Control Variates.
20.1 Control variates.
20.2 Examples of control variates.
20.3 Auxiliary model control variates.
21 Implementing Control Variates.
21.1 A control variate application.
21.2 Numerical assessment.
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.
23 Combining Variance Reduction Methods.
23.1 Combining CV and IS.
23.2 Implementing variance reduction methods in combination.
23.3 Numerical assessment.
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.
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.
26 Applications to Models.
26.1 The CIR process.
26.2 Simulating discount factors.
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.
PART VIII VALUING AMERICAN OPTIONS BY SIMULATION.
28 Valuing American and Bermudan Options.
28.1 American options.
28.2 Monte Carlo and American options.
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.
30 The Plain LSLS Method.
30.1 Implementation in VBA.
30.2 Valuing the American put?
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.
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.
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.
F A Yukky Level 0 Monolithic Lattice Implementation.
F.1 Lattice methods.
F.2 Implementing a level 0 lattice method.
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).
H Root-Finding and Minimization Algorithms.
H.1 Root finding algorithms.
H.2 Minimization algorithms.
VBA, Modelling, and Computing Glossary.
Coding, Notational, and Typographical Conventions.
Index to Code.
Index to Spreadsheets.
Index to Implementations.
Index to Library Functions.