Converting an IRDataCurve or IRFunctionCurve
            Object
Introduction
The IRDataCurve and IRFunctionCurve objects for
                interest-rate curves support conversion to:
- A - RateSpecstructure.- The - RateSpecgenerated from an- IRDataCurveor- IRFunctionCurveobject, using the- toRateSpecfunction, is identical to the- RateSpecstructure created with- intenvsetusing Financial Instruments Toolbox™ software.
- A vector of dates and data from an - IRDataCurveobject- The vector of dates and data is acceptable to - prbyzero,- bkcall,- bkput,- tfutbyprice, and- tfutbyyieldor any function that requires a term structure of interest rates.
Using the toRateSpec Function
To convert an IRDataCurve or IRFunctionCurve object to a
                    RateSpec structure, you must first create an interest-rate
                curve object. Then, use the toRateSpec function for an
                    IRDataCurve object or the toRateSpec function for an
                    IRFunctionCurve object. 
Example
Create a data vector from the following data: https://www.ustreas.gov/offices/domestic-finance/debt-management/.
interest-rate/yield.shtml
Data = [1.85 1.84 1.91 2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100; Dates = daysadd(today,[30 90 180 360 2*360 3*360 5*360 7*360 10*360 20*360 30*360],2); scatter(Dates,Data) datetick

Create an IRDataCurve interest-rate
                    curve object.
rr = IRDataCurve('Zero',today,Dates,Data);Convert to a RateSpec.
toRateSpec(rr, today+30:30:today+365)
ans = 
           FinObj: 'RateSpec'
      Compounding: 2
             Disc: [12x1 double]
            Rates: [12x1 double]
         EndTimes: [12x1 double]
       StartTimes: [12x1 double]
         EndDates: [12x1 double]
       StartDates: 733569
    ValuationDate: 733569
            Basis: 0
     EndMonthRule: 1Using Vector of Dates and Data
You can use the getZeroRates function for an
                    IRDataCurve object with a
                    Dates property to create a vector of dates and data
                acceptable for prbyzero in Financial Toolbox™ software and bkcall, bkput, tfutbyprice, and tfutbyyield in Financial Instruments Toolbox software. 
Example
This is an example of using an IRDataCurve object with the
                        getZeroRates function with
                        prbyzero.
Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100; Dates = daysadd(today,[360 2*360 3*360 5*360 7*360 10*360 20*360 30*360],1); irdc = IRDataCurve('Zero',today,Dates,Data,'InterpMethod','pchip'); Maturity = daysadd(today,8*360,1); CouponRate = .055; ZeroDates = daysadd(today,180:180:8*360,1); ZeroRates = getZeroRates(irdc, ZeroDates); BondPrice = prbyzero([Maturity CouponRate], today, ZeroRates, ZeroDates)
BondPrice = 113.9250
See Also
IRBootstrapOptions | IRDataCurve | IRFunctionCurve | IRFitOptions