Table of Contents
Guide
Pages
Modern Computational Finance
Scripting for Derivatives and xVA
ANTOINE SAVINE AND JESPER ANDREASEN
Copyright 2022 by John Wiley & Sons, Inc. All rights reserved.
Published by John Wiley & Sons, Inc., Hoboken, New Jersey.
Published simultaneously in Canada.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate percopy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 7508400, fax (978) 7504470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 7486011, fax (201) 7486008, or online at http://www.wiley.com/go/permission.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Further, readers should be aware that websites listed in this work may have changed or disappeared between when this work was written and when it is read. Neither the publisher nor authors shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.
For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 7622974, outside the United States at (317) 5723993 or fax (317) 5724002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com.
Library of Congress Cataloging-in-Publication Data
Names: Antoine Savine, author. | Jesper Andreasen, 1970 author.
Title: Modern computational finance : scripting for derivatives and XVA / Antoine Savine and Jesper Andreasen.
Description: Hoboken, New Jersey : John Wiley & Sons, Inc., [2022] | Includes bibliographical references.
Identifiers: LCCN 2021036994 (print) | LCCN 2021036995 (ebook) | ISBN 9781119540786 (hardback) | ISBN 9781119540816 (adobe pdf) | ISBN 9781119540793 (epub)
Subjects: LCSH: FinanceMathematical models. | FinanceComputer simulation. | FinanceData processing.
Classification: LCC HG106 .A556 2022 (print) | LCC HG106 (ebook) | DDC 332.01/5195dc23
LC record available at https://lccn.loc.gov/2021036994
LC ebook record available at https://lccn.loc.gov/2021036995
Cover Design: Wiley
Cover Image: kentarcajuan/Getty Images
My Life in Script by Jesper Andreasen
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 C++ in particular.
As always, it was a general struggle to keep up with the financial innovation, and constant recoding 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 C programs. However, the implementation was slow, model specific, hard to use, and generally more elephant than elegant.
SynTech, however, was easy to use with a readable simple Basiclike syntax and thoroughly built for speed and versatility. Scripts were preprocessed to cache and index static information for maximum pricing speed, and its API allowed a seamless hookup 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 languages 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. Other young quants spread out from Paribas and seeded ideas and developments of scripting languages at other institutions, for example, at UBS, Commerzbank, NikkoSalomon, Citi, and Reech Capital.
Paribas's GRFN developed by Guillaume Amblard and Societe Generale's OptIt by JeanMarc Eber were as far as we know the first scripting languages that were used on an industrial scale. JeanMarc Eber went on to set up the company Lexifi, which to this date supplies the industry with scripting technology.
GRFN and OptIt emerged in the mid1990s. There were, for sure, other earlier attempts to develop scripting languages, most notably various uses of the LEXYACC suite of tools for creating languages. Emmanuel Derman mentions such efforts in passing in My Life as a Quant and I have heard of similar experiments at JP Morgan. However, to my knowledge, none of these made it to largescale production.
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 that later was instrumental in using scripting as the backbone for xVA and regulatory calculations. The main idea of the visitor pattern is to have visitors that visit the cash flows for different purposes: preprocessing, valuation, dependency graph generation, compression, decoration, and so on. The diverse use of visitors shows that development of your own scripting language is necessary. Python or C# can not be visited.
In 20022005 I worked for Nordea in Copenhagen where we developed a scripting language called Loke. The main innovation during this period was the integration of American MonteCarlo techniques with Loke, including upperbound techniques implemented by Ove Scavenius.
In 20052008 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. Often they used a macro language called Sif, developed by Mohan Namasivayam, to generate Thor scripts.
Next page