Details

Monte Carlo Frameworks


Monte Carlo Frameworks

Building Customisable High-performance C++ Applications
The Wiley Finance Series, Band 601 1. Aufl.

von: Daniel J. Duffy, Joerg Kienitz

77,99 €

Verlag: Wiley
Format: PDF
Veröffentl.: 02.08.2011
ISBN/EAN: 9780470684061
Sprache: englisch
Anzahl Seiten: 784

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

This is one of the first books that describe all the steps that are needed in order to analyze, design and implement <st1:place w:st="on">Monte Carlo</st1:place> applications. It discusses the financial theory as well as the mathematical and numerical background that is needed to write flexible and efficient C++ code using state-of-the art design and system patterns, object-oriented and generic programming models in combination with standard libraries and tools. <p/>   <p/> Includes a CD containing the source code for all examples. It is strongly advised that you experiment with the code by compiling it and extending it to suit your needs. Support is offered via a user forum on <a href="http://www.datasimfinancial.com/">www.datasimfinancial.com</a> where you can post queries and communicate with other purchasers of the book. <p/>   <p/> This book is for those professionals who design and develop models in computational finance. This book assumes that you have a working knowledge of C ++. <p/>  
<b>Notation xix</b> <p><b>Executive Overview xxiii</b></p> <p><b>0 My First Monte Carlo Application One-Factor Problems 1</b></p> <p>0.1 Introduction and objectives 1</p> <p>0.2 Description of the problem 1</p> <p>0.3 Ordinary differential equations (ODE) 2</p> <p>0.4 Stochastic differential equations (SDE) and their solution 3</p> <p>0.5 Generating uniform and normal random numbers 4</p> <p>0.6 The Monte Carlo method 8</p> <p>0.7 Calculating sensitivities 9</p> <p>0.8 The initial C++ Monte Carlo framework: hierarchy and paths 10</p> <p>0.9 The initial C++ Monte Carlo framework: calculating option price 19</p> <p>0.10 The predictor-corrector method: a scheme for all seasons? 23</p> <p>0.11 The Monte Carlo approach: caveats and nasty surprises 24</p> <p>0.12 Summary and conclusions 25</p> <p>0.13 Exercises and projects 25</p> <p><b>PART I FUNDAMENTALS</b></p> <p><b>1</b> <b>Mathematical Preparations for the Monte Carlo Method 31</b></p> <p>1.1 Introduction and objectives 31</p> <p>1.2 Random variables 31</p> <p>1.3 Discrete and continuous random variables 34</p> <p>1.4 Multiple random variables 37</p> <p>1.5 A short history of integration 38</p> <p>1.6 <i>σ</i>-algebras, measurable spaces and measurable functions 39</p> <p>1.7 Probability spaces and stochastic processes 40</p> <p>1.8 The Ito stochastic integral 41</p> <p>1.9 Applications of the Lebesgue theory 43</p> <p>1.10 Some useful inequalities 45</p> <p>1.11 Some special functions 46</p> <p>1.12 Convergence of function sequences 48</p> <p>1.13 Applications to stochastic analysis 49</p> <p>1.14 Summary and conclusions 50</p> <p>1.15 Exercises and projects 50</p> <p><b>2 The Mathematics of Stochastic Differential Equations (SDE) 53</b></p> <p>2.1 Introduction and objectives 53</p> <p>2.2 A survey of the literature 53</p> <p>2.3 Mathematical foundations for SDEs 55</p> <p>2.4 Motivating random (stochastic) processes 59</p> <p>2.5 An introduction to one-dimensional random processes 59</p> <p>2.6 Stochastic differential equations in Banach spaces: prologue 62</p> <p>2.7 Classes of SIEs and properties of their solutions 62</p> <p>2.8 Existence and uniqueness results 63</p> <p>2.9 A special SDE: the Ito equation 64</p> <p>2.10 Numerical approximation of SIEs 66</p> <p>2.11 Transforming an SDE: the Ito formula 68</p> <p>2.12 Summary and conclusions 69</p> <p>2.13 Appendix: proof of the Banach fixed-point theorem and some applications 69</p> <p>2.14 Exercises and projects 71</p> <p><b>3 Alternative SDEs and Toolkit Functionality 73</b></p> <p>3.1 Introduction and objectives 73</p> <p>3.2 Bessel processes 73</p> <p>3.3 Random variate generation 74</p> <p>3.4 The exponential distribution 74</p> <p>3.5 The beta and gamma distributions 75</p> <p>3.6 The chi-squared, Student and other distributions 79</p> <p>3.7 Discrete variate generation 79</p> <p>3.8 The Fokker-Planck equation 80</p> <p>3.9 The relationship with PDEs 81</p> <p>3.10 Alternative stochastic processes 84</p> <p>3.11 Using associative arrays and matrices to model lookup tables and volatility surfaces 93</p> <p>3.12 Summary and conclusion 96</p> <p>3.13 Appendix: statistical distributions and special functions in the Boost library 97</p> <p>3.14 Exercises and projects 102</p> <p><b>4 An Introduction to the Finite Difference Method for SDE 107</b></p> <p>4.1 Introduction and objectives 107</p> <p>4.2 An introduction to discrete time simulation, motivation and notation 107</p> <p>4.3 Foundations of discrete time approximation: ordinary differential equations 109</p> <p>4.4 Foundations of discrete time approximation: stochastic differential equations 113</p> <p>4.5 Some common schemes for one-factor SDEs 117</p> <p>4.6 The Milstein schemes 117</p> <p>4.7 Predictor-corrector methods 118</p> <p>4.8 Stiff ordinary and stochastic differential equations 119</p> <p>4.9 Software design and C++ implementation issues 125</p> <p>4.10 Computational results 126</p> <p>4.11 Aside: the characteristic equation of a difference scheme 127</p> <p>4.12 Summary and conclusions 128</p> <p>4.13 Exercises and projects 128</p> <p><b>5 Design and Implementation of Finite Difference Schemes in Computational Finance 137</b></p> <p>5.1 Introduction and objectives 137</p> <p>5.2 Modelling SDEs and FDM in C++ 137</p> <p>5.3 Mathematical and numerical tools 138</p> <p>5.4 The Karhunen-Loeve expansion 143</p> <p>5.5 Cholesky decomposition 144</p> <p>5.6 Spread options with stochastic volatility 146</p> <p>5.7 The Heston stochastic volatility model 153</p> <p>5.8 Path-dependent options and the Monte Carlo method 160</p> <p>5.9 A small software framework for pricing options 161</p> <p>5.10 Summary and conclusions 162</p> <p>5.11 Exercises and projects 162</p> <p><b>6 Advanced Finance Models and Numerical Methods 167</b></p> <p>6.1 Introduction and objectives 167</p> <p>6.2 Processes with jumps 168</p> <p>6.3 Levy processes 171</p> <p>6.4 Measuring the order of convergence 172</p> <p>6.5 Mollifiers, bump functions and function regularisation 176</p> <p>6.6 When Monte Carlo does not work: counterexamples 177</p> <p>6.7 Approximating SDEs using strong Taylor, explicit and implicit schemes 179</p> <p>6.8 Summary and conclusions 183</p> <p>6.9 Exercises and projects 184</p> <p><b>7 Foundations of the Monte Carlo Method 189</b></p> <p>7.1 Introduction and objectives 189</p> <p>7.2 Basic probability 189</p> <p>7.3 The Law of Large Numbers 190</p> <p>7.4 The Central Limit Theorem 191</p> <p>7.5 Quasi Monte Carlo methods 194</p> <p>7.6 Summary and conclusions 198</p> <p>7.7 Exercises and projects 198</p> <p><b>PART II DESIGN PATTERNS</b></p> <p><b>8 Architectures and Frameworks for Monte Carlo Methods: Overview 203</b></p> <p>8.1 Goals of Part II of this book 203</p> <p>8.2 Introduction and objectives of this chapter 203</p> <p>8.3 The advantages of domain architectures 204</p> <p>8.4 Software Architectures for the Monte Carlo method 207</p> <p>8.5 Summary and conclusions 212</p> <p>8.6 Exercises and projects 213</p> <p><b>9 System Decomposition and System Patterns 217</b></p> <p>9.1 Introduction and objectives 217</p> <p>9.2 Software development process; a critique 217</p> <p>9.3 System decomposition, from concept to code 217</p> <p>9.4 Decomposition techniques, the process 220</p> <p>9.5 Whole-part 222</p> <p>9.6 Whole-part decomposition; the process 223</p> <p>9.7 Presentation-Abstraction Control (PAC) 226</p> <p>9.8 Building complex objects and configuring applications 229</p> <p>9.9 Summary and conclusions 239</p> <p>9.10 Exercises and projects 239</p> <p><b>10 Detailed Design using the GOF Patterns 243</b></p> <p>10.1 Introduction and objectives 243</p> <p>10.2 Discovering which patterns to use 244</p> <p>10.3 An overview of the GOF patterns 255</p> <p>10.4 The essential structural patterns 257</p> <p>10.5 The essential creational patterns 266</p> <p>10.6 The essential behavioural patterns 270</p> <p>10.7 Summary and conclusions 276</p> <p>10.8 Exercises and projects 276</p> <p><b>11 Combining Object-Oriented and Generic Programming Models 281</b></p> <p>11.1 Introduction and objectives 281</p> <p>11.2 Using templates to implement components: overview 281</p> <p>11.3 Templates versus inheritance, run-time versus compile-time 283</p> <p>11.4 Advanced C++ templates 286</p> <p>11.5 Traits and policy-based design 294</p> <p>11.6 Creating templated design patterns 306</p> <p>11.7 A generic <i>Singleton</i> pattern 307</p> <p>11.8 Generic composite structures 310</p> <p>11.9 Summary and conclusions 314</p> <p>11.10 Exercises and projects 314</p> <p><b>12 Data Structures and their Application to the Monte Carlo Method 319</b></p> <p>12.1 Introduction and objectives 319</p> <p>12.2 Arrays, vectors and matrices 319</p> <p>12.3 Compile-time vectors and matrices 324</p> <p>12.4 Creating adapters for STL containers 331</p> <p>12.5 Date and time classes 334</p> <p>12.6 The class string 339</p> <p>12.7 Modifying strings 343</p> <p>12.8 A final look at the generic composite 345</p> <p>12.9 Summary and conclusions 348</p> <p>12.10 Exercises and projects 348</p> <p><b>13 The Boost Library: An Introduction 353</b></p> <p>13.1 Introduction and objectives 353</p> <p>13.2 A taxonomy of C++ pointer types 353</p> <p>13.3 Modelling homogeneous and heterogeneous data in Boost 361</p> <p>13.4 Boost signals: notification and data synchronisation 367</p> <p>13.5 Input and output 368</p> <p>13.6 Linear algebra and uBLAS 371</p> <p>13.7 Date and time 372</p> <p>13.8 Other libraries 372</p> <p>13.9 Summary and conclusions 374</p> <p>13.10 Exercises and projects 374</p> <p><b>PART III ADVANCED APPLICATIONS</b></p> <p><b>14 Instruments and Payoffs 379</b></p> <p>14.1 Introduction and objectives 379</p> <p>14.2 Creating a C++ instrument hierarchy 379</p> <p>14.3 Modelling payoffs in C++ 383</p> <p>14.4 Summary and conclusions 392</p> <p>14.5 Exercises and projects 393</p> <p><b>15 Path-Dependent Options 395</b></p> <p>15.1 Introduction and objectives 395</p> <p>15.2 Monte Carlo – a simple general-purpose version 396</p> <p>15.3 Asian options 401</p> <p>15.4 Options on the running Max/Min 411</p> <p>15.5 Barrier options 412</p> <p>15.6 Lookback options 418</p> <p>15.7 Cliquet Options 422</p> <p>15.8 Summary and conclusions 424</p> <p>15.9 Exercises and projects 424</p> <p><b>16 Affine Stochastic Volatility Models 427</b></p> <p>16.1 Introduction and objectives 427</p> <p>16.2 The volatility skew/smile 427</p> <p>16.3 The Heston model 429</p> <p>16.4 The Bates/SVJ model 441</p> <p>16.5 Implementing the Bates model 443</p> <p>16.6 Numerical results – European options 444</p> <p>16.7 Numerical results – skew-dependent options 446</p> <p>16.8 XLL – using DLL within Microsoft Excel 449</p> <p>16.9 Analytic solutions for affine stochastic volatility models 455</p> <p>16.10 Summary and conclusions 457</p> <p>16.11 Exercises and projects 458</p> <p><b>17 Multi-Asset Options 461</b></p> <p>17.1 Introduction and objectives 461</p> <p>17.2 Modelling in multiple dimensions 461</p> <p>17.3 Implementing payoff classes for multi-asset options 465</p> <p>17.4 Some multi-asset options 466</p> <p>17.5 Basket options 469</p> <p>17.6 Min/Max options 471</p> <p>17.7 Mountain range options 475</p> <p>17.8 The Heston model in multiple dimensions 480</p> <p>17.9 Equity interest rate hybrids 482</p> <p>17.10 Summary and conclusions 486</p> <p>17.11 Exercises and projects 486</p> <p><b>18 Advanced Monte Carlo I – Computing Greeks 489</b></p> <p>18.1 Introduction and objectives 489</p> <p>18.2 The finite difference method 489</p> <p>18.3 The pathwise method 492</p> <p>18.4 The likelihood ratio method 497</p> <p>18.5 Likelihood ratio for finite differences – proxy simulation 503</p> <p>18.6 Summary and conclusions 504</p> <p>18.7 Exercises and projects 506</p> <p><b>19 Advanced Monte Carlo II – Early Exercise 511</b></p> <p>19.1 Introduction and objectives 511</p> <p>19.2 Description of the problem 511</p> <p>19.3 Pricing American options by regression 512</p> <p>19.4 C++ design 513</p> <p>19.5 Linear least squares regression 516</p> <p>19.6 Example – step by step 520</p> <p>19.7 Analysis of the method and improvements 521</p> <p>19.8 Upper bounds 525</p> <p>19.9 Examples 527</p> <p>19.10 Summary and conclusions 528</p> <p>19.11 Exercises and projects 528</p> <p><b>20 Beyond Brownian Motion 531</b></p> <p>20.1 Introduction and objectives 531</p> <p>20.2 Normal mean variance mixture models 531</p> <p>20.3 The multi-dimensional case 536</p> <p>20.4 Summary and conclusions 536</p> <p>20.5 Exercises and projects 538</p> <p><b>PART IV SUPPLEMENTS</b></p> <p><b>21</b> <b>C</b>++ <b>Application Optimisation and Performance Improvement 543</b></p> <p>21.1 Introduction and objectives 543</p> <p>21.2 Modelling functions in C++: choices and consequences 543</p> <p>21.3 Performance issues in C++: classifying potential bottlenecks 552</p> <p>21.4 Temporary objects 560</p> <p>21.5 Special features in the Boost library 562</p> <p>21.6 Boost multiarray library 563</p> <p>21.7 Boost random number library 564</p> <p>21.8 STL and Boost smart pointers: final remarks 566</p> <p>21.9 Summary and conclusions 568</p> <p>21.10 Exercises, projects and guidelines 569</p> <p><b>22 Random Number Generation and Distributions 571</b></p> <p>22.1 Introduction and objectives 571</p> <p>22.2 Uniform number generation 571</p> <p>22.3 The Sobol class 578</p> <p>22.4 Number generation due to given distributions 580</p> <p>22.5 Jump processes 588</p> <p>22.6 The random generator templates 593</p> <p>22.7 Tests for randomness 596</p> <p>22.8 Summary and conclusions 596</p> <p>22.9 Exercises and projects 597</p> <p><b>23 Some Mathematical Background 601</b></p> <p>23.1 Introduction and objectives 601</p> <p>23.2 A matrix class 601</p> <p>23.3 Matrix functions 601</p> <p>23.4 Functional analysis 608</p> <p>23.5 Applications to option pricing 610</p> <p>23.6 Summary and conclusions 614</p> <p>23.7 Exercises and projects 614</p> <p><b>24 An Introduction to Multi-threaded and Parallel Programming 617</b></p> <p>24.1 Introduction and objectives 617</p> <p>24.2 Shared memory models 617</p> <p>24.3 Sequential, concurrent and parallel programming 101 619</p> <p>24.4 How fast is fast? Performance analysis of parallel programs 623</p> <p>24.5 An introduction to processes and threads 625</p> <p>24.6 What kinds of applications are suitable for multi-threading? 626</p> <p>24.7 The multi-threaded application lifecycle 627</p> <p>24.8 Some model architectures 629</p> <p>24.9 Analysing and designing large software systems: a summary of the steps 633</p> <p>24.10 Conclusions and summary 634</p> <p>24.11 Exercises and projects 634</p> <p><b>25 An Introduction to OpenMP and its Applications to the Monte Carlo Method 637</b></p> <p>25.1 Introduction and objectives 637</p> <p>25.2 Loop optimisation 637</p> <p>25.3 An overview of OpenMP 644</p> <p>25.4 Threads in OpenMP 644</p> <p>25.5 Loop-level parallelism 646</p> <p>25.6 Data sharing 646</p> <p>25.7 Work-sharing and parallel regions 651</p> <p>25.8 Nested loop optimisation 654</p> <p>25.9 Scheduling in OpenMP 656</p> <p>25.10 OpenMP for the Monte Carlo method 657</p> <p>25.11 Conclusions and summary 661</p> <p>25.12 Exercises and projects 661</p> <p><b>26 A Case Study of Numerical Schemes for the Heston Model 665</b></p> <p>26.1 Introduction and objectives 665</p> <p>26.2 Test scenarios 666</p> <p>26.3 Numerical approximations for the Heston model 667</p> <p>26.4 Testing different schemes and scenarios 672</p> <p>26.5 Results 675</p> <p>26.6 Lessons learned 678</p> <p>26.7 Extensions, calibration and more 679</p> <p>26.8 Other numerical methods for Heston 680</p> <p>26.9 Summary and conclusions 681</p> <p>26.10 Exercises and projects 681</p> <p><b>27 Excel, C</b>++ <b>and Monte Carlo Integration 685</b></p> <p>27.1 Introduction and objectives 685</p> <p>27.2 Integrating applications and Excel 686</p> <p>27.3 ATL architecture 686</p> <p>27.4 Creating my first ATL project: the steps 693</p> <p>27.5 Creating automation add-ins in Excel 695</p> <p>27.6 Useful utilities and interoperability projects 696</p> <p>27.7 Test Case: a COM add-in and complete code 697</p> <p>27.8 Summary and conclusions 707</p> <p>27.9 Exercises and projects 707</p> <p><b>References 711</b></p> <p><b>Index 719</b></p>
<b>DANIEL J. DUFFY</b> has been working with numerical methods in finance, industry and engineering since 1979. He has written four books on financial models and numerical methods and C++ for computational finance and he has also developed a number of new schemes for this field. He is the founder of Datasim Education and has a PhD in Numerical Analysis from <st1:PlaceName w:st="on">Trinity</st1:PlaceName> <st1:PlaceType w:st="on">College</st1:PlaceType>, <st1:City w:st="on"><st1:place w:st="on">Dublin</st1:place></st1:City>. <p/> <b>JÖRG KIENITZ</b> is the head of Quantitative Analysis at Deutsche Postbank AG. He is primarily involved in the developing and implementation of models for pricing of complex derivatives structures and for asset allocation. He is also lecturing at university level on advanced financial modelling and gives courses on ‘Applications of Monte Carlo Methods in Finance’ and on other financial topics including Lévy processes and interest rate models. Joerg holds a Ph.D. in stochastic analysis and probability theory.
The Monte Carlo method is now acknowledged as being one of the most robust tools for a range of applications in finance, from option pricing to risk management and optimization. One of the best languages for the development of Monte Carlo applications and frameworks is C++, an object-oriented and generic programming language which is also an industry standard. <p>This is one of the first books that describe all the steps that are needed in order to analyze, design and implement Monte Carlo applications. It discusses the financial theory as well as the mathematical and numerical background that is needed to write flexible and efficient C++ code using state-of-the-art design and system patterns, object-oriented and generic programming models in combination with standard libraries and tools.</p> <p>The book is divided into four parts, each one dealing with one major aspect of the current problem domain. The features and topics are:</p> <ul> <li>Option pricing for a range of one-factor and n-factor models;</li> <li>European, Asian, baskets, Heston, jump models;</li> <li>Early exercises, calculating option sensitivities;</li> <li>The mathematical theory of n-factor Stochastic Differential Equations (SDE);</li> <li>An introduction to the numerical analysis of SDE;</li> <li>Modelling SDE and the Finite Difference Method (FDM) in C++;</li> <li>Applying design and system patterns (GOF, POSA) for improved design;</li> <li>Extensive use of the STL and boost libraries;</li> <li>Multi-threading and parallel programming (OpenMP) techniques for Monte Carlo;</li> <li>Creating Excel-based applications using xlw, Automation and COM;</li> <li>Extra discussion of mathematical foundations for Monte Carlo;</li> <li>Working source code is provided along with numerous examples, exercises and projects related to the extension of the C++ framework.</li> </ul> <p>The book is accompanied by a CD which contains the source code for all the examples. It is strongly advised that you experiment with the code by compiling it and extending it to suit your needs. Support is offered via a user forum on www.datasimfinancial.com where you can post queries and communicate with other purchasers of the book.</p>

Diese Produkte könnten Sie auch interessieren:

Mindfulness
Mindfulness
von: Gill Hasson
PDF ebook
12,99 €
Counterparty Credit Risk, Collateral and Funding
Counterparty Credit Risk, Collateral and Funding
von: Damiano Brigo, Massimo Morini, Andrea Pallavicini
EPUB ebook
69,99 €