C# for Financial Markets
Gebonden Engels 2013 9780470030080Samenvatting
A practice–oriented guide to using C# to design and program pricing and trading models
In this step–by–step guide to software development for financial analysts, traders, developers and quants, the authors show both novice and experienced practitioners how to develop robust and accurate pricing models and employ them in real environments. Traders will learn how to design and implement applications for curve and surface modeling, fixed income products, hedging strategies, plain and exotic option modeling, interest rate options, structured bonds, unfunded structured products, and more. A unique mix of modern software technology and quantitative finance, this book is both timely and practical. The approach is thorough and comprehensive and the authors use a combination of C# language features, design patterns, mathematics and finance to produce efficient and maintainable software.
Designed for quant developers, traders and MSc/MFE students, each chapter has numerous exercises and the book is accompanied by a dedicated companion website, http://www.datasimfinancial.com/forum/viewforum.php?f=196&sid=f30022095850dee48c7db5ff62192b34, providing all source code, alongside audio, support and discussion forums for readers to comment on the code and obtain new versions of the software.
Specificaties
Lezersrecensies
Inhoudsopgave
<p>List of Tables xxv</p>
<p>Introduction 1</p>
<p>0.1 What Is This Book? 1</p>
<p>0.2 Special Features in This Book 1</p>
<p>0.3 Who Is This Book for and What Do You Learn? 2</p>
<p>0.4 Structure of This Book 2</p>
<p>0.5 C# Source Code 3</p>
<p>1 Global Overview of the Book 5</p>
<p>1.1 Introduction and Objectives 5</p>
<p>1.2 Comparing C# and C++ 5</p>
<p>1.3 Using This Book 6</p>
<p>2 C# Fundamentals 9</p>
<p>2.1 Introduction and Objectives 9</p>
<p>2.2 Background to C# 9</p>
<p>2.3 Value Types, Reference Types and Memory Management 10</p>
<p>2.4 Built–in Data Types in C# 10</p>
<p>2.5 Character and String Types 12</p>
<p>2.6 Operators 13</p>
<p>2.7 Console Input and Output 14</p>
<p>2.8 User–defined Structs 15</p>
<p>2.9 Mini Application: Option Pricing 16</p>
<p>2.10 Summary and Conclusions 21</p>
<p>2.11 Exercises and Projects 22</p>
<p>3 Classes in C# 25</p>
<p>3.1 Introduction and Objectives 25</p>
<p>3.2 The Structure of a Class: Methods and Data 25</p>
<p>3.3 The Keyword this 28</p>
<p>3.4 Properties 28</p>
<p>3.5 Class Variables and Class Methods 30</p>
<p>3.6 Creating and Using Objects in C# 33</p>
<p>3.7 Example: European Option Price and Sensitivities 33</p>
<p>3.8 Enumeration Types 40</p>
<p>3.9 Extension Methods 42</p>
<p>3.10 An Introduction to Inheritance in C# 44</p>
<p>3.11 Example: Two–factor Payoff Hierarchies and Interfaces 46</p>
<p>3.12 Exception Handling 50</p>
<p>3.13 Summary and Conclusions 50</p>
<p>3.14 Exercises and Projects 51</p>
<p>4 Classes and C# Advanced Features 53</p>
<p>4.1 Introduction and Objectives 53</p>
<p>4.2 Interfaces 53</p>
<p>4.3 Using Interfaces: Vasicek and Cox–Ingersoll–Ross (CIR) Bond and Option Pricing 54</p>
<p>4.4 Interfaces in .NET and Some Advanced Features 61</p>
<p>4.5 Combining Interfaces, Inheritance and Composition 67</p>
<p>4.6 Introduction to Delegates and Lambda Functions 72</p>
<p>4.7 Lambda Functions and Anonymous Methods 76</p>
<p>4.8 Other Features in C# 77</p>
<p>4.9 Advanced .NET Delegates 80</p>
<p>4.10 The Standard Event Pattern in .NET and the Observer Pattern 87</p>
<p>4.11 Summary and Conclusions 91</p>
<p>4.12 Exercises and Projects 92</p>
<p>5 Data Structures and Collections 97</p>
<p>5.1 Introduction and Objectives 97</p>
<p>5.2 Arrays 97</p>
<p>5.3 Dates, Times and Time Zones 101</p>
<p>5.4 Enumeration and Iterators 105</p>
<p>5.5 Object–based Collections and Standard Collection Interfaces 107</p>
<p>5.6 The List Class 109</p>
<p>5.7 The Hashtable Class 110</p>
<p>5.8 The Dictionary<Key, Value> Class 111</p>
<p>5.9 The HashSet Classes 112</p>
<p>5.10 BitArray: Dynamically Sized Boolean Lists 114</p>
<p>5.11 Other Data Structures 114</p>
<p>5.12 Strings and StringBuilder 117</p>
<p>5.13 Some new Features in .NET 4.0 120</p>
<p>5.14 Summary and Conclusions 123</p>
<p>5.15 Exercises and Projects 123</p>
<p>6 Creating User–defined Data Structures 125</p>
<p>6.1 Introduction and Objectives 125</p>
<p>6.2 Design Rationale and General Guidelines 125</p>
<p>6.3 Arrays and Matrices 131</p>
<p>6.4 Vectors and Numeric Matrices 135</p>
<p>6.5 Higher–dimensional Structures 139</p>
<p>6.6 Sets 140</p>
<p>6.7 Associative Arrays and Matrices 142</p>
<p>6.8 Standardisation: Interfaces and Constraints 145</p>
<p>6.9 Using Associative Arrays and Matrices to Model Lookup Tables 152</p>
<p>6.10 Tuples 155</p>
<p>6.11 Summary and Conclusions 156</p>
<p>6.12 Exercises and Projects 156</p>
<p>7 An Introduction to Bonds and Bond Pricing 159</p>
<p>7.1 Introduction and Objectives 159</p>
<p>7.2 Embedded Optionality 160</p>
<p>7.3 The Time Value of Money: Fundamentals 160</p>
<p>7.4 Measuring Yield 166</p>
<p>7.5 Macauley Duration and Convexity 167</p>
<p>7.6 Dates and Date Schedulers for Fixed Income Applications 168</p>
<p>7.7 Exporting Schedulers to Excel 176</p>
<p>7.8 Other Examples 177</p>
<p>7.9 Pricing Bonds: An Extended Design 178</p>
<p>7.10 Summary and Conclusions 181</p>
<p>7.11 Exercises and Projects 181</p>
<p>8 Data Management and Data Lifecycle 185</p>
<p>8.1 Introduction and Objectives 185</p>
<p>8.2 Data Lifecycle in Trading Applications 185</p>
<p>8.3 An Introduction to Streams and I/O 186</p>
<p>8.4 File and Directory Classes 195</p>
<p>8.5 Serialisation Engines in .NET 199</p>
<p>8.6 The Binary Serialiser 203</p>
<p>8.7 XML Serialisation 204</p>
<p>8.8 Data Lifetime Management in Financial and Trading Applications 209</p>
<p>8.9 Summary and Conclusions 213</p>
<p>8.10 Exercises and Projects 213</p>
<p>9 Binomial Method, Design Patterns and Excel Output 215</p>
<p>9.1 Introduction and Objectives 215</p>
<p>9.2 Design of Binomial Method 216</p>
<p>9.3 Design Patterns and Classes 217</p>
<p>9.4 Early Exercise Features 232</p>
<p>9.5 Computing Hedge Sensitivities 233</p>
<p>9.6 Multi–dimensional Binomial Method 233</p>
<p>9.7 Improving Performance Using Pad´e Rational Approximants 236</p>
<p>9.8 Summary and Conclusions 238</p>
<p>9.9 Projects and Exercises 238</p>
<p>10 Advanced Lattices and Finite Difference Methods 241</p>
<p>10.1 Introduction and Objectives 241</p>
<p>10.2 Trinomial Model of the Asset Price and Its C# Implementation 241</p>
<p>10.3 Stability and Convergence of the Trinomial Method 246</p>
<p>10.4 The Black–Scholes Partial Differential Equation and Explicit Schemes 246</p>
<p>10.5 Implementing Explicit Schemes in C# 247</p>
<p>10.6 Stability of the Explicit Finite Difference Scheme 252</p>
<p>10.7 An Introduction to the Alternating Direction Explicit Method (ADE) 255</p>
<p>10.8 Implementing ADE for the Black–Scholes PDE 258</p>
<p>10.9 Testing the ADE Method 262</p>
<p>10.10 Advantages of the ADE Method 263</p>
<p>10.11 Summary and Conclusions 263</p>
<p>10.12 Appendix: ADE Numerical Experiments 263</p>
<p>10.13 Exercises and Projects 268</p>
<p>11 Interoperability: Namespaces, Assemblies and C++/CLI 271</p>
<p>11.1 Introduction and Objectives 271</p>
<p>11.2 Namespaces 271</p>
<p>11.3 An Introduction to Assemblies 273</p>
<p>11.4 Reflection and Metadata 276</p>
<p>11.5 C# and Native C++ Interoperability: How Is That Possible? 289</p>
<p>11.6 Using C# from C++ 293</p>
<p>11.7 Code Generation Using the Reflection API 298</p>
<p>11.8 Application Domains 304</p>
<p>11.9 Summary and Conclusions 309</p>
<p>11.10 Exercises and Projects 309</p>
<p>12 Bond Pricing: Design, Implementation and Excel Interfacing 311</p>
<p>12.1 Introduction and Objectives 311</p>
<p>12.2 High–level Design of Bond Pricing Problem 311</p>
<p>12.3 Bond Scheduling 312</p>
<p>12.4 Bond Functionality and Class Hierarchies 313</p>
<p>12.5 Calculating Price, Yield and Discount Factors: MathTools 317</p>
<p>12.6 Data Presentation and Excel Interop 319</p>
<p>12.7 Bond Data Management 321</p>
<p>12.8 Using the Excel Files 324</p>
<p>12.9 Summary and Conclusions 328</p>
<p>12.10 Exercises and Projects 328</p>
<p>13 Interpolation Methods in Interest Rate Applications 335</p>
<p>13.1 Introduction and Objectives 335</p>
<p>13.2 Interpolation and Curve Building: Basic Formula for Interpolator Tests 335</p>
<p>13.3 Types of Curve Shape 337</p>
<p>13.4 An Overview of Interpolators 338</p>
<p>13.5 Background to Interpolation 339</p>
<p>13.6 Approximation of Function Derivatives 341</p>
<p>13.7 Linear and Cubic Spline Interpolation 342</p>
<p>13.8 Positivity–preserving Cubic Interpolations: Dougherty/Hyman and Hussein 344</p>
<p>13.9 The Akima Method 348</p>
<p>13.10 Hagan–West Approach 349</p>
<p>13.11 Global Interpolation 350</p>
<p>13.12 Bilinear Interpolation 352</p>
<p>13.13 Some General Guidelines, Hints and Tips 355</p>
<p>13.14 Using the Interpolators and Test Examples 357</p>
<p>13.15 Summary and Conclusions 367</p>
<p>13.16 Exercises and Projects 367</p>
<p>14 Short Term Interest Rate (STIR) Futures and Options 369</p>
<p>14.1 Introduction and Objectives 369</p>
<p>14.2 An Overview of Cash Money Markets 370</p>
<p>14.3 Sources of Risk in Money Market Transactions 370</p>
<p>14.4 Reference Rate and Fixings 371</p>
<p>14.5 STIR Futures 371</p>
<p>14.6 Pricing STIR Options 374</p>
<p>14.7 Generating International Monetary Market (IMM) Dates 378</p>
<p>14.8 List STIR Futures and STIR Futures Options 384</p>
<p>14.9 Putting It All Together: STIR versus OTC from a Trader s Perspective 387</p>
<p>14.10 Summary and Conclusions 389</p>
<p>14.11 Exercises and Projects 389</p>
<p>15 Single–curve Building 393</p>
<p>15.1 Introduction and Objectives 393</p>
<p>15.2 Starting Definitions and Overview of Curve Building Process 393</p>
<p>15.3 Building Blocks 395</p>
<p>15.4 Introduction to Interest Rate Swap 397</p>
<p>15.5 The Curve Construction Mechanism 403</p>
<p>15.6 Code Design and Implementation 406</p>
<p>15.7 Console Examples 418</p>
<p>15.8 Summary and Conclusions 426</p>
<p>15.9 Exercises and Projects 427</p>
<p>15.10 Appendix: Types of Swaps 429</p>
<p>16 Multi–curve Building 431</p>
<p>16.1 Introduction and Objectives 431</p>
<p>16.2 The Consequences of the Crisis on Interest Rate Derivatives Valuation 431</p>
<p>16.3 Impact of Using OIS Discounting 436</p>
<p>16.4 The Bootstrapping Process Using Two Curves: Description of the Mechanism 437</p>
<p>16.5 Sensitivities 438</p>
<p>16.6 How to Organise the Code: A Possible Solution 439</p>
<p>16.7 Putting it Together, Working Examples 445</p>
<p>16.8 Summary and Conclusions 453</p>
<p>16.9 Exercises and Projects 453</p>
<p>16.10 Appendix: Par Asset Swap Spread and Zero Volatility Spread 455</p>
<p>17 Swaption, Cap and Floor 459</p>
<p>17.1 Introduction and Objectives: A Closed Formula World 459</p>
<p>17.2 Description of Instruments and Formulae 459</p>
<p>17.3 Multi–curve Framework on Cap, Floor and Swaption 467</p>
<p>17.4 Bootstrapping Volatility for Cap and Floor 469</p>
<p>17.5 How to Organise the Code in C#: A Possible Solution 474</p>
<p>17.6 Console and Excel Working Examples 481</p>
<p>17.7 Summary and Conclusions 490</p>
<p>17.8 Exercise and Discussion 491</p>
<p>18 Software Architectures and Patterns for Pricing Applications 493</p>
<p>18.1 Introduction and Objectives 493</p>
<p>18.2 An Overview of the GOF Pattern 494</p>
<p>18.3 Creational Patterns 496</p>
<p>18.4 Builder Pattern 496</p>
<p>18.5 Structural Patterns 499</p>
<p>18.6 Behavioural Patterns 500</p>
<p>18.7 Builder Application Example: Calibration Algorithms for Cap and Floor 502</p>
<p>18.8 A PDE/FDM Patterns–based Framework for Equity Options 504</p>
<p>18.9 Using Delegates to Implement Behavioural Design Patterns 509</p>
<p>18.10 A System Design for Monte Carlo Applications 510</p>
<p>18.11 Dynamic Programming in .NET 513</p>
<p>18.12 Summary and Conclusions 516</p>
<p>18.13 Exercises and Projects 517</p>
<p>19 LINQ (Language Integrated Query) and Fixed Income Applications 523</p>
<p>19.1 Introduction and Objectives 523</p>
<p>19.2 Scope of Chapter and Prerequisites 523</p>
<p>19.3 LINQ Query Operators 524</p>
<p>19.4 LINQ Queries and Initial Examples 526</p>
<p>19.5 Advanced Queries 531</p>
<p>19.6 A Numerical Example 533</p>
<p>19.7 Join and GroupJoin 535</p>
<p>19.8 Examples in Fixed Income Applications 540</p>
<p>19.9 LINQ and Excel Interoperability 549</p>
<p>19.10 Summary and Conclusions 557</p>
<p>19.11 Exercises and Projects 557</p>
<p>20 Introduction to C# and Excel Integration 561</p>
<p>20.1 Introduction and Objectives 561</p>
<p>20.2 Excel Object Model 561</p>
<p>20.3 Using COM Technology in .NET 561</p>
<p>20.4 Primary Interop Assemblies (PIA) 563</p>
<p>20.5 Standalone Applications 564</p>
<p>20.6 Types of Excel Add–ins 566</p>
<p>20.7 The IDTExtensibility2 Interface and COM/.NET Interoperability 569</p>
<p>20.8 Data Visualisation in Excel 570</p>
<p>20.9 Conclusion and Summary 578</p>
<p>20.10 Exercises and Projects 579</p>
<p>21 Excel Automation Add–ins 581</p>
<p>21.1 Introduction and Objectives 581</p>
<p>21.2 COM Overview 581</p>
<p>21.3 Creating Automation Add–ins: The Steps 583</p>
<p>21.4 Example: Creating a Calculator, Version 1 585</p>
<p>21.5 Example: Creating a Calculator, Version 2 588</p>
<p>21.6 Versioning 590</p>
<p>21.7 Working with Ranges 590</p>
<p>21.8 Volatile Methods 590</p>
<p>21.9 Optional Parameters 591</p>
<p>21.10 Using VBA with Automation Add–ins 592</p>
<p>21.11 Summary and Conclusions 593</p>
<p>21.12 Exercises and Projects 594</p>
<p>22 C# and Excel Integration COM Add–ins 595</p>
<p>22.1 Introduction and Objectives 595</p>
<p>22.2 Preparations for COM Add–ins 595</p>
<p>22.3 The Interface IDTExtensibility2 596</p>
<p>22.4 Creating COM Add–ins: The Steps 596</p>
<p>22.5 Utility Code and Classes 597</p>
<p>22.6 Using Windows Forms 600</p>
<p>22.7 Example: Creating a COM Add–in 601</p>
<p>22.8 Debugging and Troubleshooting 603</p>
<p>22.9 An Introduction to Excel–DNA 603</p>
<p>22.10 Excel COM Interoperability and Rate Multi–curve 615</p>
<p>22.11 Conclusion and Summary 622</p>
<p>22.12 Exercises and Projects 622</p>
<p>23 Real–time Data (RTD) Server 625</p>
<p>23.1 Introduction and Objectives 625</p>
<p>23.2 Real–time Data in Excel: Overview 625</p>
<p>23.3 Real–time Data Function 626</p>
<p>23.4 Example 627</p>
<p>23.5 The Topic Class and Data 629</p>
<p>23.6 Creating an RTD Server 631</p>
<p>23.7 Using the RTD Server 631</p>
<p>23.8 Testing and Troubleshooting the RTD Server 632</p>
<p>23.9 Conclusion and Summary 632</p>
<p>23.10 Exercises and Projects 632</p>
<p>24 Introduction to Multi–threading in C# 635</p>
<p>24.1 Introduction and Objectives 635</p>
<p>24.2 Processes 636</p>
<p>24.3 Using ProcessStartInfo to Redirect Process I/O 637</p>
<p>24.4 An Introduction to Threads in C# 638</p>
<p>24.5 Passing Data to a Thread and between Threads 641</p>
<p>24.6 Thread States and Thread Lifecycle 644</p>
<p>24.7 Thread Priority 650</p>
<p>24.8 Thread Pooling 651</p>
<p>24.9 Atomic Operations and the Interlocked Class 652</p>
<p>24.10 Exception Handling 653</p>
<p>24.11 Multi–threaded Data Structures 654</p>
<p>24.12 A Simple Example of Traditional Multi–threading 659</p>
<p>24.13 Summary and Conclusions 661</p>
<p>24.14 Exercises and Projects 661</p>
<p>25 Advanced Multi–threading in C# 665</p>
<p>25.1 Introduction and Objectives 665</p>
<p>25.2 Thread Safety 666</p>
<p>25.3 Locking Mechanisms for Objects and Classes 667</p>
<p>25.4 Mutex and Semaphore 673</p>
<p>25.5 Notification and Signalling 676</p>
<p>25.6 Asynchronous Delegates 679</p>
<p>25.7 Synchronising Collections 681</p>
<p>25.8 Timers 682</p>
<p>25.9 Foreground and Background Threads 684</p>
<p>25.10 Executing Operations on Separate Threads: the BackgroundWorker Class 685</p>
<p>25.11 Parallel Programming in .NET 687</p>
<p>25.12 Task Parallel Library (TPL) 691</p>
<p>25.13 Concurrent Data Structures 694</p>
<p>25.14 Exception Handling 701</p>
<p>25.15 Shifting Curves 702</p>
<p>25.16 Summary and Conclusions 704</p>
<p>25.17 Exercises and Projects 704</p>
<p>26 Creating Multi–threaded and Parallel Applications for Computational Finance 707</p>
<p>26.1 Introduction and Objectives 707</p>
<p>26.2 Multi–threaded and Parallel Applications for Computational Finance 707</p>
<p>26.3 Fork and Join Pattern 709</p>
<p>26.4 Geometric Decomposition 711</p>
<p>26.5 Shared Data and Reader/Writer Locks: Multiple Readers and Multiple Writers 715</p>
<p>26.6 Monte Carlo Option Pricing and the Producer Consumer Pattern 719</p>
<p>26.7 The StopWatch Class 726</p>
<p>26.8 Garbage Collection and Disposal 727</p>
<p>26.9 Summary and Conclusions 730</p>
<p>26.10 Exercises and Projects 730</p>
<p>A1 Object–oriented Fundamentals 735</p>
<p>A2 Nonlinear Least–squares Minimisation 751</p>
<p>A3 The Mathematical Background to the Alternating Direction Explicit (ADE) Method 765</p>
<p>A4 Cap, Floor and Swaption Using Excel–DNA 789</p>
<p>Bibliography 805</p>
<p>Web References 812</p>
<p>Index 815</p>
Anderen die dit kochten, kochten ook
Rubrieken
- advisering
- algemeen management
- coaching en trainen
- communicatie en media
- economie
- financieel management
- inkoop en logistiek
- internet en social media
- it-management / ict
- juridisch
- leiderschap
- marketing
- mens en maatschappij
- non-profit
- ondernemen
- organisatiekunde
- personal finance
- personeelsmanagement
- persoonlijke effectiviteit
- projectmanagement
- psychologie
- reclame en verkoop
- strategisch management
- verandermanagement
- werk en loopbaan