# cfprice

Compute price for cash flow given yield to maturity

## Description

example

Price = cfprice(CFlowAmounts,CFlowDates,Yield,Settle) computes a price given yield for a cash flow.

example

Price = cfprice(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax.

## Examples

collapse all

Use cfprice to compute the price for a cash flow given yield to maturity.

Define data for the yield curve.

Settle = datenum('01-Jul-2003');
Yield = .05;
CFAmounts = [30;40;30];
CFDates = datenum({'15-Jul-2004', '15-Jul-2005', '15-Jul-2006'});

Compute the Price.

Price = cfprice(CFAmounts, CFDates, Yield, Settle)
Price = 3×1

28.4999
36.1689
25.8195

Use cfprice to compute the price for a cash flow given yield to maturity using datetime inputs.

Settle = datenum('01-Jul-2003');
Yield = .05;
CFAmounts = [30;40;30];
CFDates = datenum({'15-Jul-2004', '15-Jul-2005', '15-Jul-2006'});

CFDates = datetime(CFDates,'ConvertFrom','datenum','Locale','en_US');
Settle = datetime(Settle,'ConvertFrom','datenum','Locale','en_US');
Price = cfprice(CFAmounts, CFDates, Yield, Settle)
Price = 3×1

28.4999
36.1689
25.8195

## Input Arguments

collapse all

Cash flow amounts, specified as an NINST-by-MOSTCFS matrix. Each row is a list of cash flow values for one instrument. If an instrument has fewer than MOSTCFS cash flows, the end of the row is padded with NaNs.

Data Types: double

Cash flow dates, specified as an NINST-by-MOSTCFS matrix. Each entry contains the date of the corresponding cash flow in CFlowAmounts.

Data Types: double | char | datetime

Yields specified as an NINST-by-1 vector.

Data Types: double

Settlement date, specified as an NMBS-by-1 vector using serial date numbers or a cell array of date character vectors. The Settle date is the date on which the cash flows are priced.

Data Types: double | char | cell

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: Price = cfprice(CFlowAmounts,CFlowDates,Yield,Settle,'Basis',4,'CompoundingFrequency',4)

### Note

An optional input of size NINST-by-1 is also acceptable as a single value applicable to all contracts. Single values are internally expanded to an array of size NINST-by-1.

Day-count basis, specified as the comma-separated pair consisting of 'Basis' and a positive integer using a N-by-1 vector.

• 0 = actual/actual

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (PSA)

• 5 = 30/360 (ISDA)

• 6 = 30/360 (European)

• 7 = actual/365 (Japanese)

• 8 = actual/actual (ICMA)

• 9 = actual/360 (ICMA)

• 10 = actual/365 (ICMA)

• 11 = 30/360E (ICMA)

• 12 = actual/365 (ISDA)

• 13 = BUS/252

Data Types: double

Compounding frequency, specified as the comma-separated pair consisting of 'CompoundingFrequency' and a positive integer using a N-by-1 vector.

• 0 = actual/actual

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (PSA)

• 5 = 30/360 (ISDA)

• 6 = 30/360 (European)

• 7 = actual/365 (Japanese)

• 8 = actual/actual (ICMA)

• 9 = actual/360 (ICMA)

• 10 = actual/365 (ICMA)

• 11 = 30/360E (ICMA)

• 12 = actual/365 (ISDA)

• 13 = BUS/252

Data Types: double

Compounding frequency for yield calculation, specified as the comma-separated pair consisting of 'CompundingFrequency' and a scalar or a NUMBONDS-by-1 or 1-by-NUMBONDS vector.

• 1 — Annual compounding

• 2 — Semiannual compounding

• 3 — Compounding three times per year

• 4 — Quarterly compounding

• 6 — Bimonthly compounding

• 12 — Monthly compounding

### Note

By default, SIA bases (0-7) and BUS/252 use a semiannual compounding convention and ICMA bases (8-12) use an annual compounding convention.

Data Types: double

## Output Arguments

collapse all

Price of cash flows, returned as an NINST-by-1 vector.