# Fixed income in Matlab 26-Apr 1800

Post to:

Description
Fixed income in Matlab 26-Apr 1800

Type: ppt

Discussion

I think that you need to look at this blog article https://justdomyhomework.com/blog/plot-structure for some plot structure writing tips. This could be useful

46 days 18 hours 23 minutes ago

Presentation Transcript

Class 2: Fixed Income for MATLAB : Class 2: Fixed Income for MATLAB 26 April 6:00 PM IST No background required to understand this class Class By: Shivgan Presentation By: Arpit www.qcfinance.in 1

PowerPoint Presentation : 2

Understanding MATLAB Framework to used FI toolbox : Understanding MATLAB Framework to used FI toolbox Array Indexing (flipping, reversing, extracting elements) Functions (optional inputs) Graphs & plots (which things to use in graph) Structure (storing elements and extracting a few of them) Constructers 3

How to use examples? What to be Cautious? : How to use examples? What to be Cautious? Be Cautious while using: Spaces Brackets … “ vs ‘ vs other similar other same synatx Date formats other errors in syntax 4

Date Format : Date Format Datenum Convert date and time to serial date number http://www.mathworks.in/help/matlab/ref/datenum.html 5

Price Fixed-Income Instruments : Price Fixed-Income Instruments List of command and Examples http://www.mathworks.in/help/finance/pricing-and-computing-yields-for-fixed-income-securities.html http://www.mathworks.in/help/finance/price-fixed-income-instruments.html 6

Contents of FI Toolbox : Contents of FI Toolbox MBS Debt Instruments (LIBOR & Bills) Derivatives Interest rate pricings 7

MBS : MBS Conditional prepayment rate (CPR) and single monthly mortality (SMM) rate CPR is the percentage of outstanding principal prepaid in 1 year SMM is the percentage of outstanding principal prepaid in 1 month (CPR is an annual version of SMM) 8

Generating Prepayment Vectors : Generating Prepayment Vectors You can generate PSA multiple prepayment vectors quickly. To generate prepayment vectors of 100 and 200 PSA, type PSASpeed = [100, 200]; [CPR, SMM] = psaspeed2rate( PSASpeed ); http://www.bondmarkets.com/UP/default.shtml 9

Generic Inputs to Functions (MBS) : Generic Inputs to Functions (MBS) Because of the generic, all-purpose nature of the toolbox pass-through functions, you can fine-tune them to conform to a particular mortgage. Most functions require at least this set of inputs: Gross coupon rate Settlement date Issue (effective) date Maturity date Typical optional inputs include standard prepayment speed (or customized vector), net coupon rate (if different from gross coupon rate), and payment delay in number of days 10

PSA, MBS CF, MBS DUR (from help) : PSA, MBS CF, MBS DUR (from help) PSASpeed = [100, 200]; [CPR, SMM] = psaspeed2rate( PSASpeed ); [ CFlowAmounts , CFlowDates , TFactors , Factors] = mbscfamounts (Settle, Maturity, IssueDate , GrossRate , CouponRate , Delay, [], PrepayMatrix ); [ YearDuration , ModDuration ] = mbsdurp (Price, Settle, Maturity, IssueDate , GrossRate , CouponRate , Delay, Speed) 11

Simple example MBS (from help) : Simple example MBS (from help) Price = [95; 100; 105]; Settle = datenum ('15-Apr-2002'); Maturity = datenum ('1-Jan-2030'); IssueDate = datenum ('1-Jan-2000'); GrossRate = 0.08125; CouponRate = 0.075; Delay = 14; Speed = 100; [ YearDuration , ModDuration ] = mbsdurp (Price, Settle, Maturity, IssueDate , GrossRate , CouponRate , Delay, Speed) 12

OAS : OAS OAS = mbsprice2oas( ZeroMatrix , Price, Settle, Maturity, IssueDate , GrossRate , CouponRate , Delay, Interpolation, PrepaySpeed ) http://en.wikipedia.org/wiki/Option-adjusted_spread 13

OAS : OAS Prepayment alters the cash flows of an otherwise regularly amortizing mortgage pool. A comprehensive option-adjusted spread calculation typically begins with the generation of a set of paths of spot rates to predict prepayment. A path is collection of i spot-rate paths, with corresponding j cash flows on each of those paths. The effect of the OAS on pool pricing is shown mathematically in the following equation, where K represents the option-adjusted spread. 14

Playing with Array - see excel arrays inverse function : Playing with Array - see excel arrays inverse function 0.025 * (1./[1:6]') Pre requisite her: dot operator and prime (‘) Bonds = [ datenum ('11/21/2002') 0 100 0 2 1; datenum ('02/20/2003') 0 100 0 2 1; datenum ('07/31/2004') 0.03 100 2 3 1; datenum ('08/15/2007') 0.035 100 2 3 1; datenum ('08/15/2012') 0.04875 100 2 3 1; datenum ('02/15/2031') 0.05375 100 2 3 1]; 15

Debt Instruments (Examples) : Debt Instruments (Examples) Treasury Bills Computing Treasury Bill Price and Yield Using Zero-Coupon Bonds (use example) Stepped-Coupon Bonds Term Structure Calculations 16

Bills & Bonds : Bills & Bonds Treasury bills are short-term securities (issued with maturities of 1 year or less) sold by the United States Treasury, sold are frequent, usually weekly A zero-coupon bond is a corporate, Treasury, or municipal debt instrument that pays no periodic interest, redeemed at maturity for its full face value 17

Term Structure Calculations : Term Structure Calculations Generation of TS curves starts with a series of on-the-run and selected off-the-run issues as inputs MATLAB software uses these bonds to find spot rates one at a time, from the shortest maturity onwards, using bootstrap techniques All cash flows are used to construct the spot curve, and rates between maturities (for these coupons) are interpolated linearly. 18

Available treasury bonds : Available treasury bonds We generally have few rates and the rest we would like to interpolate In the example ahead we have the calculations 19

Term Structure Calculations : Term Structure Calculations Bonds = [ datenum ('04/17/2003') 0 100; datenum ('07/17/2003') 0 100; datenum ('12/31/2004') 0.0175 100; datenum ('11/15/2007') 0.03 100; datenum ('11/15/2012') 0.04 100; datenum ('02/15/2031') 0.05375 100]; Then specify the corresponding yields. Yields = [0.0115;0.0118;0.0168;0.0297;0.0401;0.0492]; You are now ready to compute the spot curve for each of these six maturities. The spot curve is based upon a settlement date of January 17, 2003. Settle = datenum ('17-Jan-2003'); [ ZeroRates , CurveDates ] = zbtyield (Bonds, Yields, Settle) This gets you the Treasury spot curve for the day. You can compute the forward curve from this spot curve with zero2fwd. [ ForwardRates , CurveDates ] = zero2fwd( ZeroRates , CurveDates , ... Settle) 20

Derivative Securities : Derivative Securities Pricing and Hedging Convertible Bond Valuation Treasury Bond Futures 21

Binomial model : Binomial model FIT uses a binomial and trinomial tree approach ( cbprice ) to value convertible bonds Once the stock evolution is modeled, backward discounting is computed 22

Function Reference : Function Reference Cash Flows Work with cash flows for bond portfolios Certificates of Deposit Work with certificates of deposit Convertible Bonds Work with convertible bonds Derivative Securities Work with derivative securities Interest-Rate Curve Objects Work with interest-rate curve objects Mortgage-Backed Securities Work with mortgage-backed securities Option-Adjusted Spread Computations Work with option-adjusted spread computations Stepped-Coupon Bonds Work with stepped-coupon bonds Treasury Bills Work with Treasury bills Treasury Bond Futures Work with treasury bond futures Zero-Coupon Instruments Work with zero-coupon instruments 23

Using Interest-Rate Curve Objects : Using Interest-Rate Curve Objects Fixed-Income Toolbox software provides tools for analyzing the term structure of interest rates, including bootstrapping and fitting the term structure to market data using parametric models (e.g., Nelson-Siegel and Svensson ), spline -based models, and user-defined functions. Fixed-Income Toolbox supports three class objects. 24

Interest Rate Curve Objects : Interest Rate Curve Objects @ IRCurve Creates an interest-rate curves and includes methods for extracting forward, zero, and discount factors curves. Supports a method to convert to a RateSpec structure, which is an acceptable input format for the Financial Derivatives Toolbox™ functionintenvset . @ IRDataCurve Represents interest-rate curves based on vectors of dates and data. This class supports bootstrapping an interest-rate curve from market instruments with a range of interpolation methods. @ IRFunctionCurve Represents an interest-rate curve with a function; the function can be specified directly, or a form of the function can be specified and then the parameters are fit to available market data. In addition, you can determine which type of interest-rate curve (zero, forward, or discount curve) fits the market data, as well as, any custom functions. 25

Treasury Bond Futures : Treasury Bond Futures A marketable, fixed-interest U.S. government debt security with a maturity of more than 10 years. Treasury bonds make interest payments semi-annually and the income that holders receive is only taxed at the federal level. Treasury bonds are issued with a minimum denomination of \$1,000. The bonds are initially sold through auction in which the maximum purchase amount is \$5 million if the bid is non-competitive or 35% of the offering if the bid is competitive. A competitive bid states the rate that the bidder is willing to accept; it will be accepted depending on how it compares to the set rate of the bond. A non-competitive bid ensures that the bidder will get the bond but he or she will have to accept the set rate. After the auction, the bonds can be sold in the secondary market. 26

CMO : CMO cmosched  |  cmoschedcf  |  cmoseqcf  |  mbscfamounts  |  mbspassthrough Not in 2009 http://www.mathworks.in/help/fininst/using-collateralized-debt-obligations-cmo-.html http://www.mathworks.in/help/fininst/cmoschedcf.html http://www.mathworks.in/help/fininst/mbscfamounts.html http://www.mathworks.in/help/fininst/cmoseqcf.html http://www.mathworks.in/help/fininst/example-collateralized-debt-obligations-cmos-.html 27

Boot strapping : Boot strapping http://en.wikipedia.org/wiki/Bootstrapping_(finance) http://www.mathworks.in/help/fininst/examples/bootstrapping-a-swap-curve.html 28

Reference CFA L2 : Reference CFA L2 MBS Basics – OAS Calculating Key Rate Durations for Bonds 29

PowerPoint Presentation : THANK YOU 30

|

Shivgan Joshi