楼主: guruguru
6387 11

[资产定价] C++ Financial modeling numerical recipe [推广有奖]

  • 0关注
  • 2粉丝

已卖:913份资源

硕士生

53%

还不是VIP/贵宾

-

威望
0
论坛币
33 个
通用积分
44.1972
学术水平
6 点
热心指数
11 点
信用等级
6 点
经验
1748 点
帖子
93
精华
0
在线时间
215 小时
注册时间
2011-7-17
最后登录
2025-4-25

楼主
guruguru 发表于 2013-10-9 06:24:57 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
好像没人传过。作者是挪威大学一个教授,常年用C++做实证分析,写了一本书,用C++实现了绝大多数金融模型。。代码可读性很强,有点像C Style的C++ code。 当年学geske模型时候仔细参考过此书,收获很大.


numerical receipe in finance .rar (1.06 MB) 本附件包括:
  • numerical receipe in finance .pdf




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Numerical financial Financia Modeling inancial Style 挪威 大学 模型

已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
accumulation + 100 + 1 + 1 + 1 精彩帖子
Chemist_MZ + 20 + 20 + 1 奖励积极上传好的资料

总评分: 经验 + 120  论坛币 + 20  学术水平 + 1  热心指数 + 2  信用等级 + 1   查看全部评分

本帖被以下文库推荐

沙发
zzyftpl 在职认证  发表于 2013-10-9 07:20:48
Financial Numerical Recipes in C++.
Bernt Arne Ødegaard
April 2007

Contents
1 On C++ and programming. 5
1.1 Compiling and linking . . . . . . . . . . . . . . . 5
1.2 The structure of a C++ program . . . . . . . . . 6
1.2.1 Types . . . . . . . . . . . . . . . . . . . . 6
1.2.2 Operations . . . . . . . . . . . . . . . . . 6
1.2.3 Functions and libraries . . . . . . . . . . . 7
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 . . . . . . . . . . . 10
1.4 Const references . . . . . . . . . . . . . . . . . . . 16
1.5 Other C++ concepts . . . . . . . . . . . . . . . . . 16
2 Matrix Tools 17
2.1 The first screen . . . . . . . . . . . . . . . . . . . 18
2.2 Linear algebra . . . . . . . . . . . . . . . . . . . . 18
2.2.1 Basic matrix operations . . . . . . . . . . 18
2.2.2 Arithmetic Matrix Operations. . . . . . . 19
2.3 Solving linear equations . . . . . . . . . . . . . . 22
2.4 Element by element operations . . . . . . . . . . 24
2.5 Function definitions . . . . . . . . . . . . . . . . 24
2.6 m files . . . . . . . . . . . . . . . . . . . . . . . . 24
2.7 Flow control . . . . . . . . . . . . . . . . . . . . . 24
2.8 Plotting . . . . . . . . . . . . . . . . . . . . . . . 24
2.9 Libraries . . . . . . . . . . . . . . . . . . . . . . . 25
2.10 References . . . . . . . . . . . . . . . . . . . . . . 25
3 The value of time 26
3.1 Present value . . . . . . . . . . . . . . . . . . . . 26
3.2 One interest rate with annual compounding . . . 27
3.2.1 Internal rate of return. . . . . . . . . . . . 30
3.3 Continously compounded interest . . . . . . . . . 34
3.3.1 Present value . . . . . . . . . . . . . . . . 35
3.4 Further readings . . . . . . . . . . . . . . . . . . 35
4 Bond Pricing with a flat term structure 36
4.1 Flat term structure with discrete, annual compounding
. . . . . . . . . . . . . . . . . . . . . . 37
4.1.1 Bond Price . . . . . . . . . . . . . . . . . 37
4.1.2 Yield to maturity . . . . . . . . . . . . . . 38
4.1.3 Duration . . . . . . . . . . . . . . . . . . . 41
4.1.4 Measuring bond sensitivity to interest
rate changes . . . . . . . . . . . . . . . . . 43
4.2 Continously compounded interest . . . . . . . . . 47
4.3 Further readings . . . . . . . . . . . . . . . . . . 50
5 The term structure of interest rates and an object lesson 51
5.1 The interchangeability of discount factors, spot
interest rates and forward interest rates . . . . . 52
5.2 The term structure as an object . . . . . . . . . . 55
5.2.1 Base class . . . . . . . . . . . . . . . . . . 55
5.2.2 Flat term structure. . . . . . . . . . . . . 57
5.3 Using the currently observed term structure. . . . 58
5.3.1 Linear Interpolation. . . . . . . . . . . . . 59
5.3.2 Interpolated term structure class. . . . . . 61
5.4 Bond calculations with a general term structure
and continous compounding . . . . . . . . . . . . 64
6 The Mean Variance Frontier 67
6.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2 The minimum variance frontier . . . . . . . . . . 69
6.3 Calculation of frontier portfolios . . . . . . . . . 69
6.4 The global minimum variance portfolio . . . . . . 72
6.5 Efficient portfolios . . . . . . . . . . . . . . . . . 72
6.6 The zero beta portfolio . . . . . . . . . . . . . . . 73
6.7 Allowing for a riskless asset. . . . . . . . . . . . . 73
6.8 Efficient sets with risk free assets. . . . . . . . . . 74
6.9 Short-sale constraints . . . . . . . . . . . . . . . . 75
6.10 The Sharpe Ratio . . . . . . . . . . . . . . . . . . 75
6.11 Equilibrium: CAPM . . . . . . . . . . . . . . . . 76
6.11.1 Treynor . . . . . . . . . . . . . . . . . . . 76
6.11.2 Jensen . . . . . . . . . . . . . . . . . . . 76
6.12 Working with Mean Variance and CAPM . . . . . 76
6.13 Mean variance analysis using matrix libraries . . 77
7 Futures algoritms. 81
7.1 Pricing of futures contract. . . . . . . . . . . . . 81
8 Binomial option pricing 82
8.1 Options . . . . . . . . . . . . . . . . . . . . . . . 82
8.2 Pricing . . . . . . . . . . . . . . . . . . . . . . . . 82
8.3 Multiperiod binomial pricing . . . . . . . . . . . 85
9 Basic Option Pricing, the Black Scholes formula 89
9.1 The formula . . . . . . . . . . . . . . . . . . . . . 90
9.2 Understanding the why’s of the formula . . . . . 92
9.2.1 The original Black Scholes analysis . . . . 93
9.2.2 The limit of a binomial case . . . . . . . . 93
9.2.3 The representative agent framework . . . 93
9.3 Partial derivatives. . . . . . . . . . . . . . . . . . 93
9.3.1 Delta . . . . . . . . . . . . . . . . . . . . . 93
9.3.2 Other Derivatives . . . . . . . . . . . . . . 94
9.3.3 Implied Volatility. . . . . . . . . . . . . . 96
9.4 References . . . . . . . . . . . . . . . . . . . . . . 98
10 Warrants 99
10.1 Warrant value in terms of assets . . . . . . . . . . 99
10.2 Valuing warrants when observing the stock value 100
10.3 Readings . . . . . . . . . . . . . . . . . . . . . . . 101
11 Extending the Black Scholes formula 102
11.1 Adjusting for payouts of the underlying. . . . . . 102
11.1.1 Continous Payouts from underlying. . . . 102
11.1.2 Dividends. . . . . . . . . . . . . . . . . . . 103
11.2 American options . . . . . . . . . . . . . . . . . . 104
11.2.1 Exact american call formula when stock is
paying one dividend. . . . . . . . . . . . . 105
11.3 Options on futures . . . . . . . . . . . . . . . . . 108
11.3.1 Black’s model . . . . . . . . . . . . . . . . 108
11.4 Foreign Currency Options . . . . . . . . . . . . . 109
11.5 Perpetual puts and calls . . . . . . . . . . . . . . 110
11.6 Readings . . . . . . . . . . . . . . . . . . . . . . . 111
12 Option pricing with binomial approximations 112
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . 112
12.2 Pricing of options in the Black Scholes setting . . 113
12.2.1 European Options . . . . . . . . . . . . . 114
12.2.2 American Options . . . . . . . . . . . . . 114
12.2.3 Matlab implementation . . . . . . . . . . . 116
12.3 How good is the binomial approximation? . . . . 119
12.3.1 Estimating partials. . . . . . . . . . . . . 120
12.4 Adjusting for payouts for the underlying . . . . 123
12.5 Pricing options on stocks paying dividends using
a binomial approximation . . . . . . . . . . . . . 124
12.5.1 Checking for early exercise in the binomial
model. . . . . . . . . . . . . . . . . . 124
12.5.2 Proportional dividends. . . . . . . . . . . 124
12.5.3 Discrete dividends . . . . . . . . . . . . . 126
12.6 Option on futures . . . . . . . . . . . . . . . . . . 128
12.7 Foreign Currency options . . . . . . . . . . . . . 130
12.8 References . . . . . . . . . . . . . . . . . . . . . . 131
13 Finite Differences 132
13.1 Explicit Finite differences . . . . . . . . . . . . . 132
13.2 European Options. . . . . . . . . . . . . . . . . . 132
13.3 American Options. . . . . . . . . . . . . . . . . . 134
13.4 Implicit finite differences . . . . . . . . . . . . . . 137
13.5 An example matrix class . . . . . . . . . . . . . . 137
13.6 Finite Differences . . . . . . . . . . . . . . . . . . 137
13.7 American Options . . . . . . . . . . . . . . . . . 137
13.8 European Options . . . . . . . . . . . . . . . . . 140
13.9 References . . . . . . . . . . . . . . . . . . . . . . 141
14 Option pricing by simulation 142
14.1 Simulating lognormally distributed random variables
. . . . . . . . . . . . . . . . . . . . . . . . . 143
14.2 Pricing of European Call options . . . . . . . . . 143
14.3 Hedge parameters . . . . . . . . . . . . . . . . . . 144
14.4 More general payoffs. Function prototypes . . . . 146
14.5 Improving the efficiency in simulation . . . . . . 147
14.5.1 Control variates. . . . . . . . . . . . . . . 147
14.5.2 Antithetic variates. . . . . . . . . . . . . . 148
14.6 More exotic options . . . . . . . . . . . . . . . . . 151
14.7 References . . . . . . . . . . . . . . . . . . . . . . 152
15 Pricing American Options – Approximations 153
15.1 The Johnson (1983) approximation . . . . . . . . 153
15.2 An approximation to the American Put due to
Geske and Johnson (1984) . . . . . . . . . . . . . 156
15.3 A quadratic approximation to American prices
due to Barone–Adesi and Whaley. . . . . . . . . . 159
15.4 An alternative approximation to american options
due to Bjerksund and Stensland (1993) . . 162
15.5 Readings . . . . . . . . . . . . . . . . . . . . . . . 165
16 Average, lookback and other exotic options 166
16.1 Bermudan options . . . . . . . . . . . . . . . . . 166
16.2 Asian options . . . . . . . . . . . . . . . . . . . . 169
16.3 Lookback options . . . . . . . . . . . . . . . . . . 170
16.4 Monte Carlo Pricing of options whose payoff depend
on the whole price path . . . . . . . . . . . 172
16.4.1 Generating a series of lognormally distributed
variables . . . . . . . . . . . . . . 172
16.5 Control variate . . . . . . . . . . . . . . . . . . . 175
16.6 References . . . . . . . . . . . . . . . . . . . . . . 176
17 Generic binomial pricing 177
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . 177
17.2 Delta calculation . . . . . . . . . . . . . . . . . . 182
18 Trinomial trees 183
18.1 Intro . . . . . . . . . . . . . . . . . . . . . . . . . 183
18.2 Implementation . . . . . . . . . . . . . . . . . . . 183
18.3 Further reading . . . . . . . . . . . . . . . . . . . 186
19 Alternatives to the Black Scholes type option formula 187
19.1 Merton’s Jump diffusion model. . . . . . . . . . . 187
19.2 Hestons pricing formula for a stochastic volatility
model . . . . . . . . . . . . . . . . . . . . . . . . 189
20 Pricing of bond options, basic models 192
20.1 Black Scholes bond option pricing . . . . . . . . . 192
20.2 Binomial bond option pricing . . . . . . . . . . . 194
21 Credit risk 196
21.1 The Merton Model . . . . . . . . . . . . . . . . . 196
21.2 Issues in implementation . . . . . . . . . . . . . . 197
22 Term Structure Models 198
22.1 The Nelson Siegel term structure approximation 199
22.2 Extended Nelson Siegel models . . . . . . . . . . 201
22.3 Cubic spline. . . . . . . . . . . . . . . . . . . . . 203
22.4 Cox Ingersoll Ross. . . . . . . . . . . . . . . . . . 206
22.5 Vasicek . . . . . . . . . . . . . . . . . . . . . . . 209
22.6 Readings . . . . . . . . . . . . . . . . . . . . . . . 211
23 Binomial Term Structure models 212
23.1 The Rendleman and Bartter model . . . . . . . . 212
23.2 Readings . . . . . . . . . . . . . . . . . . . . . . . 214
24 Interest rate trees 215
24.1 The movement of interest rates . . . . . . . . . . 215
24.2 Discount factors . . . . . . . . . . . . . . . . . . . 217
24.3 Pricing bonds . . . . . . . . . . . . . . . . . . . . 217
24.4 Callable bond . . . . . . . . . . . . . . . . . . . . 219
24.5 Readings . . . . . . . . . . . . . . . . . . . . . . . 221
25 Building term structure trees using the Ho and Lee (1986) approach 222
25.1 Intro . . . . . . . . . . . . . . . . . . . . . . . . . 222
25.2 Building trees of term structures . . . . . . . . . 222
25.3 Ho Lee term structure class . . . . . . . . . . . . 222
25.4 Pricing things . . . . . . . . . . . . . . . . . . . . 225
25.5 References . . . . . . . . . . . . . . . . . . . . . . 227
26 Term Structure Derivatives 228
26.1 Vasicek bond option pricing . . . . . . . . . . . . 228
A Normal Distribution approximations. 230
A.1 The normal distribution function . . . . . . . . . 230
A.2 The cumulative normal distribution . . . . . . . . 231
A.3 Multivariate normal . . . . . . . . . . . . . . . . 231
A.4 Calculating cumulative bivariate normal probabilities
. . . . . . . . . . . . . . . . . . . . . . . . 232
A.5 Simulating random normal numbers . . . . . . . 234
A.6 Cumulative probabilities for general multivariate
distributions . . . . . . . . . . . . . . . . . . . . . 235
A.7 References . . . . . . . . . . . . . . . . . . . . . . 235
B C++ concepts 236
C Interfacing to external libraries 238
C.1 Newmat . . . . . . . . . . . . . . . . . . . . . . . 238
C.2 IT++ . . . . . . . . . . . . . . . . . . . . . . . . 238
C.3 GSL . . . . . . . . . . . . . . . . . . . . . . . . . 238
C.3.1 The evaluation of N3 . . . . . . . . . . . . 238
C.4 Internet links . . . . . . . . . . . . . . . . . . . . 239
D Summarizing routine names 240
E Installation 250
E.1 Source availability . . . . . . . . . . . . . . . . . 250
F Acknowledgements. 255
This book is a a discussion of the calculation of specific formulas in finance. The field of finance has seen a
rapid development in recent years, with increasing mathematical sophistication. The fields of derivatives and fixed income have since then been the main fields where complicated formulas are used. This book is intended to be of use for people who want to both understand and use these formulas, which explains why most of the algorithms presented later are derivatives prices. This project started when I was teaching a course in derivatives at the University of British Columbia, in the course of which I sat down and wrote code for calculating the formulas I was teaching. I have always found that implementation helps understanding these things. For teaching such complicated material it is often useful to actually look at the implementation of how the calculation is done in practice. The purpose of the book is therefore primarily pedagogical, although I believe all the routines presented are correct and reasonably efficient, and I know they are also used by people to price real options. To implement the algorithms in a computer language I choose C++. My students keep asking why anybody would want to use such a backwoods computer language, they think a spreadsheet can solve all the worlds problems. I have some experience with alternative systems for computing, and no matter what, in the end you end up being frustrated with higher end ¡°languages¡±, such as Matlab og Gauss (Not to mention the straitjacket which is is a spreadsheet.) and going back to implementation in a standard language. All example algorithms are therefore coded in C++. In doing the implementation I have tried to be as generic as possible in terms of the C++ used, but I have taken advantage of a some of the possibilities the language provides in terms of abstraction and modularization. This will also serve as a lesson in why a real computer language is useful.  亚马逊3星半评分(21人)

藤椅
yiweidon 发表于 2013-10-9 08:42:28
应该有人传过的,
威廉姆,要向世界展示實用主義,進攻性及冷靜的計算相結合的無堅不摧的力量。

板凳
Mark1988huang 发表于 2013-10-9 08:42:41
谢谢分享哦

报纸
CCjxsq 发表于 2013-10-9 08:43:50
谢谢楼主 顶顶顶

地板
Enthuse 发表于 2013-10-10 06:17:59
thanks for sharing...

7
cc457921 发表于 2013-10-12 10:20:33
thank you very much!!!

8
wxfwolf 发表于 2013-10-14 13:38:32
继续关注
他灵魂的欲望就是他命运的先知。
在别人贪婪时恐惧;在别人恐惧时贪婪。
练就一颗敢死而又敢让人死的孤胆雄心!
我们这一代人,不光有乘凉的福,还有栽树的“命”!

9
迟迟钟鼓 发表于 2014-6-19 13:02:06
感觉是很有用的handbook,多谢啦

10
fjrong 在职认证  发表于 2015-2-2 09:54:34

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jr
拉您进交流群
GMT+8, 2025-12-30 02:49