%% Compute the Agency OAS Value
% This example shows how to compute the agency OAS value.

Settle = datenum('20-Jan-2010');
ZeroRates = [.07 .164 .253 1.002 1.732 2.226 2.605 3.316 ...
3.474 4.188 4.902]'/100;
ZeroDates = daysadd(Settle,360*[.25 .5 1 2 3 4 5 7 10 20 30],1);
ZeroData = [ZeroDates ZeroRates];
 
Maturity = datenum('30-Dec-2013');
CouponRate = .022;
Price = 99.155;
Vol = .5117;
CallDate = datenum('30-Dec-2010');
OAS = agencyoas(ZeroData, Price, CouponRate, Settle, Maturity, Vol, CallDate)

% Copyright 2015 The MathWorks, Inc.