Financial Instruments Toolbox™ allows you to use either a function-based framework or an alternative object-based framework to create and analyze financial curves.
In the function-based framework, a typical workflow to create an interest-rate curve
uses intenvset
or IRDataCurve
.
CurveSettle = datenum('2-Mar-2016'); Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100; Dates = datemnth(CurveSettle,12*[1 2 3 5 7 10 20 30]); irdc = IRDataCurve('Zero',CurveSettle,Dates,Data)
irdc = Type: Zero Settle: 736391 (02-Mar-2016) Compounding: 2 Basis: 0 (actual/actual) InterpMethod: linear Dates: [8x1 double] Data: [8x1 double]
ratecurve
object: Settle = datetime("15-Sep-2017"); ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates)
ZeroCurve = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10×1 datetime] Rates: [10×1 double] Settle: 15-Sep-2017 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Note
The function-based and object-based workflows can return different prices
even if you use the same data. This is because the existing Financial Instruments Toolbox curve functions use date2time
and the
object-based framework use yearfrac
for date
handling.
The following table lists the Financial Instruments Toolbox curve functions mapped to the associated object-based framework.
Financial Instruments Toolbox Curve Function | Object-Based Framework |
---|---|
IRDataCurve | ratecurve |
getForwardRates | forwardrates |
getZeroRates | zerorates |
getDiscountFactors | discountfactors |
bootstrap | irbootstrap |
IRFunctionCurve | parametercurve |
getForwardRates | forwardrates |
getZeroRates | zerorates |
getDiscountFactors | discountfactors |
fitNelsonSiegel | fitNelsonSiegel |
fitSvensson | fitSvensson |
Not supported | defprobcurve |
Not supported | survprobs |
Not supported | hazardrates |
cdsbootstrap | defprobstrip |