Modern Computational Finance
eBook - ePub

Modern Computational Finance

Scripting for Derivatives and xVA

Antoine Savine, Jesper Andreasen

Share book
  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Modern Computational Finance

Scripting for Derivatives and xVA

Antoine Savine, Jesper Andreasen

Book details
Book preview
Table of contents
Citations

About This Book

An incisive and essentialguide to building a complete system for derivative scripting

InVolume 2 of Modern Computational Finance Scripting for Derivatives and xVA, quantitative finance expertsand practitioners Drs. Antoine Savine and Jesper Andreasen deliver an indispensable and insightfulroadmap to the interrogation, aggregation, and manipulation of cash-flows in a variety of ways. The book demonstrates how to facilitate portfolio-wide risk assessment andregulatory calculations (like xVA).

Complete with a professional scripting library written in modern C++, this stand-alone volumewalks readers through the construction of a comprehensiverisk and valuationtool.Thisessentialbook also offers:

  • Effective strategies for improving scripting libraries, from basic examples—likesupport for dates and vectors—to advanced improvements, including American Monte Carlo techniques
  • Exploration of the concepts of fuzzy logic and risk sensitivities, including support for smoothing and condition domains
  • Discussion of the application of scripting to xVA, complete with a full treatment of branching

Perfect for quantitative analysts, risk professionals, system developers, derivatives traders, and financial analysts, Modern Computational Finance Scripting for Derivatives and xVA: Volume 2is also amust-read resourcefor students and teachers inmaster'sand PhD finance programs.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Modern Computational Finance an online PDF/ePUB?
Yes, you can access Modern Computational Finance by Antoine Savine, Jesper Andreasen in PDF and/or ePUB format, as well as other popular books in Matemáticas & Matemática aplicada. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Wiley
Year
2021
ISBN
9781119540793

PART I
A Scripting Library in C++

Introduction

This part leads readers through the development steps of the scripting library provided in our source repository.
A transaction consists of a number of events occurring on given dates in the future. This is where a payment or coupon is fixed, a discrete barrier is monitored, or an exercise takes place. This is also where a path‐dependency is updated with reference to the simulated variables on that future date.1 Future dates when such events take place are called event dates.
As an illustration, we consider a simplified version of the popular autocallable transaction. It pays a high coupon (say 10%) if some index (say S&P500) increased during the first year of its life. In this case, it pays the notional redemption together with the coupon of 10% and terminates at the end of year 1. Otherwise, it may still deliver a 20% coupon (10% per annum) at the end of year 2 provided the index overall increased over the two years. In this case, it repays the notional together with the 20% coupon and terminates at the end of year 2. If not, it is given a last chance on year 3, provided the underlying index increased over the three years. If this is the case, the investor receives the redemption + 30% at the end of year 3. If not, only 50% of the notional is repaid. It is easy to see that the investor implicitly sells a (somewhat exotic) option on what may appear as a low probability event (index decreasing over one, two, and three years) in exchange for a high coupon in a low‐yield environment, which explains the success of this structure.2 This product may be scripted as follows (say today is 1 June 2020)3:
01Jun2020 vRef=spot()
vAlive=1
01Jun2021 if spot() > vRef then
prd=110
vAlive=0
endIf
01Jun2022 if spot() > vRef then
if vAlive=1 then prd=120 endIf
vAlive=0
endIf
01Jun2023 if vAlive=1 then
if spot() > vRef then prd=130 else prd=50 endIf
endIf
We have four events on four event dates:
  1. Today, we set the reference to the current spot level and initialize the alive status to 1.
  2. Year 1, we check whether the spot increased, in which case we pay redemption + 10% and die.
  3. Year 2, we check that the spot overall increased over two years. In this case, provided we survived year 1, we pay redemption + 20% and die.
  4. Year 3, provided we survived the first two, we check if the spot overall increased. In this case we pay redemption + 30%. If not, we repay 50% of the notional.
We see that our language must at the very minimum support numbers, arithmetic operations, and conditional statements. We know we also need some mathematical functions like
images
or
images
and some financial functions such as a multi‐argument
images
and
images
. Critically, we must be able to read, write, and compare variables and access the simulated market with a spot() keyword that references the fixing of the underlying asset on the corresponding event date. This is a simple language, similar to Python, that supports only the constructs necessary for the description of financial cash‐flows, for which it provides some specific keywords.
The language considers as a variable anything that starts with a letter and is not otherwise a keyword. We used the variables
images
,
images
, and
images
in our example. Evidently, ancillary variable names don't have to start with the letter V; this is only for clarity.
Products are variables. The language makes no difference between products and ancilla...

Table of contents