MATLAB Examples

Compute the unilateral credit value (valuation) adjustment (CVA) for a bank holding a portfolio of vanilla interest-rate swaps with several counterparties. CVA is the expected loss on an

An approach to modeling wrong-way risk for Counterparty Credit Risk using a Gaussian copula.

Price first-to-default (FTD) swaps under the homogeneous loss assumption.

Price a single-name CDS option using cdsoptprice . The function cdsoptprice is based on the Black's model as described in O'Kane (2008). The optional knockout argument for cdsoptprice

Simulate electricity prices using a mean-reverting model with seasonality and a jump component. The model is calibrated under the real-world probability using historical electricity

Different hedging strategies to minimize exposure in the Energy market using Crack Spread Options.

Price a swing option using a Monte Carlo simulation and the Longstaff-Schwartz method. A risk-neutral simulation of the underlying natural gas price is conducted using a mean-reverting

Illustrates how the Financial Instruments Toolbox™ is used to price European vanilla call options using different equity models.

Price a European Asian option using six methods in the Financial Instruments Toolbox™. This example demonstrates four closed form approximations (Kemna-Vorst, Levy, Turnbull-Wakeman,

Price and calculate sensitivities for European and American spread options using various techniques. First, the price and sensitivities for a European spread option is calculated using

Illustrates how MATLAB® can be used to create a portfolio of interest-rate derivatives securities, and price it using the Black-Karasinski interest-rate model. The example also shows

Price Bermudan swaptions using interest-rate models in Financial Instruments Toolbox™. Specifically, a Hull-White one factor model, a Linear Gaussian two-factor model, and a LIBOR

Illustrates how the Financial Instruments Toolbox™ is used to create a Black-Derman-Toy (BDT) tree and price a portfolio of instruments using the BDT model.

Use ZeroRates for a zero curve that is hard-coded. You can also create a zero curve by bootstrapping the zero curve from market data (for example, deposits, futures/forwards, and swaps)

Price a swaption using the SABR model. First, a swaption volatility surface is constructed from market volatilities. This is done by calibrating the SABR model parameters separately for

Hedge the interest-rate risk of a portfolio using bond futures.

Price swaptions with negative strikes by using the Shifted SABR model. The market Shifted Black volatilities are used to calibrate the Shifted SABR model parameters. The calibrated

Model prepayment in MATLAB® using functionality from the Financial Instruments Toolbox™. Specifically, a variation of the Richard and Roll prepayment model is implemented using a two

Illustrates how the Financial Toolbox™ and Financial Instruments Toolbox™ are used to price a level mortgage backed security using the BDT model.

Use an underlying mortgage-backed security (MBS) pool for a 30-year fixed-rate mortgage of 6% to define a PAC bond, and then define a sequential CMO from the PAC bond. Analyze the CMO by

Bootstrap an interest-rate curve, often referred to as a swap curve, using the IRDataCurve object. The static bootstrap method takes as inputs a cell array of market instruments (which can

Construct a Diebold Li model of the US yield curve for each month from 1990 to 2010. This example also demonstrates how to forecast future yield curves by fitting an autoregressive model to the

Use IRFunctionCurve objects to model the term structure of interest rates (also referred to as the yield curve). This can be contrasted with modeling the term structure with vectors of dates

Analyze inflation indexed instruments using Financial Toolbox™ and Financial Instruments Toolbox™.

In this script we will produce a number of visuals for the simulated rates when using HW model.

Copyright 2017 - 2017 The MathWorks, Inc.

Use two different methods to calibrate the SABR stochastic volatility model from market implied Normal (Bachelier) volatilities with negative strikes. Both approaches use

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office