# price

Compute price for interest-rate instrument with `Future` pricer

Since R2022a

## Syntax

``[Price,PriceResult] = price(inpPricer,inpInstrument)``

## Description

example

````[Price,PriceResult] = price(inpPricer,inpInstrument)` computes the instrument price and related pricing information based on the pricing object `inpPricer` and the instrument object `inpInstrument`.The `price` function computes the value of the futures contract for the party that is long (not short) for the underlying asset, assuming the contract is held until maturity like a forward contract. If the price is negative for the party that is long, then the value is positive for the other party that is short. If the price is positive for the party that is long, then the value is negative for the other party that is short.```

## Examples

collapse all

This example shows the workflow to price a `BondFuture` instrument when you use a `ratecurve` object and a `Future` pricing method.

Create `ratecurve` Object

Create a `ratecurve` object using `ratecurve`.

```Settle = datetime(2022,3,1); 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,Compounding=2);```

Create Underlying `FixedBond` Instrument Object

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

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

Create `BondFuture` Instrument Object

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

`BondFut = fininstrument("BondFuture",Maturity=datetime(2022,9,1),QuotedPrice=86,Bond=FixB,ConversionFactor=1.43,Name="bondfuture_instrument")`
```BondFut = BondFuture with properties: Maturity: 01-Sep-2022 QuotedPrice: 86 Bond: [1x1 fininstrument.FixedBond] ConversionFactor: 1.4300 Notional: 100000 Name: "bondfuture_instrument" ```

Create `Future` Pricer Object

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

`outPricer = finpricer("Future",DiscountCurve=ZeroCurve,SpotPrice=125)`
```outPricer = Future with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 125 ```

Price `BondFuture` Instrument

Use `price` to compute the price and price result for the `BondFuture` instrument.

`[Price,outPR] = price(outPricer,BondFut)`
```Price = -151.9270 ```
```outPR = priceresult with properties: Results: [1x4 table] PricerData: [] ```
`outPR.Results`
```ans=1×4 table Price FairDeliveryPrice FairFuturePrice AccruedInterest _______ _________________ _______________ _______________ -151.93 1.2283e+05 85.893 0 ```

## Input Arguments

collapse all

Pricer object, specified as a scalar `Future` pricer object. Use `finpricer` to create the `Future` pricer object.

Data Types: `object`

Instrument object, specified as a scalar or vector for `BondFuture`, `CommodityFuture`, `FXFuture`, or `EquityIndexFuture` instrument objects. Use `fininstrument` to create these instrument objects.

Data Types: `object`

## Output Arguments

collapse all

Instrument price, returned as a numeric.

Price result, returned as an object. The `PriceResult.Results` is a table of results that includes `Price`, `FairDeliveryPrice`, `FairFuturePrice`, and `AccruedInterest`.

## Version History

Introduced in R2022a