Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

cfprice

Compute price for cash flow given yield to maturity

Syntax

Price = cfprice(CFAmounts, CFDates, Yield, Settle)
Price = cfprice(CFAmounts, CFDates, Yield, Settle,
Name,Value)

Description

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

Price = cfprice(CFAmounts, CFDates, Yield, Settle,
Name,Value)
computes a price for a cash flow given yield to maturity with additional options specified by one or more Name,Value pair arguments.

Input Arguments

CFlowAmounts

NINST-by-MOSTCFS matrix of cash flow amounts. 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.

CFlowDates

NINST-by-MOSTCFS matrix of cash flow dates, specified as a serial date number, date character vector, or datetime array. Each entry contains the date of the corresponding cash flow in CFlowAmounts.

Yield

NINST-by-1 vector of yields.

Settle

Settlement date, specified as a serial date number, date character vector, or datetime array. Settlement date is the date on which the cash flows are priced.

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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Note:   Any optional input of size N-by-1 is also acceptable as an array of size 1-by-N, or as a single value applicable to all contracts. Single values are internally expanded to an array of size N-by-1.

'Basis'

N-by-1 vector of day-count basis:

  • 0 = actual/actual

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (BMA)

  • 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

For more information, see basis.

Default: 0 (actual/actual)

'CompoundingFrequency'

NINST-by-1 vector of Compounding Frequency. By default, SIA bases (0-7) and BUS/252 use a semiannual compounding convention and ICMA bases (8-12) use an annual compounding convention.

Default: 2

Output Arguments

Price

Price of cash flows.

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 =

   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 =

   28.4999
   36.1689
   25.8195

Related Examples

Introduced in R2012a

Was this topic helpful?