liborprice
Price swap given swap rate
Syntax
Description
computes the price per $100 notional value of a swap given the swap rate. A positive
result indicates that fixed side is more valuable than the floating side.Price
= liborprice(ThreeMonthRates
,Settle
,Tenor
,SwapRate
)
specifies options using one or more optional arguments in addition to the input
arguments in the previous syntax.Price
= liborprice(___,StartDate
,Interpolation
,ConvexAdj
,RateParam
,InArrears
,Sigma
,FixedCompound
,FixedBasis
)
Examples
Compute the Price Per $100 Notional Value of a Swap Given the Swap Rate
This example shows that a swap paying the par swap rate has a value of 0
.
% load the input data [EDFutData, textdata] = xlsread('EDdata.xls'); Settle = datetime(2002,10,15); Tenor = 2; % compute the fixed rate from the Eurodollar data FixedSpec = liborfloat2fixed(EDFutData(:,1:3), Settle, Tenor)
FixedSpec = struct with fields:
Coupon: 0.0222
Settle: '16-Oct-2002'
Maturity: '16-Oct-2004'
Period: 4
Basis: 1
% compute the price of a par swap
Price = liborprice(EDFutData(:,1:3), Settle, Tenor, FixedSpec.Coupon)
Price = 3.4694e-15
Price
is effectively equal to 0.
Input Arguments
ThreeMonthRates
— Three-month Eurodollar futures data or forward rate agreement data
matrix
Three-month Eurodollar futures data or forward rate agreement data,
specified as an N
-by-3
matrix in the
form of [month year IMMQuote]
. A forward rate agreement
stipulates that a certain interest rate applies to a certain principal
amount for a given future time period. The floating rate is assumed to
compound quarterly and to accrue on an actual/360 basis.
Data Types: double
Settle
— Settlement date of fixed-rate of swap
datetime scalar | string scalar | date character vector
Settlement date of fixed-rate of swap, specified as a scalar datetime, string, or date character vector.
To support existing code, liborprice
also
accepts serial date numbers as inputs, but they are not recommended.
Tenor
— Life of the swap contract
scalar integer
Life of the swap contract, specified as a scalar integer.
Data Types: double
SwapRate
— Swap rate
scalar decimal
Swap rate, specified as a scalar decimal.
Data Types: double
StartDate
— Reference date for valuation of forward swap
Settle
(default) | datetime scalar | string scalar | date character vector
(Optional) Reference date for valuation of forward swap, specified as a scalar datetime, string, or date character vector. This in effect allows forward swap valuation.
To support existing code, liborprice
also
accepts serial date numbers as inputs, but they are not recommended.
Interpolation
— Interpolation method to determine applicable forward rate for months when no Eurodollar data is available
'linear'
(1
) (default) | scalar integer with value of 0
, 1
, or 2
(Optional) Interpolation method to determine applicable forward rate for months when no Eurodollar data is available, specified as a scalar numeric with values of:
0
is'nearest'
1
is'linear'
2
is'cubic'
.
Data Types: double
ConvexAdj
— Indicates whether futures/forward convexity adjustment is required
0
(off) (default) | scalar logical with a value of 0
or 1
(Optional) Indicates whether futures/forward convexity adjustment is
required, specified as a scalar logical. Use ConvexAdj
for forward rate adjustments when those rates are taken from Eurodollar
futures data.
Data Types: logical
RateParam
— Short-rate model's parameters (Hull-White)
[0.05 0.015]
(default) | vector
(Optional) Short-rate model's parameters (Hull-White), specified a
1
-by-2
vector to denote the
parameters [a S]
, where the short-rate process is:
Data Types: double
InArrears
— Indicates whether the swap is in arrears
0
(off) (default) | scalar logical with a value of 0
or 1
(Optional) Indicates whether the swap is in arrears, specified as a scalar logical.
Data Types: logical
Sigma
— Overall annual volatility of caplets
scalar numeric
(Optional) Overall annual volatility of caplets, specified as a scalar numeric.
Data Types: double
FixedCompound
— Compounding or frequency of payment on the fixed side
4
(quarterly) (default) | scalar numeric with possible values of 1
, 2
,4
, or 12
(Optional) Compounding or frequency of payment on the fixed side, specified as a scalar numeric with one of the following possible values:
1
is annual2
is semiannual4
is quarterly12
is monthly
Data Types: double
FixedBasis
— Basis of the fixed side
0
(actual/actual ) (default) | scalar numeric
(Optional) Basis of the fixed side, specified as a scalar numeric using one of the supported values:.
0 = actual/actual (default)
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)
For more information, see Basis.
Data Types: double
Output Arguments
Price
— Present value of the difference between floating and fixed-rate sides of the swap per $100 notional
numeric
Present value of the difference between floating and fixed-rate sides of the swap per $100 notional, returned as a numeric value.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although liborprice
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.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)