Mortgage-backed security price given yield
[Price, AccrInt] = mbsprice(Yield, Settle, Maturity, IssueDate,
GrossRate, CouponRate, Delay, PrepaySpeed, PrepayMatrix)
Mortgage yield, compounded monthly (in decimal).
Settlement date. A serial date number or date string. Settle must be earlier than Maturity.
Maturity date. A serial date number or date string.
Issue date. A serial date number or date string.
Gross coupon rate (including fees), in decimal.
(Optional) Net coupon rate, in decimal. Default = GrossRate.
(Optional) Delay (in days) between payment from homeowner and receipt by bondholder. Default = 0 (no delay between payment and receipt.
(Optional) Relation of the conditional payment rate (CPR) to the benchmark model. Default = 0 (no prepayment). Set PrepaySpeed to  if you input a customized prepayment matrix.
(Optional) Customized prepayment matrix. A matrix of size max(TermRemaining)-by-NMBS. Missing values are padded with NaNs. Each column corresponds to a mortgage-backed security, and each row corresponds to each month after settlement.
All inputs (except PrepayMatrix) are number of mortgage-backed securities (NMBS) by 1 vectors.
[Price, AccrInt] = mbsprice(Yield, Settle, Maturity, IssueDate, GrossRate, CouponRate, Delay, PrepaySpeed, PrepayMatrix) computes a mortgage-backed security price, given time information, mortgage yield at settlement, and optionally, a prepayment model.
All outputs are scalar values.
Price is the clean price for every $100 face value of the securities.
AccrInt is the accrued interest of the mortgage-backed securities.
This example shows how to determine the mortgage-backed security price given a mortgage-backed security with the following characteristics.
Yield = 0.0725; 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; [Price AccrInt] = mbsprice(Yield, Settle, Maturity, IssueDate,... GrossRate, CouponRate, Delay, Speed)
Price = 101.3147 AccrInt = 0.2917