Introduction to Financial Derivatives with Python Introduction to Financial Derivatives with Python is an ideal textbook for an undergraduate course on derivatives, whether on a finance, economics, or finan- cial mathematics program. As well as covering all of the essential topics one would expect to be covered, the book also includes the basis of the numerical techniques most used in the financial industry, and their implementation in Python. Features • Connected to a Github repository with the codes in the book. The repository can be accessed at https://bit.ly/3bllnuf • Suitable for undergraduate students, as well as anyone who wants a gentle introduction to the principles of quantitative finance • No pre-requisites required for programming or advanced mathematics be- yond basic calculus. Elisa Alòs holds a Ph.D. in Mathematics from the University of Barcelona. She is an Associate Professor in the Department of Economics and Business at Univer- sitat Pompeu Fabra (UPF) and a Barcelona GSE Affiliated Professor. Her research focus has been on the applications of the Malliavin calculus and the fractional Brownian motion in mathematical finance and volatility modeling since the past fourteen years. Raúl Merino has been working full-time in the industry as Risk Quant since 2008. He is also an Associate Professor at Pompeu Fabra University (UPF) where he teaches the course ‘Financial Derivatives and Risk Management’. Raul holds a Ph.D. in Mathematics from the University of Barcelona. In his Ph.D., he studied the use of decomposition formulas in stochastic volatility models. His research interests are stochastic analysis and applied mathematics, with a special focus on applications to mathematical finance. Chapman & Hall/CRC Financial Mathematics Series Series Editors Rama Cont Department of Mathematics M.A.H. Dempster Imperial College, UK Centre for Financial Research Department of Pure Mathematics and Robert A. Jarrow Statistics Lynch Professor of Investment University of Cambridge, UK Management Johnson Graduate School of Dilip B. Madan Management Robert H. Smith School of Business Cornell University, USA University of Maryland, USA Recently Published Titles Stochastic Modelling of Big Data in Finance Anatoliy Swishchuk Introduction to Stochastic Finance with Market Examples, Second Edition Nicolas Privault Commodities: Fundamental Theory of Futures, Forwards, and Derivatives Pricing, Second Edition Edited by M.A.H. Dempster, Ke Tang Foundations of Qualitative Finance: Book 1: Measure Spaces and Measurable Functions Robert R. Reitano Introducing Financial Mathematics: Theory, Binomial Models, and Applications Mladen Victor Wickerhauser Foundations of Qualitative Finance: Book II: Probability Spaces and Random Variables Robert R. Reitano Financial Mathematics: From Discrete to Continuous Time Kevin J. Hastings Financial Mathematics: A Comprehensive Treatment in Discrete Time Giuseppe Campolieti and Roman N. Makarov Introduction to Financial Derivatives with Python Elisa Alòs, Raúl Merino For more information about this series please visit: https://www.crcpress. com/Chapman-and-HallCRC-Financial-Mathematics-Series/book series/ CHFINANCMTH Introduction to Financial Derivatives with Python Elisa Alòs Pompeu Fabra University, Spain Raúl Merino Pompeu Fabra University, Spain Foreword by Frido Rolloos First edition published 2023 by CRC Press 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN © 2023 Elisa Alòs and Raúl Merino CRC Press is an imprint of Taylor & Francis Group, LLC Reasonable efforts have been made to publish reliable data and information, but the author and pub- lisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, access www.copyright. com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact mpkbookspermis- [email protected] Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used only for identification and explanation without intent to infringe. Library of Congress Cataloging‑in‑Publication Data Names: Alòs, Elisa, author. | Merino, Raúl, author. Title: Introduction to financial derivatives with Python / Elisa Alòs, Pompeu Fabra University, Spain, Raúl Merino, Pompeu Fabra University, Spain. Description: Boca Raton : Chapman & Hall, CRC Press, 2023. | Series: Chapman & Hall/CRC financial mathematics series | Includes bibliographical references and index. Identifiers: LCCN 2022037925 (print) | LCCN 2022037926 (ebook) | ISBN 9781032211039 (hardback) | ISBN 9781032211053 (paperback) | ISBN 9781003266730 (ebook) Subjects: LCSH: Derivative securities. | Python (Computer program language) Classification: LCC HG6024.A3 A455 2023 (print) | LCC HG6024.A3 (ebook) | DDC 332.64/57--dc23/eng/20220923 LC record available at https://lccn.loc.gov/2022037925 LC ebook record available at https://lccn.loc.gov/2022037926 ISBN: 978-1-032-21103-9 (hbk) ISBN: 978-1-032-21105-3 (pbk) ISBN: 978-1-003-26673-0 (ebk) DOI: 10.1201/9781003266730 Typeset in LM Roman by KnowledgeWorks Global Ltd. Publisher’s note: This book has been prepared from camera-ready copy provided by the authors. In loving memory of my father. To my parents, Dani and Laura. Contents List of Figures xiii Foreword xvii Preface xxi Chapter 1■ Introduction 1 1.1 FINANCIALMARKETS 1 1.2 DERIVATIVES 1 1.3 TIMEHASAVALUE 2 1.4 NO-ARBITRAGEPRINCIPLE 5 1.5 CHAPTER’SDIGEST 7 1.6 EXERCISES 7 Chapter 2■ Futures and Forwards 9 2.1 FORWARDCONTRACTS:DEFINITIONS 9 2.2 FUTURES 11 2.3 WHYTOUSEFORWARDSANDFUTURES? 14 2.4 THEFAIRDELIVERYPRICE:THEFORWARDPRICE 15 2.4.1 The General Approach 15 2.4.2 Some Special Cases 17 2.4.2.1 Assets that Provide a Known Income 17 2.4.2.2 AssetsthatProvideanIncome Proportional to Its Price 19 2.4.3 The Price of a Forward Contract 21 vii viii ■ Contents 2.4.4 The general case 21 2.4.4.1 The Case of a Known Income 22 2.4.4.2 AssetsthatProvideanIncome Proportional to Its Price 22 2.5 CHAPTER’SDIGEST 23 2.6 EXERCISES 23 Chapter 3■ Options 25 3.1 CALLANDPUTOPTIONS 25 3.2 THEINTRINSICVALUEOFANOPTION 27 3.3 SOMEPROPERTIESOFOPTIONPRICES 27 3.3.1 The Price of an Option vs the Price of an Asset 28 3.3.2 The Role of the strike price 29 3.3.3 The Role of the Price of the Underlying Asset 29 3.3.4 The Role of Interest Rates 30 3.3.5 The Role of Volatility 31 3.3.6 The Role of Time to Maturity 31 3.3.7 The Put-Call Parity 32 3.4 SPECULATIONWITHOPTIONS 33 3.5 SOMECLASSICALSTRATEGIES 35 3.5.0.1 Bull Spread 35 3.5.0.2 Bear Spread 36 3.6 DRAWYOURSTRATEGYWITHPYTHON 37 3.7 CHAPTER’SDIGEST 42 3.8 EXERCISES 43 Chapter 4■ Exotic Options 45 4.1 BINARYOPTIONS 45 4.2 FORWARDSTARTOPTIONS 46 4.2.1 Compound Options 47 4.3 PATH-DEPENDENTOPTIONS 47 Contents ■ ix 4.3.1 Barrier Options 48 4.3.2 Lookback Options 50 4.3.3 Asian Options 51 4.4 SPREADANDBASKETOPTIONS 52 4.5 BERMUDAOPTIONS 53 4.6 CHAPTER’SDIGEST 53 4.7 EXERCISES 53 Chapter 5■ The Binomial Model 55 5.1 THESINGLE-PERIODBINOMIALMODEL 55 5.1.1 Relationship between European Options and Their Underlying in the Binomial Model 59 5.1.2 Replication Portfolio for European Options 60 5.1.3 The Risk-neutral Valuation 64 5.1.4 Link the Model to the Market 67 5.2 THEMULTI-PERIODBINOMIALMODEL 69 5.2.1 Adjusting the Parameters 72 5.2.2 Pricing a European Option 74 5.2.2.1 Extended Framework 74 5.2.2.2 Simplified Framework 84 5.2.3 Early Exercise 84 5.3 THEGREEKSINTHEBINOMIALMODEL 87 5.3.1 Delta 90 5.3.2 Gamma 90 5.3.3 Theta 91 5.3.4 Vega 91 5.3.5 Rho 92 5.3.6 Approximating the Price Function 92 5.4 CODINGTHEBINOMIALMODEL 93 5.5 CHAPTER’SDIGEST 105 5.6 EXERCISES 106