## Mapping Financial Instruments Toolbox Curve Functions to Object-Based Framework

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 = datetime(2016,3,2); 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]```
By contrast, in the Financial Instruments Toolbox object-based workflow, you create a `ratecurve` object:
```Settle = datetime(2017,9,15); 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.