Skip to main content

How to Implement Market Models Using VBA

How to Implement Market Models Using VBA

Francois Goossens

ISBN: 978-1-118-96199-5

Jan 2015

312 pages

$65.99

Description

Accessible VBA coding for complex financial modelling

How to Implement Market Models Using VBA makes solving complex valuation issues accessible to any financial professional with a taste for mathematics. With a focus on the clarity of code, this practical introductory guide includes chapters on VBA fundamentals and essential mathematical techniques, helping readers master the numerical methods to build an algorithm that can be used in a wide range of pricing problems. Coverage includes general algorithms, vanilla instruments, multi-asset instruments, yield curve models, interest rate exotics, and more, guiding readers thoroughly through pricing in the capital markets area. The companion website (http://implementmodinvba.com/) features additional VBA code and algorithmic techniques, and the interactive blog provides a forum for discussion of code with programmers and financial engineers, giving readers insight into the different applications and customisations possible for even more advanced problem solving..

Financial engineers implement models from a mathematical representation of an asset's performance by building a program that performs a valuation of securities based on this asset. How to Implement Market Models Using VBA makes this technical process understandable, with well-explained algorithms, VBA code, and accessible theoretical explanations.

  • Decide which numerical method to use in which scenario
  • Identify the necessary building blocks of an algorithm
  • Write clear, functional VBA code for a variety of problems
  • Apply algorithms to different instruments and models

Designed for finance professionals, this book brings more accurate modelling within reach for anyone with interest in the market. For clearer code, patient explanation, and practical instruction, How to Implement Market Models Using VBA is an essential introductory guide.

Related Resources

Instructor

Request an Evaluation Copy for this title

Preface ix

Acknowledgements xi

Abbreviations xiii

About the Author xv

CHAPTER 1 The Basics of VBA Programming 1

1.1 Getting started 1

1.2 VBA objects and syntax 2

1.2.1 The object-oriented basic syntax 3

1.2.2 Using objects 3

1.3 Variables 5

1.3.1 Variable declaration 5

1.3.2 Some usual objects 7

1.3.3 Arrays 9

1.4 Arithmetic 10

1.5 Subroutines and functions 13

1.5.1 Subroutines 14

1.5.2 Functions 15

1.5.3 Operations on one-dimensional arrays 16

1.5.4 Operations on two-dimensional arrays (matrices) 16

1.5.5 Operations with dates 19

1.6 Custom objects 21

1.6.1 Types 21

1.6.2 Classes 22

1.7 Debugging 24

1.7.1 Error handling 24

1.7.2 Tracking the code execution 25

CHAPTER 2 Mathematical Algorithms 29

2.1 Introduction 29

2.2 Sorting lists 29

2.2.1 Shell sort 29

2.2.2 Quick sort 32

2.3 Implicit equations 34

2.4 Search for extrema 36

2.4.1 The Nelder-Mead algorithm 36

2.4.2 The simulated annealing 40

2.5 Linear algebra 43

2.5.1 Matrix inversion 44

2.5.2 Cholesky decomposition 46

2.5.3 Interpolation 48

2.5.4 Integration 57

2.5.5 Principal Component Analysis 60

CHAPTER 3 Vanilla Instruments 67

3.1 Definitions 67

3.2 Fixed income 67

3.2.1 Bond market 68

3.2.2 Interbank market 72

3.3 Vanilla derivatives 75

3.3.1 Forward contracts 75

3.3.2 Swaps 77

3.3.3 Bond futures 81

3.4 Options basics 84

3.4.1 Brownian motion 84

3.4.2 Ito integral 85

3.4.3 Ito formula 86

3.4.4 Black–Scholes basic model 89

3.4.5 Risk-neutral probability 90

3.4.6 Change of probability 90

3.4.7 Martingale and numeraires 92

3.4.8 European-style options pricing 94

3.5 First generation exotic options 95

3.5.1 Barrier options 95

3.5.2 Quanto options 102

CHAPTER 4 Numerical Solutions 105

4.1 Finite differences 105

4.1.1 Generic equation 105

4.1.2 Implementation 106

4.2 Trees 112

4.2.1 Binomial trees 112

4.2.2 Trinomial trees 116

4.3 Monte-Carlo scenarios 116

4.3.1 Uniform number generator 117

4.3.2 From uniform to Gaussian numbers 127

4.4 Simulation and regression 129

4.5 Double-barrier analytical approximation 134

CHAPTER 5 Monte-Carlo Pricing Issues 139

5.1 Multi-asset simulation 139

5.1.1 The correlations issue 139

5.1.2 The Gaussian case 139

5.1.3 Exotics 143

5.2 Discretization schemes 146

5.3 Variance reduction techniques 147

5.3.1 Antithetic variates 147

5.3.2 Importance sampling 148

5.3.3 Control variates 153

CHAPTER 6 Yield Curve Models 163

6.1 Short rate models 163

6.1.1 Introduction 163

6.1.2 Hull and White one-factor model 164

6.1.3 Gaussian two-factor model 180

6.1.4 Hull and White two-factor model 203

6.2 Forward rate models 204

6.2.1 Generic Heath-Jarrow-Morton 205

6.2.2 LMM (LIBOR market model) 216

CHAPTER 7 Stochastic Volatilities 233

7.1 The Heston model 234

7.1.1 Code 234

7.1.2 A faster algorithm 239

7.1.3 Calibration 248

7.2 Barrier options 254

7.2.1 Numerical results 257

7.2.2 Code 257

7.3 Asian-style options 260

7.4 SABR model 264

7.4.1 Caplets 264

7.4.2 Code 265

CHAPTER 8 Interest Rate Exotics 267

8.1 CMS swaps 267

8.1.1 Code 269

8.2 Cancelable swaps 272

8.2.1 Code 272

8.2.2 Tree approximation 276

8.3 Target redemption note 281

8.3.1 Code 282

Bibliography 287

Index 289