# cdai

Accrued interest on certificate of deposit

## Syntax

``AccrInt = cdai(CouponRate,Settle,Maturity,IssueDate)``
``AccrInt = cdai(___,Basis)``

## Description

````AccrInt = cdai(CouponRate,Settle,Maturity,IssueDate)` computes the accrued interest on a certificate of deposit.`cdai` assumes that the certificates of deposit pay interest at maturity. Because of the simple interest treatment of these securities, this function is best used for short-term maturities (less than 1 year). The default simple interest calculation uses the `Basis` for the actual/360 convention (`2`). ```

example

````AccrInt = cdai(___,Basis)` adds an optional argument for `Basis`. ```

example

## Examples

collapse all

This example shows how to compute the accrued interest due, given a certificate of deposit with the following characteristics.

```CouponRate = 0.05; Settle = '02-Jan-02'; Maturity = '31-Mar-02'; IssueDate = '1-Oct-01'; AccrInt = cdai(CouponRate, Settle, Maturity, IssueDate)```
```AccrInt = 1.2917 ```

This example shows how to use `datetime` inputs to compute the accrued interest due, given a certificate of deposit with the following characteristics.

```CouponRate = 0.05; Settle = datetime('02-Jan-02','Locale','en_US'); Maturity = datetime('31-Mar-02','Locale','en_US'); IssueDate = datetime('1-Oct-01','Locale','en_US'); AccrInt = cdai(CouponRate, Settle, Maturity, IssueDate)```
```AccrInt = 1.2917 ```

## Input Arguments

collapse all

Annual interest rate, specified as decimal using a scalar or a `NCDS`-by-`1` or `1`-by-`NCDS` vector.

Data Types: `double`

Settlement date for the certificate of deposit, specified as a scalar or a `NCDS`-by-`1` or `1`-by-`NCDS` vector using a datetime array, string array, or date character vectors. The `Settle` date must be before the `Maturity` date.

To support existing code, `cdai` also accepts serial date numbers as inputs, but they are not recommended.

Data Types: `char` | `string` | `datetime`

Maturity date for the certificate of deposit, specified as a scalar or a `NCDS`-by-`1` or `1`-by-`NCDS` vector using a datetime array, string array, or date character vectors.

To support existing code, `cdai` also accepts serial date numbers as inputs, but they are not recommended.

Data Types: `char` | `string` | `datetime`

Issue date for the certificate of deposit, specified as a scalar or a `NCDS`-by-`1` or `1`-by-`NCDS` vector using a datetime array, string array, or date character vectors.

To support existing code, `cdai` also accepts serial date numbers as inputs, but they are not recommended.

Data Types: `char` | `string` | `datetime`

(Optional) Day-count basis for the certificate of deposit, specified as a scalar or a `NINST`-by-`1` vector. Values are:

• 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`

## Output Arguments

collapse all

Accrued interest per \$100 of face value, returned as a `NCDS`-by-`1` or `1`-by-`NCDS` vector.

## Version History

Introduced before R2006a

expand all