Modern Computational Finance. Antoine Savine

Чтение книги онлайн.

Читать онлайн книгу Modern Computational Finance - Antoine Savine страница 9

Modern Computational Finance - Antoine Savine

Скачать книгу

of cash‐flows that lends itself to a scalable production of risk, back‐testing, capital assessment, value adjustments, or even middle office processing for portfolios of heterogeneous financial transactions. We also focus on performance and introduce the key notion of pre‐processing, whereby a script is automatically analyzed, prior to its valuation or risk, to optimize the upcoming calculations. Our framework provides a representation of the cash‐flows and a way of working with them that facilitates not only valuation but also pre‐processing and any kind of query or transformation that we may want to conduct on the cash‐flows of a set of transactions.

      The purpose of this publication is to provide a complete reference for the implementation of scripting and its application in derivatives systems to its full potential. The defining foundations of a well‐designed scripting library are described and illustrated with C++ code, available online on:

        https://github.com/asavine/Scripting/tree/Book-V1

      Readers will find significant differences between the repository code and the code printed in the book. The repository has been undergoing substantial modernization and performance improvements not covered in this edition of the text. Make sure you connect to the branch Book‐V1, not the master. Besides, the code base evolves throughout the book and the online repository contains the final version. It is advisable to type by hand the code printed in the text rather than rely on the online repository while reading the book.

      This code constitutes a self‐contained, professional implementation of scripting in C++. It is written in standard, modern C++ without any external dependency. It was tested to compile on Visual Studio 2017. The library is fully portable across financial libraries and platforms and includes an API, described in section 3.7, to communicate with any model.

      Our online repository also provides an implementation of Fuzzy Logic for automatic risk smoothing, an excel interface to the library, a tutorial for exporting C++ code to Excel, a prebuilt xll, and a demonstration spreadsheet.

      We discuss in part II the implementation of some basic extensions, and in part III more advanced features like interest rates and multiple currencies and assets. We discuss the key notion of indexing simulated data. Indexing is a special flavor of pre‐processing, crucial for performance. We also discuss the support for LSM, the regression‐based algorithm designed by Carriere and Longstaff‐Schwartz in [6] and [22] to deal with early exercise in the context of Monte‐Carlo simulations, and later reused in the industry in the context of xVA and other regulatory calculations. These parts include extensive guidance for the development of the extensions, but not source code.

      The rest of the publication describes some applications of scripting outside the strict domain of pricing and demonstrates that our framework, based on visitors, can resolve many other problems.

      Part IV shows how our framework can accommodate a systematic smoothing of discontinuities to resolve the problem of unstable risk sensitivities for products like digitals or barriers with Monte‐Carlo simulations. Smoothing consists of the approximation of the discontinuous payoffs by close continuous ones, like the approximation of digitals by tight call spreads. Bergomi discusses and optimizes smoothing in [4]. Our purpose is different. We demonstrate that smoothing can be abstracted as a particular application of fuzzy logic. This realization leads to an algorithm to systematically smooth not only digitals and barriers but also any payoff, automatically. The practical implementation of the algorithm is facilitated by the design of our scripting library. For clarity, the source code is not provided in the body of the text, but it is provided in our online repository.

      Part V introduces the application to xVA, which is further covered in our upcoming dedicated publication. The code for xVA calculations is not provided.

      Further, a CVA (similarly to other xVAs and other regulatory calculations) is a real option that a bank gives away any time it trades with a defaultable counterparty. That option is a put

Скачать книгу