Computation and Simulation for Finance An Introduction with Python.pdf
(13 MB, 需要: RMB 17 元)
内容新2025最新出品;内容丰富335页的大型资料包;全部矢量文字,方便阅读
资料全名 Computation and Simulation for Finance An Introduction with Python
The increase in available computational power in the past three decades has led to the widespread adoption of sophisticated computational methods by the financial industry. These methods are rooted in the mathematics of finance, and their responsible application requires a decent understanding of the underlying mathematical framework, the principles of numerical analysis, and the kinds of issues that can crop up when implementing an algorithm. This textresource offers an up-to-date introductory treatment of numerical techniques applied to problems in computational finance, placing particular emphasis on issues such as numerical stability, convergence, and error analysis in both deterministic and stochastic settings. It is aimed at advanced undergraduate or postgraduate students pursuing studies in mathematical finance with an emphasis on simulation and computational techniques. We assume some exposure to core mathematical topics such as linear algebra, ordinary differential equations, multivariate calculus, probability, and statistics at the undergraduate level. We choose Python as our language of instruction, reflecting its growing usage among quantitative analysts. Experience with Python is not assumed, though readers should be familiar with basic programming constructs such as variables, loops, and conditional statements. Nonetheless, this is not a Python reference: after a tutorial in Chap. 1 we will introduce functionality as we go. Where possible we make use only of core Python libraries, and we avoid black-box approaches where it is sensible to do so. The result is intended to be an accessible introduction to computational techniques with enough guidance on the programming side to ensure that readers can easily get practical experience. The resource is divided into three parts. Part I (Modelling Assets and Markets) is an introduction to the mathematics of finance and the pricing and hedging of derivative securities in the Black-Scholes framework, as well as a tutorial introducing the reader to Python as a programming language. Part II (Computational Pricing Methods in the Black-Scholes Framework) covers the three main computational methods for pricing options and their associated hedge parameters: binomial trees, Monte Carlo methods, and finite difference methods, and demonstrates their application to the valuation of European, American, and exotic options written on a single underlying asset. Part III (Simulation Methods Beyond the Black-Scholes Framework) treats a set of more advanced topics and techniques, introducing Python methods for data analysis (providing a point of entry for students interested in machine learning), and modelling with stochastic differential equations. The financial context includes the modelling of several correlated assets, stochastic models of interest rates, and asset models with local or stochastic volatility. Throughout Parts I and II, the reader is encouraged to build up a library of functions for reuse. At the beginning of each chapter is a table showing which of these functions from earlier in the resource are used there. Part III relies less on the user-defined functions specified in Parts I and II, since readers will by this stage have developed some familiarity with Python, and this should give instructors flexibility in how they present the material. For students encountering the mathematical theory of derivatives and option pricing for the first time, a one-semester introductory course with a computational flavour can be constructed by covering all of Part I and a selection of topics from Part II. For students who have already studied this theory, the resource can be covered in a two-semester sequence, with Parts II and III each corresponding to a single-semester course, and Part I providing a background reference. A solutions manual is available for instructors, containing worked solutions for theoretical exercises and guidance on coding exercises.
Part I Modelling Assets and Markets
1 Introduction .................................................................. 3
1.1 Getting Started with Python and NumPy .............................. 3
1.1.1 Jupyter Noteresources .............................................. 4
1.1.2 Variables and Arithmetic ....................................... 5
1.1.3 Numerical Arrays ............................................... 7
1.2 Financial Assets as Stochastic Processes .............................. 10
1.2.1 Two Examples of Derivatives Written on a Single
Underlying Asset ............................................... 11
1.2.2 The Stochastic Framework for an Asset Price Model......... 12
1.2.3 The Time Value of Money...................................... 14
1.2.4 Python: User-Defined Functions ............................... 16
1.2.5 Incorporating Asset Price Risk ................................. 17
1.2.6 The Itô Calculus ................................................ 18
1.2.7 Solving the Black-Scholes Asset Model SDE................. 21
1.3 Sampling and Simulation of the Black-Scholes Asset Model ........ 22
1.3.1 Pseudo-Random Number Generation .......................... 23
1.3.2 Properties of the Distribution of the Asset Model............. 30
1.3.3 Simulating an Ensemble of Trajectories ....................... 33
1.4 Further Reading ......................................................... 35
1.4.1 Exercises ........................................................ 35
2 The Pricing of Financial Derivatives....................................... 39
2.1 Risk-Neutral Pricing of Financial Derivatives ......................... 41
2.1.1 A Simple Market Model Without Arbitrage ................... 41
2.1.2 Replicating Strategies for Derivatives ......................... 41
2.1.3 The Fundamental Theorems of Asset Pricing ................. 42
2.1.4 The Risk-Neutral Measure for Our Simple Market Model ... 43
2.1.5 Change-of-Measure and Girsanov’s Theorem................. 46
2.1.6 Market Completeness and the Risk-Neutral Pricing
Formula ......................................................... 50
2.2 The Black-Scholes-Merton PDE ....................................... 52
2.2.1 The Theorem of Feynman-Kac ................
2.2.2 Application to Our Simple Market Model ..................... 54
xi
xii Contents
2.2.3 The Black-Scholes Pricing Formulae for European
Options .......................................................... 54
2.2.4 Option Price Sensitivities: The Greeks ........................ 56
2.3 Estimation of the Black-Scholes Implied Volatility ................... 66
2.3.1 Characterising σ as the Solution of a Nonlinear Equation.... 66
2.3.2 Root-Finding with a Built-in Solver ........................... 67
2.4 Further Reading ......................................................... 69
2.4.1 Exercises ........................................................ 69
Part II Computational Pricing Methods in the Black-Scholes
Framework
3 Binomial Tree Methods...................................................... 75
3.1 An Asset Model Evolving in Discrete-Time ........................... 76
3.1.1 The Recombining Random Walk .............................. 76
3.1.2 Calibrating the Model Parameters ............................. 77
3.1.3 Deviation from the Risk-Neutral Choice of p ................. 81
3.1.4 Dynamical Consistency Between Discrete- and
Continuous-Time Models ...................................... 82
3.2 The Binomial Algorithm................................................ 84
3.2.1 Mathematical Characterisation ................................. 84
3.2.2 Python Implementation for a European Option ............... 85
3.3 Modifications for Options Written on Dividend-Paying Assets ...... 88
3.3.1 Assets Paying a Continuous Dividend Yield .................. 88
3.3.2 Assets Paying a Discrete Dividend ............................ 89
3.4 Error Analysis ........................................................... 90
3.4.1 Defining the Error for European Options...................... 91
3.4.2 Convergence Plots .............................................. 91
3.5 The Binomial Algorithm for Options with an Early Exercise
Facility ................................................................... 93
3.5.1 American and Bermudan Options.............................. 93
3.5.2 The Dynamic Programming Representation of Option
Value............................................................. 93
3.6 The Binomial Algorithm for Barrier Options.......................... 96
3.6.1 Python Implementation Using Conditional Indexing ......... 96
3.6.2 A New Source of Error: The Specified Versus the
Effective Barrier ................................................ 98
3.6.3 The In-Out Parity Relation for Single-Barrier Options ....... 100
3.7 Further Reading ......................................................... 100
3.7.1 Exercises ........................................................ 101
4 Simulation I: Monte Carlo Methods ....................................... 105
4.1 Brute-Force Monte Carlo ............................................... 107
4.1.1 Estimation by Independent Statistical Sampling .............. 107
4.1.2 Python Implementation for a European Option ............... 107
Contents xiii
4.2 A Regression-Based Method for Options with Early Exercise ....... 109
4.2.1 Approximating the Continuation Value ........................ 109
4.2.2 A Simple Example: Fitting the Legendre Polynomials
by Least-Squares................................................ 111
4.2.3 Using Continuation Estimates to Value an American
Put Option ....................................................... 113
4.3 Monte Carlo for Exotic Options........................................ 115
4.3.1 Barrier Options.................................................. 115
4.3.2 Asian Options ................................................... 117
4.4 Variance Reduction ..................................................... 120
4.4.1 Control Variates................................................. 121
4.4.2 Antithetic Variates .............................................. 123
4.4.3 Importance Sampling ........................................... 127
4.5 Estimating the Greeks: Bump-and-Revalue ........................... 130
4.6 Further Reading ......................................................... 133
4.6.1 Exercises ........................................................ 134
5 Finite Difference Methods .................................................. 137
5.1 The Black-Scholes-Merton PDE ....................................... 138
5.1.1 The General Form of the PDE ................................. 138
5.1.2 Asset Price Domain and Boundary Conditions for
European and Barrier Options.................................. 139
5.1.3 Parabolic PDEs and the Heat Equation ........................ 140
5.1.4 Transforming the Black-Scholes-Merton PDE to the
Heat Equation ................................................... 141
5.1.5 A Uniform Finite Difference Mesh Over a Rectangular
Domain .......................................................... 142
5.2 Construction of an Explicit Discretisation Scheme.................... 145
5.2.1 Taylor series Expansion of Partial Derivatives ................ 145
5.2.2 Building the FTCS Scheme .................................... 146
5.2.3 Python Implementation of the FTCS Scheme and
Numerical Instability ........................................... 147
5.3 Error Control for the FTCS Scheme ................................... 149
5.3.1 Global Error of a Numerical Scheme .......................... 149
5.3.2 Stability and Consistency Together Imply Convergence ...... 149
5.3.3 Stability in the Sense of von Neumann ........................ 151
5.3.4 Matrix Stability ................................................. 151
5.3.5 Local Accuracy and Consistency of the FTCS Scheme....... 155
5.4 Two Unconditionally Stable Schemes ................................. 156
5.4.1 Construction and Stability of an Implicit Scheme ............ 156
5.4.2 The Crank-Nicolson Finite Difference Approximation ....... 158
5.5 Python Valuation of Options Using an Implicit Scheme .............. 161
5.5.1 Implementation of the BTCS Scheme for a European
Call Option ...................................................... 161
5.5.2 Modification for a Down-and-Out Barrier Call Option ....... 167
xiv Contents
5.5.3 Modification for a Cash-or-Nothing Call Option.............. 168
5.6 The Finite Difference Approach for American Options............... 170
5.6.1 The Free Boundary Formulation of an American Put......... 170
5.6.2 The Compact Linear Complementarity Form
of the Problem .................................................. 171
5.6.3 Valuing an American Put Using the Method of
Projected Successive Over-Relaxation (PSOR) ............... 172
5.7 The Link to Binomial Methods......................................... 174
5.8 Further Reading ......................................................... 176
5.8.1 Exercises ........................................................ 177
Part III Simulation Methods Beyond the Black-Scholes Framework
6 Simulation II: Modelling Multivariate Financial Data .................. 183
6.1 Rainbow Options........................................................ 184
6.2 Jointly Distributed Random Variables ................................. 186
6.3 Joint Centred Normal Distributions .................................... 187
6.3.1 Incorporating a Covariance Structure by Cholesky
Factorisation .................................................... 188
6.3.2 A Python Implementation in Two Dimensions................ 189
6.3.3 The Probability Integral Transform ............................ 190
6.3.4 Simulating Correlated Black-Scholes Asset Models.......... 192
6.4 Dimension Reduction via Change-of-Measure ........................ 195
6.5 Fitting a Bivariate Normal Distribution to Equity Log-Returns ...... 197
6.6 Heavy-Tails: The Multivariate Student’s tν Distribution .............. 200
6.6.1 Mathematical Characterisation of the Distribution............ 200
6.6.2 Sampling from a Bivariate Student’s tν Distribution
Using Python.................................................... 203
6.7 Copulas for d-Dimensional Random Variables........................ 206
6.7.1 The Definition and Role of a Copula .......................... 207
6.7.2 Defining a Copula from a Joint CDF, and Vice Versa......... 208
6.7.3 Examples of Bivariate Copulas ................................ 208
6.7.4 Fitting a Copula to a Data Set .................................. 217
6.8 Further Reading ......................................................... 219
6.8.1 Exercises ........................................................ 220
7 Stochastic Models for Interest Rates....................................... 225
7.1 Calibrating a Black-Scholes Asset Model to Bond Prices ............ 226
7.1.1 A Risk Free Rate that Varies in Time .......................... 227
7.1.2 An Example of Risk-Neutral Model Calibration .............. 228
7.1.3 Interpolating Individual Asset Price Trajectories ............. 230
7.1.4 Brownian Bridging in Python .................................. 233
7.2 A Review of Bonds and Interest Rates................................. 236
7.2.1 The Spot Rate and the Term Structure ......................... 236
7.2.2 The Short Rate .................................................. 237
Contents xv
7.2.3 Yield-to-Maturity for Coupon-Bearing Bonds ................ 237
7.2.4 Forward Rates................................................... 238
7.3 Risk-Neutral Valuation of Bonds and Interest Rate Derivatives ...... 241
7.3.1 The Fundamental Equation for Bond Pricing ................. 241
7.3.2 Interest Rates Derivatives with Payoff Depending on a
Forward Curve .................................................. 242
7.3.3 The Discounted Feynman-Kac Theorem for Interest
Rate Derivatives................................................. 242
7.4 SDEs for Risk-Neutral Models of the Short Rate ..................... 244
7.4.1 Affine Term Structures Arising from Linear SDE Models ... 244
7.4.2 Linear SDE Models of the Short Rate ......................... 246
7.4.3 A Nonlinear SDE Model of the Short Rate: CIR.............. 252
7.5 Sampling for the Monte Carlo Valuation of Interest Rate
Derivatives............................................................... 262
7.5.1 Joint Sampling of an Interest Rate Model and Its
Discount Factor ................................................. 263
7.5.2 Pricing Interest Rate Derivatives Under the Forward
Risk-Neutral Measure .......................................... 264
7.6 Further Reading ......................................................... 266
7.6.1 Exercises ........................................................ 267
8 Simulation III: Numerical Approximation of SDE Models ............. 271
8.1 Strong Approximation Methods for Itô-Type SDEs................... 273
8.1.1 The θ-Maruyama Class of Numerical Methods ............... 274
8.1.2 Pathwise Error for Euler Schemes Applied to a Linear
SDE Model...................................................... 275
8.2 Stochastic Notions of Stability ......................................... 281
8.2.1 Asymptotic Stability in Mean-Square ......................... 281
8.2.2 Regions of Stability and A-Stability in Mean-Square......... 284
8.2.3 Almost Sure Asymptotic Stability ............................. 287
8.3 Stochastic Notions of Convergence .................................... 290
8.3.1 Theoretical and Numerical Demonstrations
of Convergence ................................................. 291
8.3.2 Order of Weak Convergence for the Explicit
Euler-Maruyama Scheme ...................................... 293
8.3.3 Order of Strong Convergence for the Explicit
Euler-Maruyama Scheme ...................................... 298
8.4 The Milstein Scheme ................................................... 303
8.4.1 Motivation in the 1-Dimensional Diffusion-Only Case ....... 303
8.4.2 The General Form of the Milstein Scheme .................... 304
8.4.3 Mean-Square Asymptotic Stability of the Milstein
Scheme .......................................................... 305
8.5 A Review of Advanced Numerical Methods for Nonlinear
Financial Models........................................................ 307
8.5.1 Weakly Convergent Numerical Methods ...................... 309
xvi Contents
8.5.2 Strongly Convergent Numerical Methods ..................... 309
8.6 Multilevel Monte Carlo (MLMC) Approximation .................... 312
8.6.1 Motivating the MLMC Estimator .............................. 313
8.6.2 A Python Demonstration of Variance Reduction by
MLMC Sampling ............................................... 314
8.6.3 Algorithm, and the Roles of Weak and Strong
Convergence .................................................... 316
8.7 Further Reading ......................................................... 318
8.7.1 Exercises ........................................................ 318



雷达卡




京公网安备 11010802022788号







