Financial Cash-Flow Scripting: Beyond Valuation (Presentation Slides)
48 Pages Posted: 31 Dec 2018
Date Written: November 9, 2018
My life in scripting, by Jesper Andreasen
(A brief history of scripting for financial derivatives)
Antoine came to General Re Financial Products in London in 1998 with a lot of youthful spirit and many refreshing ideas. One of them was a financial payoff language called SynTech (Syntactic interpreter Technology). I am not sure that I was immediately convinced but when he connected it to a real model and priced some structures that we made up on the fly, I was hooked. I learned SynTech in hours but it took me months to figure out how it was put together. A process that forced me to learn structured programming in general and CPP (c plus plus) in particular.
As always, it was a general struggle to keep up with the financial innovation, and constant re-coding of new payoffs was a painful and error prone process. We had been toying with a cocktail of Visual Basic for scripting of the payoffs, and scenarios of future prices generated by CPP programs. However, the implementation was slow, model specific, hard to use, and generally more elephant than elegant.
SynTech, on the other hand, was easy to use with a readable simple Python like syntax, and thoroughly built for speed and versatility. Scripts were pre-processed to cache and index static information for maximum pricing speed, and its API allowed a seamless hook-up with any dynamic model in our library. In fact, it took Antoine very little time to hook up SynTech to our then newly developed Libor Market Model.
Further, it was clear that SynTech could be extended to perform various life cycle tasks such as fixings and payments to limit the manual burden on the back office in the handling of exotic trades. SynTech implemented a clear separation between instrument and model.
From then on, I have only used scripting languages as the interfaces for all the models I have developed. And when I need to price something I rarely use anything else than naked scripting. The scripting language that I have used and developed have all had a syntax very close to the original SynTech. The developments that I have done have mainly been underneath. Remarkably, SynTech's original 50 keywords still cover the ground.
SynTech was inspired by developments Antoine had seen at previous occupations, most notably the GRFN system at Paribas. [...]
Paribas' GRFN developed by Guillaume Amblard and Societe Generale's OptIt by Jean-Marc Eber were as far as we know the first scripting languages that were used on an industrial scale. [...]
GRFN and OptIt emerged in the mid 1990s. There were, for sure, other earlier attempts to develop scripting languages, most notably various uses of the LEX-YACC suite of tools for creating languages. [...]
In 2001, I went to Bank of America in London, where I ganged up with James Pfeffer and developed Thor. The main innovation of Thor was the use of the visitor pattern technology which later was instrumental in using scripting as the back bone for XVA and regulatory calculations. The main idea of the visitor pattern is to have visitors that visit the cash flows for different purposes: pre-processing, valuation, dependency graph generation, compression, decoration, etc. The diverse use of visitors shows that development of your own scripting language is necessary. Python or C# can not be visited.
In 2002-2005 I worked for Nordea in Copenhagen where we developed a scripting language called Loke. [...].
2005-2008 I was back with Bank of America, where I found the Thor language to be heavily used by the structured interest rate and equity desks. [...].
At Danske Bank that I joined in 2008 and left in 2018, the scripting language is called Jive. Jive is used for everything traded: from vanilla swaps to mortgage bonds to equity exotics to regulatory capital. Jive is even used in the yield curve calibration. [...]. Developments have mainly concentrated around aggregation, compression and decoration used for XVA and regulatory calculations. Here, we have heavily leveraged on the visitor pattern technology. But we have also done significant work on Automatic Adjoint Differentiation (AAD), multi threading, and fuzzy logic to stabilize risk calculations. Antoine joined Danske in 2013, and since then he has played a key role in these developments. In 2015, we received Risk Magazine's In-House Risk System of the Year award for our XVA system. The AAD and the speed of the calculations achieved by the XVA system have received a lot of attention in the quant community, but the scripting and visitor pattern technologies are actually the unsung heroes that have made all of this possible.
To document how we did XVA on an iPad Mini without thoroughly describing our approach to scripting would be wrong and not give the reader the full picture. I was therefore very happy when Antoine told me he was going to write a book on scripting. [...]
There is a number of reasons why the story of scripting has not been told before:
- It's not mathematics, but software design. Which is actually something that we do every day but not something that we usually write about.
- It's a complex and relatively long and winding story that can not easily be summoned in a few punch lines. On top of this it contains subjects that most people haven't even heard about such as visitors and pre-processors.
- It's a hard sell to change conventional wisdom that scripting is only for exotics and has no relevance in post crisis finance. Actually, scripting is more relevant now than ever, because banks are under tough regulatory and cost pressures.
- It's very CPP and as such not following the current trend of lighter languages such as Matlab and Python backed by GPUs running parallel instructions in C.
- The subject is still very much alive.
Note: Presentation by Antoine Savine of the themes of the upcoming volume Modern Computational Finance: Scripting for Financial Derivatives (Wiley, 2019), by Jesper Andreasen and Antoine Savine.
Keywords: Antoine Savine, Jesper Andreasen, Risk Management, Scripting, Financial Derivatives, Derivatives Systems, C Plus Plus, Financial Systems
Suggested Citation: Suggested Citation