1 On C++ and programming. 5
1.1 Compiling and linking . . . . . . . . . . . . . . . 5
1.2 The structure of a C++ program . . . . . . . . . 5
1.2.1 Types . . . . . . . . . . . . . . . . . . . . 5
1.2.2 Operations . . . . . . . . . . . . . . . . . 6
1.2.3 Functions and libraries . . . . . . . . . . . 6
1.2.4 Templates and libraries . . . . . . . . . . 7
1.2.5 Flow control . . . . . . . . . . . . . . . . . 8
1.2.6 Input Output . . . . . . . . . . . . . . . . 8
1.2.7 Splitting up a program . . . . . . . . . . . 8
1.2.8 Namespaces . . . . . . . . . . . . . . . . . 9
1.3 Extending the language, the class concept. . . . 9
1.3.1 date, an example class . . . . . . . . . . . 9
1.4 Const references . . . . . . . . . . . . . . . . . . . 15
1.5 Other C++ concepts . . . . . . . . . . . . . . . . . 15
2 Matrix Tools 16
2.1 The rst screen . . . . . . . . . . . . . . . . . . . 17
2.2 Linear algebra . . . . . . . . . . . . . . . . . . . . 17
2.2.1 Basic matrix operations . . . . . . . . . . 17
2.2.2 Arithmetic Matrix Operations. . . . . . . 18
2.3 Solving linear equations . . . . . . . . . . . . . . 21
2.4 Element by element operations . . . . . . . . . . 22
2.5 Function denitions . . . . . . . . . . . . . . . . 23
2.6 m les . . . . . . . . . . . . . . . . . . . . . . . . 23
2.7 Flow control . . . . . . . . . . . . . . . . . . . . . 23
2.8 Plotting . . . . . . . . . . . . . . . . . . . . . . . 23
2.9 Libraries . . . . . . . . . . . . . . . . . . . . . . . 23
2.10 References . . . . . . . . . . . . . . . . . . . . . . 23
3 The value of time 24
3.1 Present value . . . . . . . . . . . . . . . . . . . . 24
3.2 One interest rate with annual compounding . . . 25
3.2.1 Internal rate of return. . . . . . . . . . . . 28
3.3 Continously compounded interest . . . . . . . . . 32
3.3.1 Present value . . . . . . . . . . . . . . . . 33
3.4 Further readings . . . . . . . . . . . . . . . . . . 33
4 Bond Pricing with a at term structure 34
4.1 Flat term structure with discrete, annual com-
pounding . . . . . . . . . . . . . . . . . . . . . . 34
4.1.1 Bond Price . . . . . . . . . . . . . . . . . 35
4.1.2 Yield to maturity . . . . . . . . . . . . . . 35
4.1.3 Duration . . . . . . . . . . . . . . . . . . . 38
4.1.4 Measuring bond sensitivity to interest
rate changes . . . . . . . . . . . . . . . . . 40
4.2 Continously compounded interest . . . . . . . . . 44
4.3 Further readings . . . . . . . . . . . . . . . . . . 47
5 The term structure of interest rates and an object lesson 48
5.1 The interchangeability of discount factors, spot
interest rates and forward interest rates . . . . . 49
5.2 The term structure as an object . . . . . . . . . . 51
5.2.1 Base class . . . . . . . . . . . . . . . . . . 51
5.2.2 Flat term structure. . . . . . . . . . . . . 53
5.3 Using the currently observed term structure. . . . 54
5.3.1 Linear Interpolation. . . . . . . . . . . . . 55
5.3.2 Interpolated term structure class. . . . . . 57
5.4 Bond calculations with a general term structure
and continous compounding . . . . . . . . . . . . 60
6 The Mean Variance Frontier 63
6.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . 63
6.2 The minimum variance frontier . . . . . . . . . . 64
6.3 Calculation of frontier portfolios . . . . . . . . . 65
6.4 The global minimum variance portfolio . . . . . . 68
6.5 Ecient portfolios . . . . . . . . . . . . . . . . . 68
6.6 The zero beta portfolio . . . . . . . . . . . . . . . 69
6.7 Allowing for a riskless asset. . . . . . . . . . . . . 69
6.8 Ecient sets with risk free assets. . . . . . . . . . 70
6.9 Short-sale constraints . . . . . . . . . . . . . . . . 71
6.10 The Sharpe Ratio . . . . . . . . . . . . . . . . . . 71
6.11 Equilibrium: CAPM . . . . . . . . . . . . . . . . 72
6.11.1 Treynor . . . . . . . . . . . . . . . . . . . 72
6.11.2 Jensen . . . . . . . . . . . . . . . . . . . 72
6.12 Working with Mean Variance and CAPM . . . . . 72
6.13 Mean variance analysis using matrix libraries . . 73
7 Futures algoritms. 77
7.1 Pricing of futures contract. . . . . . . . . . . . . 77
8 Binomial option pricing 78
8.1 Options . . . . . . . . . . . . . . . . . . . . . . . 78
8.2 Pricing . . . . . . . . . . . . . . . . . . . . . . . . 78
8.3 Multiperiod binomial pricing . . . . . . . . . . . 80
9 Basic Option Pricing, the Black Scholes formula 85
9.1 The formula . . . . . . . . . . . . . . . . . . . . . 85
9.2 Understanding the why's of the formula . . . . . 87
9.2.1 The original Black Scholes analysis . . . . 88
9.2.2 The limit of a binomial case . . . . . . . . 88
9.2.3 The representative agent framework . . . 88
9.3 Partial derivatives. . . . . . . . . . . . . . . . . . 88
9.3.1 Delta . . . . . . . . . . . . . . . . . . . . . 88
9.3.2 Other Derivatives . . . . . . . . . . . . . . 89
9.3.3 Implied Volatility. . . . . . . . . . . . . . 91
9.4 References . . . . . . . . . . . . . . . . . . . . . . 93
10 Warrants 94
10.1 Warrant value in terms of assets . . . . . . . . . . 94
10.2 Valuing warrants when observing the stock value 94
10.3 Readings . . . . . . . . . . . . . . . . . . . . . . . 96
11 Extending the Black Scholes formula 97
11.1 Adjusting for payouts of the underlying. . . . . . 97
11.1.1 Continous Payouts from underlying. . . . 97
11.1.2 Dividends. . . . . . . . . . . . . . . . . . . 98
11.2 American options . . . . . . . . . . . . . . . . . . 99
11.2.1 Exact american call formula when stock is
paying one dividend. . . . . . . . . . . . . 99
11.3 Options on futures . . . . . . . . . . . . . . . . . 102
11.3.1 Black's model . . . . . . . . . . . . . . . . 102
11.4 Foreign Currency Options . . . . . . . . . . . . . 103
11.5 Perpetual puts and calls . . . . . . . . . . . . . . 104
11.6 Readings . . . . . . . . . . . . . . . . . . . . . . . 105
12 Option pricing with binomial approximations 106
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . 106
12.2 Pricing of options in the Black Scholes setting . . 107
12.2.1 European Options . . . . . . . . . . . . . 107
12.2.2 American Options . . . . . . . . . . . . . 108
12.2.3 Matlab implementation . . . . . . . . . . . 110
12.3 How good is the binomial approximation? . . . . 112
12.3.1 Estimating partials. . . . . . . . . . . . . 113
12.4 Adjusting for payouts for the underlying . . . . 116
12.5 Pricing options on stocks paying dividends using
a binomial approximation . . . . . . . . . . . . . 117
12.5.1 Checking for early exercise in the bino-
mial model. . . . . . . . . . . . . . . . . . 117
12.5.2 Proportional dividends. . . . . . . . . . . 117
12.5.3 Discrete dividends . . . . . . . . . . . . . 119
12.6 Option on futures . . . . . . . . . . . . . . . . . . 121
12.7 Foreign Currency options . . . . . . . . . . . . . 123
12.8 References . . . . . . . . . . . . . . . . . . . . . . 124
13 Finite Dierences 125
13.1 Explicit Finite dierences . . . . . . . . . . . . . 125
13.2 European Options. . . . . . . . . . . . . . . . . . 125
13.3 American Options. . . . . . . . . . . . . . . . . . 127
13.4 Implicit nite dierences . . . . . . . . . . . . . . 130
13.5 An example matrix class . . . . . . . . . . . . . . 130
13.6 Finite Dierences . . . . . . . . . . . . . . . . . . 130
13.7 American Options . . . . . . . . . . . . . . . . . 130
13.8 European Options . . . . . . . . . . . . . . . . . 133
13.9 References . . . . . . . . . . . . . . . . . . . . . . 134
14 Option pricing by simulation 135
14.1 Simulating lognormally distributed random vari-
ables . . . . . . . . . . . . . . . . . . . . . . . . . 135
14.2 Pricing of European Call options . . . . . . . . . 136
14.3 Hedge parameters . . . . . . . . . . . . . . . . . . 137
14.4 More general payos. Function prototypes . . . . 139
14.5 Improving the eciency in simulation . . . . . . 140
14.5.1 Control variates. . . . . . . . . . . . . . . 140
14.5.2 Antithetic variates. . . . . . . . . . . . . . 141
14.6 More exotic options . . . . . . . . . . . . . . . . . 144
14.7 References . . . . . . . . . . . . . . . . . . . . . . 145
15 Approximations 146
15.1 The Johnson (1983) approximation . . . . . . . . 146
15.2 An approximation to the American Put due to
Geske and Johnson (1984) . . . . . . . . . . . . . 148
15.3 A quadratic approximation to American prices
due to BaroneAdesi and Whaley. . . . . . . . . . 151
15.4 An alternative approximation to american op-
tions due to Bjerksund and Stensland (1993) . . 154
15.5 Readings . . . . . . . . . . . . . . . . . . . . . . . 156
16 Average, lookback and other exotic options 157
16.1 Bermudan options . . . . . . . . . . . . . . . . . 157
16.2 Asian options . . . . . . . . . . . . . . . . . . . . 159
16.3 Lookback options . . . . . . . . . . . . . . . . . . 160
16.4 Monte Carlo Pricing of options whose payo de-
pend on the whole price path . . . . . . . . . . . 162
16.4.1 Generating a series of lognormally dis-
tributed variables . . . . . . . . . . . . . . 162
16.5 Control variate . . . . . . . . . . . . . . . . . . . 165
16.6 References . . . . . . . . . . . . . . . . . . . . . . 166
17 Generic binomial pricing 167
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . 167
17.2 Delta calculation . . . . . . . . . . . . . . . . . . 171
18 Trinomial trees 172
18.1 Intro . . . . . . . . . . . . . . . . . . . . . . . . . 172
18.2 Implementation . . . . . . . . . . . . . . . . . . . 172
18.3 Further reading . . . . . . . . . . . . . . . . . . . 175
19 Alternatives to the Black Scholes type option formula 176
19.1 Merton's Jump diusion model. . . . . . . . . . . 176
19.2 Hestons pricing formula for a stochastic volatility
model . . . . . . . . . . . . . . . . . . . . . . . . 178
20 Pricing of bond options, basic models 181
20.1 Black Scholes bond option pricing . . . . . . . . . 181
20.2 Binomial bond option pricing . . . . . . . . . . . 183
21 Credit risk 185
21.1 The Merton Model . . . . . . . . . . . . . . . . . 185
21.2 Issues in implementation . . . . . . . . . . . . . . 186
22 Term Structure Models 187
22.1 The Nelson Siegel term structure approximation 187
22.2 Extended Nelson Siegel models . . . . . . . . . . 190
22.3 Cubic spline. . . . . . . . . . . . . . . . . . . . . 192
22.4 Cox Ingersoll Ross. . . . . . . . . . . . . . . . . . 195
22.5 Vasicek . . . . . . . . . . . . . . . . . . . . . . . 198
22.6 Readings . . . . . . . . . . . . . . . . . . . . . . . 199
23 Binomial Term Structure models 200
23.1 The Rendleman and Bartter model . . . . . . . . 200
23.2 Readings . . . . . . . . . . . . . . . . . . . . . . . 202
24 Interest rate trees 203
24.1 The movement of interest rates . . . . . . . . . . 203
24.2 Discount factors . . . . . . . . . . . . . . . . . . . 204
24.3 Pricing bonds . . . . . . . . . . . . . . . . . . . . 205
24.4 Callable bond . . . . . . . . . . . . . . . . . . . . 207
24.5 Readings . . . . . . . . . . . . . . . . . . . . . . . 209
25 Building term structure trees using the Ho and Lee (1986) approach 210
25.1 Intro . . . . . . . . . . . . . . . . . . . . . . . . . 210
25.2 Building trees of term structures . . . . . . . . . 210
25.3 Ho Lee term structure class . . . . . . . . . . . . 210
25.4 Pricing things . . . . . . . . . . . . . . . . . . . . 212
25.5 References . . . . . . . . . . . . . . . . . . . . . . 214
26 Term Structure Derivatives 215
26.1 Vasicek bond option pricing . . . . . . . . . . . . 215 |