# floatmargin

Margin measures for floating-rate bond

## Syntax

## Description

`[`

calculates margin measures for a floating-rate bond. `Margin`

,`AdjPrice`

] = floatmargin(`Price`

,`Spread`

`Settle`

,`Maturity`

)

Use `floatmargin`

to calculate the following types of margin
measures for a floating-rate bond:

Spread for life

Adjusted simple margin

Adjusted total margin

To calculate the discount margin or zero discount margin, see
`floatdiscmargin`

.

`[`

adds optional name-value pair arguments. `Margin`

,`AdjPrice`

] = floatmargin(___,`Name,Value`

)

## Examples

### Compute Margin Measures for a Floating-Rate Bond

Use `floatmargin`

to compute margin measures for `spreadforlife`

, `adjustedsimple`

, and `adjustedtotal`

for a floating-rate note.

Define data for the floating-rate note.

Price = 99.99; Spread = 50; Settle = datetime(2011,1,20); Maturity = datetime(2012,1,15); LatestFloatingRate = 0.05; StubRate = 0.049; SpotRate = 0.05; Reset = 4; Basis = 2;

Calculate `spreadforlife`

.

Margin = floatmargin(Price, Spread, Settle, Maturity, 'Reset', Reset, 'Basis', Basis)

Margin = 51.0051

Calculate `adjustedsimple`

margin.

[Margin, AdjPrice] = floatmargin(Price, Spread, Settle, Maturity, ... 'SpreadType', 'adjustedsimple', 'RateInfo', [StubRate, SpotRate], ... 'LatestFloatingRate', LatestFloatingRate, 'Reset', Reset, 'Basis', Basis)

Margin = 53.2830

AdjPrice = 99.9673

Calculate `adjustedtotal`

margin.

[Margin, AdjPrice] = floatmargin(Price, Spread, Settle, Maturity, ... 'SpreadType', 'adjustedtotal', 'RateInfo', [StubRate, SpotRate], ... 'LatestFloatingRate', LatestFloatingRate, 'Reset', Reset, 'Basis', Basis)

Margin = 53.4463

AdjPrice = 99.9673

## Input Arguments

`Price`

— Bond prices where spreads are to be computed

matrix

Bond prices where spreads are to be computed, specified as a
`NINST`

-by-`1`

matrix.

**Data Types: **`double`

`Spread`

— Number of basis points over the reference rate

numeric

Number of basis points over the reference rate, specified as a
`NINST`

-by-`1`

matrix.

**Data Types: **`double`

`Settle`

— Settlement date of the floating-rate bonds

datetime array | string array | date character vector

Settlement date of the floating-rate bonds, specified as a scalar or a
`NINST`

-by-`1`

vector using a datetime
array, string array, or date character vectors. If supplied as a
`NINST`

-by-`1`

vector of dates, all
settlement dates must be the same (only a single settlement date is
supported)

To support existing code, `floatmargin`

also
accepts serial date numbers as inputs, but they are not recommended.

**Data Types: **`char`

| `string`

| `datetime`

`Maturity`

— Maturity date of the floating-rate bond

datetime array | string array | date character vector

Maturity date of the floating-rate bond, specified as a
`NINST`

-by-`1`

vector using a datetime
array, string array, or date character vectors.

To support existing code, `floatmargin`

also
accepts serial date numbers as inputs, but they are not recommended.

**Data Types: **`char`

| `string`

| `datetime`

### Name-Value Arguments

Specify optional pairs of arguments as
`Name1=Value1,...,NameN=ValueN`

, where `Name`

is
the argument name and `Value`

is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.

*
Before R2021a, use commas to separate each name and value, and enclose*
`Name`

*in quotes.*

**Example: **```
[Margin,AdjPrice] = floatmargin(Price,Spread,Settle,Maturity,
'SpreadType','adjustedtotal','RateInfo',[StubRate,SpotRate],'LatestFloatingRate',.0445,'Reset',2,'Basis',5)
```

`SpreadType`

— Type of spread to calculate

`spreadforlife`

(default) | `adjustedsimple`

`adjustedtotal`

Type of spread to calculates, specified by type, specified as
`spreadforlife`

,`adjustedsimple`

,
or `adjustedtotal`

.

**Note**

If the `SpreadType`

is
`spreadforlife`

(default), then the
name-value arguments `LatestFloatingRate`

and
`RateInfo`

are not used. If the
`SpreadType`

is
`adjustedsimple`

or
`adjustedtotal`

, then the name-value
arguments `LatestFloatingRate`

and
`RateInfo`

must be specified.

**Data Types: **`double`

`LatestFloatingRate`

— Rate for next floating payment set at last reset date

numeric

Rate for the next floating payment set at the last reset date,
specified as `NINST`

-by-`1`

vector.

**Note**

This rate must be specified for a
`SpreadType`

of
`adjustedsimple`

and
`adjustedtotal`

.

**Data Types: **`double`

`RateInfo`

— Interest-rate information

numeric

interest-rate information, specified as
`NINST`

-by-`2`

vector where
the:

First column is the stub rate between the settlement date and the first coupon rate.

Second column is the reference rate for the term of the floating coupons (for example, the 3-month LIBOR from settlement date for a bond with a

`Reset`

of`4`

).

**Note**

The `RateInfo`

must be specified for
`SpreadType`

of
`adjustedsimple`

and
`adjustedtotal`

.

**Data Types: **`double`

`Reset`

— Frequency of payments per year

`1`

(default) | numeric

Frequency of payments per year, specified as
`NINST`

-by-`1`

vector.

**Data Types: **`double`

`Basis`

— Day-count basis used for time factor calculations

`0`

(actual/actual) (default) | integers of the set `[0...13]`

| vector of integers of the set `[0...13]`

Day-count basis used for time factor calculations, specified as 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

For more information, see Basis.

**Data Types: **`double`

`Principal`

— Notional principal amounts

`100`

(default) | numeric

Notional principal amounts, specified as
`NINST`

-by-`1`

vector.

**Data Types: **`double`

`EndMonthRule`

— End-of-month rule flag

`1`

(in effect) (default) | nonnegative integer `0`

or
`1`

End-of-month rule flag, specified as a
`NINST`

-by-`1`

vector. This
rule applies only when `Maturity`

is an
end-of-month date for a month having 30 or fewer days.

`0`

= Ignore rule, meaning that a bond coupon payment date is always the same numerical day of the month.`1`

= Set rule on, meaning that a bond coupon payment date is always the last actual day of the month.

**Data Types: **`logical`

`Holidays`

— Dates for holidays

`holidays.m`

used (default) | datetime array | string array | date character vector

Dates for holidays, specified as
`NHOLIDAYS`

-by-`1`

vector using a
datetime array, string array, or date character vectors. Holidays are
used in computing business days.

To support existing code, `floatmargin`

also
accepts serial date numbers as inputs, but they are not recommended.

**Data Types: **`char`

| `string`

| `datetime`

`BusinessDayConvention`

— Business day conventions

`'actual'`

(default) | character vector with values`'actual'`

,
`'follow'`

,
`'modifiedfollow'`

, `'previous'`

or
`'modifiedprevious'`

Business day conventions, specified as a
`NINST`

-by-`1`

cell array of
character vectors of business day conventions to be used in
computing payment dates. The selection for business day convention
determines how nonbusiness days are treated. Nonbusiness days are
defined as weekends plus any other date that businesses are not open
(for example, statutory holidays). Values are:

`'actual'`

— Nonbusiness days are effectively ignored. Cash flows that fall on non-business days are assumed to be distributed on the actual date.`'follow'`

— Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day.`'modifiedfollow'`

— Cash flows that fall on a non-business day are assumed to be distributed on the following business day. However if the following business day is in a different month, the previous business day is adopted instead.`'previous'`

— Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day.`'modifiedprevious'`

— Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day. However if the previous business day is in a different month, the following business day is adopted instead.

**Data Types: **`char`

| `cell`

## Output Arguments

`Margin`

— Spreads for floating-rate bond

numeric

Spreads for the floating-rate bond, returned as a
`NINST`

-by-`1`

vector.

`AdjPrice`

— Adjusted price used to calculate spreads for `SpreadType`

of `adjustedsimple`

and
`adjustedtotal`

numeric

Adjusted price used to calculate spreads for
`SpreadType`

of `adjustedsimple`

and `adjustedtotal`

, returned as a
`NINST`

-by-`1`

vector.

## References

[1] Fabozzi, Frank J., Mann, Steven V. *Floating-Rate
Securities.* John Wiley and Sons, New York, 2000.

[2] Fabozzi, Frank J., Mann, Steven V. *Introduction to Fixed Income
Analytics: Relative Value Analysis, Risk Measures and Valuation.*
John Wiley and Sons, New York, 2010.

## Version History

**Introduced in R2012b**

### R2022b: Serial date numbers not recommended

Although `floatmargin`

supports serial date numbers,
`datetime`

values are recommended instead. The
`datetime`

data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.

To convert serial date numbers or text to `datetime`

values, use the `datetime`

function. For example:

t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)

y = 2021

There are no plans to remove support for serial date number inputs.

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)