Computational Finance Using C and C# Derivatives and Valuation SECOND EDITION George Levy ELSEVIER AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO Academic Press is an Imprint of Elsevier
Contents Preface 1 Overview of Financial Derivatives 2 Introduction to Stochastic Processes 2.1 Brownian Motion 5 2.2 A Brownian Model of Asset Price Movements 9 2.3 Ito's Formula (or Lemma) 10 2.4 Girsanov's Theorem 12 2.5 Ito's Lemma for Multi-Asset GBM 12 2.6 Ito Product and Quotient Rules in Two Dimensions 14 2.6.1 Ito Product Rule 15 2.6.2 Ito Quotient Rule 15 2.7 Ito Product in n Dimensions 1 7 2.8 The Brownian Bridge 1 8 2.9 Time Transformed Brownian Motion 20 2.9.1 Scaled Brownian Motion 21 2.9.2 Mean Reverting Process 21 2.10 Ornstein Uhlenbeck Process 22 2.11 The Ornstein Uhlenbeck Bridge 25 2.12 Other Useful Results 29 2.12.1 Fubini's Theorem 29 2.12.2 Ito's Isometry 29 2.12.3 Expectation of a Stochastic Integral 30 2.13 Selected Exercises 31 3 Generation of Random Variates 3.1 Introduction 35 3.2 Pseudo-Random and Quasi-Random Sequences 36 3.3 Generation of Multivariate Distributions: Independent Variates 40 3.3.1 Normal Distribution 40 3.3.2 Lognormal Distribution 43 3.3.3 Student's (-Distribution 44 3.4 Generation of Multivariate Distributions: Correlated Variates 44 3.4.1 Estimation of Correlation and Covariance 44 3.4.2 Repairing Correlation and Covariance Matrices 45 3.4.3 Normal Distribution 49 3.4.4 Lognormal Distribution 53 3.5 Selected Exercises 56 4 European Options 4.1 Introduction 57 4.2 Pricing Derivatives using A Martingale Measure 57 4.3 Put Call Parity 58 4.3.1 Discrete Dividends 58 xvii vii
viii Contents 4.3.2 Continuous Dividends 59 4.4 Vanilla Options and the Black-Scholes Model 60 4.4.1 The Option Pricing Partial Differential Equation 60 4.4.2 The Multi-asset Option Pricing Partial Differential Equation 63 4.4.3 The Black-Scholes Formula 65 4.4.4 Historical and Implied Volatility 73 4.4.5 Pricing Options with Microsoft Excel 78 4.5 Barrien Options 82 4.5.1 Introduction 82 4.5.2 Analytic Pricing of Down and Out Call Options 82 4.5.3 Analytic Pricing of Up and Out Call Options 85 4.5.4 Monte Carlo Pricing of Down and Out Options 87 4.6 Selected Exercises 90 5 Single Asset American Options 5.1 Introduction 93 5.2 Approximations for Vanilla American Options 93 5.2.1 American Call Options with Cash Dividends 93 5.2.2 The Macmillan, Barone-Adesi, and Whaley Method 99 5.3 Lattice Methods for Vanilla Options 1 08 5.3.1 Binomial Lattice 108 5.3.2 Constructing and using the Binomial Lattice 115 5.3.3 Binomial Lattice with a Control Variate 123 5.3.4 The Binomial Lattice with BBS and BBSR 125 5.4 Grid Methods for Vanilla Options 129 5.4.1 Introduction 129 5.4.2 Uniform Grids 131 5.4.3 Nonuniform Grids 144 5.4.4 The Log Transformation and Uniform Grids 152 5.4.5 The Log Transformation and Nonuniform Grids 1 56 5.4.6 The Double Knockout Call Option 1 58 5.5 Pricing American Options using a Stochastic Lattice 1 65 5.6 Selected Exercises 1 73 6 Multi-asset Options 6.1 Introduction 175 6.2 The Multi-asset Black-Scholes Equation 1 75 6.3 Multidimensional Monte Carlo Methods 1 76 6.4 Introduction to Multidimensional Lattice Methods 1 80 6.5 Two-asset Options 183 6.5.1 European Exchange Options 183 6.5.2 European Options on the Maximum or Minimum 185 6.5.3 American Options 189 6.6 Three-asset Options 193
Contents ix 6.7 Four-asset Optio ns 196 6.8 Selected Exercises 198 7 Other Financial Derivatives 7.1 Introduction 203 7.2 Interest Rate Derivatives 203 7.2.1 Forward Rate Agreement 204 7.2.2 Interest Rate Swap 205 7.2.3 Timing Adjustment 211 7.2.4 Interest Rate Quantos 216 7.3 Foreign Exchange Derivatives 221 7.3.1 FX Forward 222 7.3.2 European FX Option 223 7.4 Credit Derivatives 225 7.4.1 Defaultable Bond 228 7.4.2 Credit Default Swap 228 7.4.3 Total Return Swap 229 7.5 Equity Derivatives 230 7.5.1 TRS 230 7.5.2 Equity Quantos 233 7.6 Selected Exercises 236 8 C# Portfolio Pricing Application 8.1 Introduction 239 8.2 Storing and Retrieving the Market Data 247 8.3 Equity Deal Classes 253 8.3.1 Single Equity Option 254 8.3.2 Option on Two Equities 256 8.3.3 Generic Equity Basket Option 257 8.3.4 Equity Barrier Option 262 8.4 FX Deal Classes 266 8.4.1 FX Forward 266 8.4.2 Single FX Option 267 8.4.3 FX Barrier Option 269 8.5 Selected Exercises 273 9 A Brief History of Finance 9.1 Introduction 275 9.2 Early History 275 9.2.1 The Sumerians 275 9.2.2 Biblical Times 277 9.2.3 The Greeks 278 9.2.4 Medieval Europe 279 9.3 Early Stock Exchanges 280 9.3.1 The Anwterp Exchange 280
X A B C D E F Contents 9.3.2 Amsterdam Stock Exchange 281 9.3.3 Other Early Financial Centres 284 9.4 Tulip Mania 286 9.5 Early Use of Derivatives in the USA 289 9.6 Securitisation and Structured Products 290 9.7 Collateralised Debt Obligations 292 9.8 The 2008 Financial Crisis 296 9.8.1 The Collapse of AIC 297 The Greeks for Vanilla European Options A.1 Introduction 301 A.2 Gamma 302 A.3 Delta 303 A.4 Theta 303 A.5 Rho 304 A.6 Vega 305 Barrier Option Integrals B.1 The Down and Out Call 307 B.2 The Up and Out Call 310 Standard Statistical Results C.1 The Law of Large Numbers 315 C.2 The Central Limit Theorem 315 C.3 The Variance and Covariance of Random Variables 31 7 C.3.1 Variance 317 C.3.2 Covariance 319 C.3.3 Covariance Matrix 321 C.4 Conditional Mean and Covariance of Normal Distributions 321 C.5 Moment Generating Functions 323 Statistical Distribution Functions D.1 The Normal (Gaussian) Distribution 325 D.2 The Lognormal Distribution 327 D.3 The Student's t Distribution 328 D.4 The General Error Distribution 330 D.4.1 Value of A for Variance /z, 330 D.4.2 The Kurtosis 331 D.4.3 The Distribution for Shape Parameter, a 332 Mathematical Reference E.1 Standard Integrals 333 E.2 Gamma Function 333 E.3 The Cumulative Normal Distribution Function 334 E.4 Arithmetic and Geometrie Progressions 335 Black-Scholes Finite-Difference Schemes
Contents xi G H F.1 The General Case 337 F.2 The Log Transformation and a Uniform Grid 337 The Brownian Bridge: Alternative Derivation Brownian Motion: More Results H.1 Some Results Concerning Brownian Motion 345 H.2 Proof of Equation (H.1.2) 346 H.3 Proof of Equation (H.1.4) 347 H.4 Proof of Equation (H.1.5) 347 H.5 Proof of Equation (H.1.6) 347 H.6 Proof of Equation (H.1.7) 349 H.7 Proof of Equation (H.1.8) 349 H.8 Proof of Equation (H.1.9) 350 H.9 Proof of Equation (H.1.10) 350 I Feynman-Kac Formula I.1 Some Results 353 Glossary 355 Bibliography 357 Further Reading 359 Index 363