Digital Library
MathWorks. Financial Instruments Toolbox™ Users Guide (The MathWorks, Inc.) (z-library.sk, 1lib.sk, z-lib.sk)
Unknown Author
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
Financial Instruments Toolbox™ User's Guide R2022b
Page
2
How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us Phone: 508-647-7000 The MathWorks, Inc. 1 Apple Hill Drive Natick, MA 01760-2098 Financial Instruments Toolbox™ User's Guide © COPYRIGHT 2012–2022 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information. Revision History September 2012 Online only Version 1.0 (Release 2012b) March 2013 Online only Version 1.1 (Release 2013a) September 2013 Online only Version 1.2 (Release 2013b) March 2014 Online only Version 1.3 (Release 2014a) October 2014 Online only Version 2.0 (Release 2014b) March 2015 Online only Version 2.1 (Release 2015a) September 2015 Online only Version 2.2 (Release 2015b) March 2016 Online only Version 2.3 (Release 2016a) September 2016 Online only Version 2.4 (Release 2016b) March 2017 Online only Version 2.5 (Release 2017a) September 2017 Online only Version 2.6 (Release 2017b) March 2018 Online only Version 2.7 (Release 2018a) September 2018 Online only Version 2.8 (Release 2018b) March 2019 Online only Version 2.9 (Release 2019a) September 2019 Online only Version 2.10 (Release 2019b) March 2020 Online only Version 3.0 (Release 2020a) September 2020 Online only Version 3.1 (Release 2020b) March 2021 Online only Version 3.2 (Release 2021a) September 2021 Online only Version 3.3 (Release 2021b) March 2022 Online only Version 3.4 (Release 2022a) September 2022 Online only Version 3.5 (Release 2022b)
Page
3
Getting Started 1 Financial Instruments Toolbox Product Description . . . . . . . . . . . . . . . . . 1-2 Interest-Rate-Based Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Equity-Based Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Expected Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Portfolio Creation Using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Interest-Rate-Based Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Equity Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Adding Instruments to an Existing Portfolio Using Functions . . . . . . . . . 1-8 Pricing a Portfolio Using the Black-Derman-Toy Model . . . . . . . . . . . . . . 1-10 Instrument Construction and Portfolio Management Using Functions . 1-15 Instrument Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15 Creating Instruments or Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16 Searching or Subsetting a Portfolio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17 Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22 Workflow to Price an Interest-Rate Instrument . . . . . . . . . . . . . . . . . . . . 1-25 Price Vanilla Fixed Bond Instrument Using ratecurve and Discount Pricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25 Workflow to Price an Inflation Instrument . . . . . . . . . . . . . . . . . . . . . . . . 1-28 Analyze Inflation-Indexed Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28 Workflow to Price an Equity, Commodity, or FX Instrument . . . . . . . . . . 1-37 Price Vanilla Instrument Using Black-Scholes Model and Black-Scholes Pricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-37 Workflow to Price a Credit Derivative Instrument . . . . . . . . . . . . . . . . . . 1-40 Price CDS Instrument Using Default Probability Curve and Credit Pricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-40 Workflow to Create and Price a Portfolio of Instruments . . . . . . . . . . . . 1-42 Create and Price Portfolio of Instruments . . . . . . . . . . . . . . . . . . . . . . . 1-42 iii Contents
Page
4
Workflow for Creating and Analyzing a ratecurve and parametercurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-46 Convert RateSpec to a ratecurve Object . . . . . . . . . . . . . . . . . . . . . . . . . 1-49 Workflow for Creating and Analyzing a defprobcurve . . . . . . . . . . . . . . . 1-51 Choose Instruments, Models, and Pricers . . . . . . . . . . . . . . . . . . . . . . . . . 1-53 Interest-Rate Instruments with Associated Models and Pricers . . . . . . . . 1-53 Equity, Commodity, FX, and Energy Instruments with Associated Models and Pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-56 Inflation Instruments with Associated Models and Pricers . . . . . . . . . . . . 1-60 Credit Derivative Instruments with Associated Models and Pricers . . . . . 1-61 Supported Exercise Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-62 Mapping Financial Instruments Toolbox Functions to Object-Based Framework for Instruments, Models, and Pricers . . . . . . . . . . . . . . . . 1-70 Mapping Financial Instruments Toolbox Functions for Interest-Rate Instrument Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-73 Mapping Financial Instruments Toolbox Functions for Equity, Commodity, FX Instrument Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-84 Mapping Financial Instruments Toolbox Functions for Credit Derivative Instrument Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-94 Mapping Financial Instruments Toolbox Curve Functions to Object-Based Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-95 Price European Vanilla Call Options Using Black-Scholes Model and Different Equity Pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-97 Price Weather Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-103 Interest-Rate Derivatives 2 Supported Interest-Rate Instrument Functions . . . . . . . . . . . . . . . . . . . . . 2-3 Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Convertible Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Stepped Coupon Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 Sinking Fund Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 Bonds with an Amortization Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Bond Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Bond with Embedded Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Stepped Coupon Bonds with Calls and Puts . . . . . . . . . . . . . . . . . . . . . . . 2-8 Sinking Fund Bonds with an Embedded Option . . . . . . . . . . . . . . . . . . . . . 2-8 Amortizing Callable or Puttable Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Fixed-Rate Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Floating-Rate Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Floating-Rate Note with an Amortization Schedule . . . . . . . . . . . . . . . . . 2-10 iv Contents
Page
5
Floating-Rate Note with Caps, Collars, and Floors . . . . . . . . . . . . . . . . . 2-10 Floating-Rate Note Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Floating-Rate Note with Embedded Options . . . . . . . . . . . . . . . . . . . . . . 2-11 Cap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Range Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Swap with an Amortization Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 Forward Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 Swaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 Bond Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 Work with Negative Interest Rates Using Functions . . . . . . . . . . . . . . . . 2-18 Interest-Rate Modeling Options for Negative Rates . . . . . . . . . . . . . . . . 2-18 Modeling Negative Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18 Work with Negative Interest Rates Using Objects . . . . . . . . . . . . . . . . . . 2-22 Interest-Rate Modeling Options for Negative Rates . . . . . . . . . . . . . . . . 2-22 Modeling Negative Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22 Price Swaptions with Negative Strikes Using the Shifted SABR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26 Calibrate the SABR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33 Load Market Implied Black Volatility Data . . . . . . . . . . . . . . . . . . . . . . . 2-33 Method 1: Calibrate Alpha, Rho, and Nu Directly . . . . . . . . . . . . . . . . . . 2-33 Method 2: Calibrate Rho and Nu by Implying Alpha from At-The-Money Volatility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34 Use the Calibrated Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36 Price a Swaption Using the SABR Model . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38 Overview of Interest-Rate Tree Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-44 Interest-Rate Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-44 Rate and Price Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45 Viewing Rate or Price Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45 Understanding the Interest-Rate Term Structure . . . . . . . . . . . . . . . . . . 2-48 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48 Interest Rates Versus Discount Factors . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48 Interest-Rate Term Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53 Spot Curve to Forward Curve Conversion . . . . . . . . . . . . . . . . . . . . . . . . 2-53 Alternative Syntax (ratetimes) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-54 Modeling the Interest-Rate Term Structure . . . . . . . . . . . . . . . . . . . . . . . 2-57 Creating or Modifying (intenvset) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-57 Obtaining Specific Properties (intenvget) . . . . . . . . . . . . . . . . . . . . . . . . 2-58 Pricing Using Interest-Rate Term Structure . . . . . . . . . . . . . . . . . . . . . . . 2-61 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-61 Computing Instrument Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-61 Computing Instrument Sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-63 OAS for Callable and Puttable Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64 v
Page
6
Agency OAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64 Understanding Interest-Rate Tree Models . . . . . . . . . . . . . . . . . . . . . . . . 2-66 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-66 Building a Tree of Forward Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-66 Specifying the Volatility Model (VolSpec) . . . . . . . . . . . . . . . . . . . . . . . . 2-68 Specifying the Interest-Rate Term Structure (RateSpec) . . . . . . . . . . . . . 2-70 Specifying the Time Structure (TimeSpec) . . . . . . . . . . . . . . . . . . . . . . . 2-70 Creating Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72 Examining Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72 Pricing Using Interest-Rate Tree Models . . . . . . . . . . . . . . . . . . . . . . . . . 2-81 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-81 Computing Instrument Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-81 Computing Instrument Sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89 HJM Sensitivities Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89 BDT Sensitivities Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89 Calibrating Hull-White Model Using Market Data . . . . . . . . . . . . . . . . . . 2-92 Hull-White Model Calibration Example . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92 Interest-Rate Derivatives Using Closed-Form Solutions . . . . . . . . . . . . . 2-99 Pricing Caps and Floors Using the Black Option Model . . . . . . . . . . . . . . 2-99 Price Swaptions with Interest-Rate Models Using Simulation . . . . . . . 2-100 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-100 Construct a Zero Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-100 Define Swaption Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-102 Compute the Black Model and the Swaption Volatility Matrix . . . . . . . . 2-102 Select Calibration Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-102 Compute Swaption Prices Using Black's Model . . . . . . . . . . . . . . . . . . . 2-102 Define Simulation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-103 Simulate Interest-Rate Paths Using the Hull-White One-Factor Model . . 2-103 Simulate Interest-Rate Paths Using the Linear Gaussian Two-Factor Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-106 Simulate Interest-Rate Paths Using the LIBOR Market Model . . . . . . . . 2-108 Compare Interest-Rate Modeling Results . . . . . . . . . . . . . . . . . . . . . . . 2-112 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-113 Pricing Bermudan Swaptions with Monte Carlo Simulation . . . . . . . . . 2-114 Managing Interest-Rate Risk with Bond Futures . . . . . . . . . . . . . . . . . . 2-125 Analyze Inflation-Indexed Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . 2-132 Bootstrapping a Swap Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-141 Fitting Interest-Rate Curve Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-144 Fitting the Diebold Li Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-150 Calibrating Caplets Using the Normal (Bachelier) Model . . . . . . . . . . . 2-155 Calibrating Floorlets Using the Normal (Bachelier) Model . . . . . . . . . . 2-159 vi Contents
Page
7
Calibrate the SABR Model Using Normal (Bachelier) Volatilities with Negative Strikes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-163 Calibrate Shifted SABR Model Parameters for Swaption Instrument 2-167 Price Portfolio of Bond and Bond Option Instruments . . . . . . . . . . . . . 2-172 Calibrate SABR Model Using Normal (Bachelier) Volatilities with Analytic Pricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-177 Calibrate SABR Model Using Analytic Pricer . . . . . . . . . . . . . . . . . . . . . 2-181 Price a Swaption Using SABR Model and Analytic Pricer . . . . . . . . . . . 2-185 Compute LIBOR Fallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-192 Use treeviewer to Examine HWTree and PriceTree When Pricing European Callable Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-194 Select Cheapest-to-Deliver Bond Using BondFuture Instrument . . . . . 2-212 Graphical Representation of Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-219 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-219 Observing Interest Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-219 Observing Instrument Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-222 Basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-228 Equity Derivatives 3 Understanding Equity Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Building Equity Binary Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Building Implied Trinomial Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 Building Standard Trinomial Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 Examining Equity Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Differences Between CRR and EQP Tree Structures . . . . . . . . . . . . . . . . 3-17 Supported Equity Derivative Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 Asian Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 Barrier Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20 Double Barrier Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21 Basket Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22 Chooser Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23 Compound Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23 Convertible Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24 Lookback Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25 Digital Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 Rainbow Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Vanilla Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Spread Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30 vii
Page
8
One-Touch and Double One-Touch Options . . . . . . . . . . . . . . . . . . . . . . . 3-30 Forwards Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31 Futures Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-32 Supported Energy Derivative Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34 Asian Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34 Barrier Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35 Double Barrier Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-36 Vanilla Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-37 Spread Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-38 Lookback Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-39 Forwards Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-40 Futures Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-41 Pricing Swing Options Using the Longstaff-Schwartz Method . . . . . . . . 3-43 Simulating Electricity Prices with Mean-Reversion and Jump-Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-53 Pricing Equity Derivatives Using Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64 Computing Instrument Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64 Computing Prices Using CRR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-65 Computing Prices Using EQP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-66 Computing Prices Using ITT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-68 Computing Prices Using STT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-69 Examining Output from the Pricing Functions . . . . . . . . . . . . . . . . . . . . . 3-70 Graphical Representation of Equity Derivative Trees . . . . . . . . . . . . . . . 3-73 Computing Equity Instrument Sensitivities . . . . . . . . . . . . . . . . . . . . . . . 3-75 CRR Sensitivities Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-75 ITT Sensitivities Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-76 Equity Derivatives Using Closed-Form Solutions . . . . . . . . . . . . . . . . . . . 3-79 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-79 Black-Scholes Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-79 Black Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-80 Roll-Geske-Whaley Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-80 Bjerksund-Stensland 2002 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-81 Barone-Adesi-Whaley Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-81 Pricing Using the Black-Scholes Model . . . . . . . . . . . . . . . . . . . . . . . . . . 3-82 Pricing Using the Black Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-83 Pricing Using the Roll-Geske-Whaley Model . . . . . . . . . . . . . . . . . . . . . . 3-84 Pricing Using the Bjerksund-Stensland Model . . . . . . . . . . . . . . . . . . . . . 3-84 Compute American Option Prices Using the Barone-Adesi and Whaley Option Pricing Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-86 Pricing European Call Options Using Different Equity Models . . . . . . . . 3-88 Compute the Option Price on a Future . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-95 Pricing European and American Spread Options . . . . . . . . . . . . . . . . . . . 3-97 Pricing Asian Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-110 viii Contents
Page
9
Price Spread Instrument for a Commodity Using Black-Scholes Model and Analytic Pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-123 Price Vanilla Instrument Using Heston Model and Multiple Different Pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-125 Create and Price Portfolio of Instruments . . . . . . . . . . . . . . . . . . . . . . . 3-131 Use Black-Scholes Model to Price Asian Options with Several Equity Pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-135 Calibrate Option Pricing Model Using Heston Model . . . . . . . . . . . . . . 3-143 Use Deep Learning to Approximate Barrier Option Prices with Heston Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-148 Hedging Portfolios 4 Hedging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Hedging Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Hedging with hedgeopt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 Self-Financing Hedges with hedgeslf . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Pricing and Hedging a Portfolio Using the Black-Karasinski Model . . . 4-13 Specifying Constraints with ConSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24 Setting Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24 Portfolio Rebalancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26 Hedging with Constrained Portfolios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28 Example: Fully Hedged Portfolio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28 Example: Minimize Portfolio Sensitivities . . . . . . . . . . . . . . . . . . . . . . . . 4-30 Example: Under-Determined System . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30 Example: Portfolio Constraints with hedgeslf . . . . . . . . . . . . . . . . . . . . . 4-31 Hedging Strategies Using Spread Options . . . . . . . . . . . . . . . . . . . . . . . . 4-35 Mortgage-Backed Securities 5 What Are Mortgage-Backed Securities? . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Fixed-Rate Mortgage Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 ix
Page
10
Inputs to Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 Generating Prepayment Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Mortgage Prepayments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 Risk Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Mortgage Pool Valuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 Computing Option-Adjusted Spread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Prepayments with Fewer Than 360 Months Remaining . . . . . . . . . . . . . . 5-12 Pools with Different Numbers of Coupons Remaining . . . . . . . . . . . . . . . 5-14 Summary of Prepayment Data Vector Representation . . . . . . . . . . . . . . . 5-14 Prepayment Modeling with a Two Factor Hull White Model and a LIBOR Market Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16 Pricing Mortgage Backed Securities Using the Black-Derman-Toy Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-34 Using Collateralized Mortgage Obligations (CMOs) . . . . . . . . . . . . . . . . 5-40 What Are CMOs? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40 Prepayment Risk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-41 Sequential Tranches Without a Z-Bond . . . . . . . . . . . . . . . . . . . . . . . . . . 5-41 Sequential Tranches with a Z-Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-42 PAC Tranches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-42 TAC Tranches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-44 CMO Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47 Calculate Underlying Mortgage Cash Flows . . . . . . . . . . . . . . . . . . . . . . 5-47 Define CMO Tranches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47 If Using a PAC or TAC CMO, Calculate Principal Schedule . . . . . . . . . . . 5-47 Calculate Cash Flows for Each Tranche . . . . . . . . . . . . . . . . . . . . . . . . . 5-47 Analyze CMO by Computing Price, Yield, and Spread of CMO Cash Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-48 Create PAC and Sequential CMO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-49 Debt Instruments 6 Agency Option-Adjusted Spreads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Computing the Agency OAS for Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Using Zero-Coupon Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 Measuring Zero-Coupon Bond Function Quality . . . . . . . . . . . . . . . . . . . . 6-5 Pricing Treasury Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 Pricing Corporate Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Stepped-Coupon Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 x Contents
Page
11
Cash Flows from Stepped-Coupon Bonds . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 Price and Yield of Stepped-Coupon Bonds . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Term Structure Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Computing Spot and Forward Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Computing Spreads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 Derivative Securities 7 Interest Rate Swaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Swap Pricing Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Swap Pricing Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Portfolio Hedging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Bond Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 Analysis of Bond Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 Calculating Bond Conversion Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 Calculating Implied Repo Rates to Find the CTD Bond . . . . . . . . . . . . . . 7-12 Pricing Bond Futures Using the Term Implied Repo Rate . . . . . . . . . . . . 7-13 Managing Present Value with Bond Futures . . . . . . . . . . . . . . . . . . . . . . . 7-14 Fitting the Diebold Li Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Credit Derivatives 8 Counterparty Credit Risk and CVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 First-to-Default Swaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18 Credit Default Swap Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-27 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-27 Pricing a Single-Name CDS Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-28 Pricing a CDS Index Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-30 Wrong Way Risk with Copulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-34 Bootstrapping a Default Probability Curve from Credit Default Swaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-42 Bootstrap Default Probability Curve from Market CDS Instruments . . . 8-45 xi
Page
12
Price Multiple CDS Option Instruments Using CDS Black Model and CDS Black Pricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-46 Interest-Rate Curve Objects 9 Interest-Rate Curve Objects and Workflow . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Workflow Using Interest-Rate Curve Objects . . . . . . . . . . . . . . . . . . . . . . . 9-2 Creating Interest-Rate Curve Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4 Creating an IRDataCurve Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 Use IRDataCurve with Dates and Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 Bootstrap IRDataCurve Based on Market Instruments . . . . . . . . . . . . . . . 9-7 Dual Curve Bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 Creating an IRFunctionCurve Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16 Fitting IRFunctionCurve Object Using a Function Handle . . . . . . . . . . . . 9-16 Fitting IRFunctionCurve Object Using Nelson-Siegel Method . . . . . . . . . 9-16 Fitting IRFunctionCurve Object Using Svensson Method . . . . . . . . . . . . 9-17 Fitting IRFunctionCurve Object Using Smoothing Spline Method . . . . . . 9-19 Using fitFunction to Create Custom Fitting Function . . . . . . . . . . . . . . . 9-21 Fitting Interest-Rate Curve Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24 Converting an IRDataCurve or IRFunctionCurve Object . . . . . . . . . . . . . 9-30 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-30 Using the toRateSpec Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-30 Using Vector of Dates and Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-31 Numerix Workflows 10 Working with Simple Numerix Trades . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Working with Advanced Numerix Trades . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 Use Numerix to Price Cash Deposits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8 Use Numerix for Interest-Rate Risk Assessment . . . . . . . . . . . . . . . . . . 10-10 Numerix CROSSASSET Interface Workflow Example Using Matrix, Data, and Call Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12 xii Contents
Page
13
Functions 11 Derivatives Pricing Options A Pricing Options Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Default Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Customizing the Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3 Bibliography B Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 Black-Derman-Toy (BDT) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 Heath-Jarrow-Morton (HJM) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 Hull-White (HW) and Black-Karasinski (BK) Modeling . . . . . . . . . . . . . . . . B-2 Cox-Ross-Rubinstein (CRR) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 Implied Trinomial Tree (ITT) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Leisen-Reimer Tree (LR) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Equal Probabilities Tree (EQP) Modeling . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Closed-Form Solutions Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Financial Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Fitting Interest-Rate Curve Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3 Interest-Rate Modeling Using Monte Carlo Simulation . . . . . . . . . . . . . . . B-4 Bootstrapping a Swap Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-4 Bond Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-4 Credit Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-4 Convertible Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-5 xiii
Page
14
(This page has no text content)
Page
15
Getting Started • “Financial Instruments Toolbox Product Description” on page 1-2 • “Interest-Rate-Based Derivatives” on page 1-3 • “Equity-Based Derivatives” on page 1-4 • “Expected Users” on page 1-5 • “Portfolio Creation Using Functions” on page 1-6 • “Adding Instruments to an Existing Portfolio Using Functions” on page 1-8 • “Pricing a Portfolio Using the Black-Derman-Toy Model” on page 1-10 • “Instrument Construction and Portfolio Management Using Functions” on page 1-15 • “Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments” on page 1-22 • “Workflow to Price an Interest-Rate Instrument” on page 1-25 • “Workflow to Price an Inflation Instrument” on page 1-28 • “Workflow to Price an Equity, Commodity, or FX Instrument” on page 1-37 • “Workflow to Price a Credit Derivative Instrument” on page 1-40 • “Workflow to Create and Price a Portfolio of Instruments” on page 1-42 • “Workflow for Creating and Analyzing a ratecurve and parametercurve” on page 1-46 • “Workflow for Creating and Analyzing a defprobcurve” on page 1-51 • “Choose Instruments, Models, and Pricers” on page 1-53 • “Supported Exercise Styles” on page 1-62 • “Mapping Financial Instruments Toolbox Functions to Object-Based Framework for Instruments, Models, and Pricers” on page 1-70 • “Mapping Financial Instruments Toolbox Functions for Interest-Rate Instrument Objects” on page 1-73 • “Mapping Financial Instruments Toolbox Functions for Equity, Commodity, FX Instrument Objects” on page 1-84 • “Mapping Financial Instruments Toolbox Functions for Credit Derivative Instrument Objects” on page 1-94 • “Mapping Financial Instruments Toolbox Curve Functions to Object-Based Framework” on page 1-95 • “Price European Vanilla Call Options Using Black-Scholes Model and Different Equity Pricers” on page 1-97 • “Price Weather Derivatives” on page 1-103 1
Page
16
Financial Instruments Toolbox Product Description Design, price, and hedge complex financial instruments Financial Instruments Toolbox provides functions for pricing, modeling, hedging, and analyzing cash flows, fixed-income securities, and derivative instruments (including equity, interest-rate, credit, and energy instruments). For interest-rate instruments, you can calculate price, yield, spread, and sensitivity values for various instrument types, including convertible bonds, mortgage-backed securities, treasury bills, bonds, swaps, caps, floors, and floating-rate notes. For derivative instruments, you can compute price, implied volatility, and Greeks using binomial trees, trinomial trees, Shifted SABR, Heston, Monte Carlo simulation, and other models. You can also connect to Numerix® CrossAsset Integration Layer for the valuation and risk management of fixed-income securities, OTC derivatives, structured products, and variable annuity products. 1 Getting Started 1-2
Page
17
Interest-Rate-Based Derivatives The toolbox provides functionality that supports the creation on page 1-6 and management on page 1-15 of these interest-rate-based instruments: • Bonds • Bond options (puts and calls) • Bond with embedded options • Caps • Convertible bonds • Fixed-rate notes • Floating-rate notes • Floors • Swaps • Swaption Additionally, the toolbox provides functions to create arbitrary cash flow instruments. The toolbox provides pricing and sensitivity routines for these instruments. For more information, see “Pricing Using Interest-Rate Term Structure” on page 2-61,“Pricing Using Interest-Rate Tree Models” on page 2-81, and“Interest-Rate Derivatives Using Closed-Form Solutions” on page 2-99. See Also instbond | instcap | instcbond | instcf | instfixed | instfloat | instfloor | instoptbnd | instoptembnd | instoptfloat | instoptemfloat | instrangefloat | instswap | instswaption Related Examples • “Creating Instruments or Properties” on page 1-16 More About • “Supported Interest-Rate Instrument Functions” on page 2-3 • “Supported Equity Derivative Functions” on page 3-19 • “Supported Energy Derivative Functions” on page 3-34 Interest-Rate-Based Derivatives 1-3
Page
18
Equity-Based Derivatives The toolbox also provides functions to create and manage various equity-based derivatives, including the following: • Asian options • Barrier options • Basket options • Compound options • Convertible bonds • Digital options • Lookback options • Rainbow options • Vanilla stock options (put and call options) The toolbox also provides pricing and sensitivity routines for these instruments. (See “Pricing Equity Derivatives Using Trees” on page 3-64, “Equity Derivatives Using Closed-Form Solutions” on page 3- 79, and “Basket Option” on page 3-22.) See Also instasian | instbarrier | instcbond | instcompound | instlookback | instoptstock Related Examples • “Creating Instruments or Properties” on page 1-16 • “Pricing Equity Derivatives Using Trees” on page 3-64 More About • “Supported Equity Derivative Functions” on page 3-19 • “Supported Interest-Rate Instrument Functions” on page 2-3 • “Supported Energy Derivative Functions” on page 3-34 1 Getting Started 1-4
Page
19
Expected Users In general, this guide assumes experience working with financial derivatives and some familiarity with the underlying models. In designing Financial Instruments Toolbox documentation, we assume that your title is similar to one of these: • Analyst, quantitative analyst • Risk manager • Portfolio manager • Fund manager, asset manager • Financial engineer • Trader • Student, professor, or other academic We also assume that your background, education, training, and responsibilities match some aspects of this profile: • Finance, economics, perhaps accounting • Engineering, mathematics, physics, other quantitative sciences • Bachelor's degree minimum; MS or MBA likely; Ph.D. perhaps; CFA • Comfortable with probability theory, statistics, and algebra • Understand linear or matrix algebra, calculus, and differential equations • Previously done traditional programming (C, Fortran, and so on) • Responsible for instruments or analyses involving large sums of money • Perhaps new to MATLAB® Expected Users 1-5
Page
20
Portfolio Creation Using Functions In this section... “Introduction” on page 1-6 “Interest-Rate-Based Derivatives” on page 1-6 “Equity Derivatives” on page 1-7 Introduction The instadd function creates a set of instruments (portfolio) or adds instruments to an existing instrument collection. The TypeString argument specifies the type of the investment instrument. For interest-rate-based derivatives, the types are: Bond, OptBond, CashFlow, Fixed, Float, Cap, Floor, and Swap. For equity derivatives, the types are Asian, Barrier, Compound, Lookback, and OptStock. The input arguments following TypeString are specific to the type of investment instrument. Thus, the TypeString argument determines how the remainder of the input arguments is interpreted. For example, instadd with the type character vector for Bond creates a portfolio of bond instruments. InstSet = instadd('Bond', CouponRate, Settle, Maturity, Period, Basis, EndMonthRule, IssueDate, FirstCouponDate, LastCouponDate, StartDate, Face) Interest-Rate-Based Derivatives In addition to the bond instrument already described, the toolbox can create portfolios containing the following set of functions for interest-rate-based derivatives: • Bond option InstSet = instadd('OptBond', BondIndex, OptSpec, Strike, ExerciseDates, AmericanOpt) • Arbitrary cash flow instrument InstSet = instadd('CashFlow', CFlowAmounts, CFlowDates, Settle, Basis) • Fixed-rate note instrument InstSet = instadd('Fixed', CouponRate, Settle, Maturity, FixedReset, Basis, Principal) • Floating-rate note instrument InstSet = instadd('Float', Spread, Settle, Maturity, FloatReset, Basis, Principal) • Cap instrument InstSet = instadd('Cap', Strike, Settle, Maturity, CapReset, Basis, Principal) • Convertible bond instrument InstSet = instcbond(CouponRate,Settle,Maturity,ConvRatio) • Floor instrument InstSet = instadd('Floor', Strike, Settle, Maturity, FloorReset, Basis, Principal) • Swap instrument InstSet = instadd('Swap', LegRate, Settle, Maturity, LegReset, Basis, Principal, LegType) • Swaption instrument 1 Getting Started 1-6
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A practical, example-driven manual for pricing, calibrating, and risk-managing financial instruments in MATLAB, aimed at quantitative analysts, risk managers, and finance students who already know the math and want working code.
【Book Arc】
- **Opening (~0%–12%)**: Product overview and the object-based framework (instruments, models, pricers), plus a map of which instrument types pair with which models and exercise styles — solves the "where do I start and what connects to what" problem.
- **Early (~12%–32%)**: Interest-rate derivatives in depth: bonds and embedded options, FRNs, caps/floors, swaps, swaptions, futures, negative-rate handling, term structures, trees (HJM, BDT, Hull-White), and calibration — the book's mathematical core.
- **Middle (~32%–52%)**: Equity, commodity, FX, and energy derivatives: exotic option families (Asian, barrier, lookback, digital, spread, one-touch), tree and closed-form pricing (Black-Scholes, Black, Barone-Adesi-Whaley, Bjerksund-Stensland), and Heston calibration.
- **Late (~52%+ of sampled excerpts)**: Portfolio-level workflows and advanced applications — pricing portfolios of instruments, deep-learning approximation of barrier option prices, and cross-model comparison; the excerpts thin out here.
- **Ending**: Not covered by the sampled excerpts; the guide cannot map the closing chapters.
【Book Arc note】
The progression is deliberate: framework first, then instrument-by-instrument pricing, then model calibration, then portfolio and advanced techniques.
【Key Takeaways】
- **The object framework is the spine of the toolbox** (Opening): instruments, models, and pricers are separate objects you compose, with mapping tables showing how legacy function calls translate to objects — learn this first and everything else slots in.
- **Instrument coverage is broad but structured by asset class** (Early–Middle): rates, equity, commodity, FX, energy, inflation, and credit each get their own instrument catalog with associated models and pricers.
- **Calibration is treated as a first-class workflow** (Early–Middle): Hull-White, SABR (including shifted SABR for negative strikes), Bachelier/normal volatilities, and Heston all get step-by-step calibration examples against market data.
- **Negative interest rates are handled explicitly** (Early): both function-based and object-based paths are shown, plus shifted SABR for negative-strike swaptions — a sign the manual tracks real market conditions.
- **Trees and simulation are presented as complementary engines** (Early–Middle): binomial/trinomial trees for American-style and callable instruments, Monte Carlo (Longstaff-Schwartz) for Bermudan swaptions and swing options.
- **Curve construction is foundational** (Early–Middle): bootstrapping swap curves, fitting Diebold-Li, and building ratecurve/defprobcurve objects precede most pricing examples.
- **Portfolio workflows appear late** (Middle–Late): creating and pricing a portfolio of instruments, and pricing bond-plus-bond-option portfolios, show how to scale from single trades to books.
- **Modern extensions are included** (Late): deep learning to approximate barrier option prices with Heston dynamics signals the manual's coverage of ML-adjacent methods.
【Reading Tips】
- **Start with Chapter 1's mapping tables** (Opening): they tell you which functions and objects you need before you dive into any asset class — skim the rest of Chapter 1.
- **Deep-read only your asset class**: rates (Chapter 2) and equity/commodity/FX/energy (Chapter 3) are long; read the sections matching your instruments and treat the rest as reference.
- **Run the examples**: this is a code manual — the value is in executing the workflows (curve building → calibration → pricing → sensitivities) rather than reading prose.
- **Watch the hard spots**: tree construction (VolSpec/RateSpec/TimeSpec), calibration convergence, and negative-rate modeling reward careful reading; skim the revision history and legal front matter entirely.
- **Use it as a lookup, not a cover-to-cover read**: the table of contents is the real index; jump to the workflow you need.
【Coverage Limits】
The sampled excerpts are dominated by front matter and table-of-contents entries; actual chapter prose, code listings, and the book's closing chapters are not represented, so this guide maps structure and topics rather than detailed content.
Passage locations
Page 2
he Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathwork...
View in text
Page 4
ting-Rate Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Floating-Rate Note with an Amortization Schedule . . ....
View in text
Page 6
. . . . . . 2-81 Computing Instrument Sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89 HJM Sensitivities Example . . . . . . . ....
View in text
Page 8
Options Using the Longstaff-Schwartz Method . . . . . . . . 3-43 Simulating Electricity Prices with Mean-Reversion and Jump-Diffusion . . . . . . . . . . . ....
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
Loading recommended books...
Failed to load, please try again later
Tip the Site
Scan the WeChat Pay or Alipay code to tip. No login required.
WeChat Pay
Alipay