Financial Toolbox    
cfport

Portfolio form of cash flow amounts

Syntax

Arguments

CFlowAmounts
Number of bonds (NUMBONDS) by number of cash flows (NUMCFS) matrix with entries listing cash flow amounts corresponding to each date in CFlowDates.
CFlowDates
NUMBONDS-by-NUMCFS matrix with rows listing cash flow dates for each bond and padded with NaNs.
TFactors
(Optional) NUMBONDS-by-NUMCFS matrix with entries listing the time between settlement and the cash flow date measured in semi-annual coupon periods.

Description

[CFBondDate, AllDates, AllTF, IndByBond] = cfport(CFlowAmounts, CFlowDates, TFactors) computes a vector of all cash flow dates of a bond portfolio, and a matrix mapping the cash flows of each bond to those dates. Use the matrix for pricing the bonds against a curve of discount factors.

CFBondDate is a NUMBONDS by number of dates (NUMDATES) matrix of cash flows indexed by bond and by date in AllDates. Each row contains a bond's cash flow values at the indices corresponding to entries in AllDates. Other indices in the row contain zeros.

AllDates is a NUMDATES-by-1 list of all dates that have any cash flow from the bond portfolio.

AllTF is a NUMDATES-by-1 list of time factors corresponding to the dates in AllDates. If TFactors is not entered, AllTF contains the number of days from the first date in AllDates.

IndByBond is a NUMBONDS-by-NUMCFS matrix of indices. The ith row contains a list of indices into AllDates where the ith bond has cash flows. Since some bonds have more cash flows than others, the matrix is padded with NaNs.

Examples

Use cfamounts to calculate the cash flow amounts, cash flow dates, and time factors for each of two bonds. Then use cfplot to plot the cash flow diagram.

Finally, call cfport to map the cash flow amounts to the cash flow dates.

Each row in the resultant CFBondDate matrix represents a bond. Each column represents a date on which one or more of the bonds has a cash flow. A 0 means the bond did not have a cash flow on that date. The dates associated with the columns are listed in AllDates. For example, the first bond had a cash flow of 2.000 on 730347. The second bond had no cash flow on this date.

For each bond, IndByBond indicates the columns of CFBondDate, or dates in AllDates, for which a bond has a cash flow.

See Also

cfamounts


  cfdur cftimes