Workflow to Price an Interest-Rate Instrument

Price a financial instrument with a zero curve. Such an instrument has no embedded optionality, in other words, the cash flows are deterministic and valuing the instrument is simply a matter of generating the cash flows and then computing the present value of the cash flows by generating corresponding discount factors from the zero curve. For more information on the supported interest-rate instruments, see Choose Instruments, Models, and Pricers.

Price Vanilla `FixedBond` Instrument Using `ratecurve` and `Discount` Pricer

This example shows the workflow to price a vanilla F`ixedBond` instrument when you use a `ratecurve` and a `Discount` pricing method.

Create `FixedBond` Instrument Object

Use `fininstrument` to create a `FixedBond` instrument object.

`FixB = fininstrument("FixedBond",'Maturity',datetime(2022,9,15),'CouponRate',0.021,'Period',2,'Basis',1,'Principal',100,'Name',"fixed_bond_instrument")`
```FixB = FixedBond with properties: CouponRate: 0.0210 Period: 2 Basis: 1 EndMonthRule: 1 Principal: 100 DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate: NaT Maturity: 15-Sep-2022 Name: "fixed_bond_instrument" ```

Create `ratecurve` Object

Create a `ratecurve` object using `ratecurve`.

```Settle = datetime(2018,9,15); Type = 'zero'; 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; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)```
```myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous" ```

Create `Discount` Pricer Object

Use `finpricer` to create a `Discount` pricer object and use the `ratecurve` object with the `'DiscountCurve'` name-value pair argument.

`outPricer = finpricer("Discount",'DiscountCurve',myRC)`
```outPricer = Discount with properties: DiscountCurve: [1x1 ratecurve] ```

Price `FixedBond` Instrument

Use `price` to compute the price and sensitivities for the `FixedBond` instrument.

`[Price, outPR] = price(outPricer, FixB,["all"])`
```Price = 104.5679 ```
```outPR = priceresult with properties: Results: [1x2 table] PricerData: [] ```
`outPR.Results`
```ans=1×2 table Price DV01 ______ ________ 104.57 0.040397 ```