Deposit
Description
Create and price a Deposit
instrument object for one or
more Deposit instruments using this workflow:
Use
fininstrument
to create aDeposit
instrument object for one or more Deposit instruments.Use
ratecurve
to specify an interest-rate model for theDeposit
instrument object.Use
finpricer
to specify aDiscount
pricing method for one or moreDeposit
instruments.
For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
For more information on the available models and pricing methods for a
Deposit
instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a DepositObj
= fininstrument(InstrumentType
,'Maturity
',maturity_date,'Rate
',rate_value)Deposit
object for one or more Deposit
instruments by specifying InstrumentType
and sets the
properties for the
required name-value pair arguments Maturity
and
Rate
.
sets optional properties using
additional name-value pairs in addition to the required arguments in the
previous syntax. For example, DepositObj
= fininstrument(___,Name,Value
)DepositObj =
fininstrument("Deposit",'Maturity',datetime(2019,1,30),'Rate',0.027,'Period',2,'Basis',1,'Principal',100,'BusinessDayConvention',"follow",'Name',"deposit_instrument")
creates a Deposit
instrument with an interest rate of
.027 and a maturity of January 30, 2019. You can specify multiple name-value
pair arguments.
Input Arguments
InstrumentType
— Instrument type
string with value "Deposit"
| string array with values of "Deposit"
| character vector with value 'Deposit'
| cell array of character vectors with values of
'Deposit'
Instrument type, specified as a string with the value of
"Deposit"
, a character vector with the value of
'Deposit'
, an
NINST
-by-1
string array with
values of "Deposit"
, or an
NINST
-by-1
cell array of
character vectors with values of 'Deposit'
.
Data Types: char
| string
Specify required
and 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: DepositObj =
fininstrument("Deposit",'Maturity',datetime(2019,1,30),'Rate',0.027,'Period',2,'Basis',1,'Principal',100,'BusinessDayConvention',"follow",'Name',"deposit_instrument")
Deposit
Name-Value Pair ArgumentsMaturity
— Maturity date
datetime array | string array | date character vector
Maturity date, specified as the comma-separated pair consisting of
'Maturity'
and a scalar or an
NINST
-by-1
vector using a
datetime array, string array, or date character vectors.
To support existing code, Deposit
also
accepts serial date numbers as inputs, but they are not recommended.
If you use date character vectors or strings, the format must be
recognizable by datetime
because
the Maturity
property is stored as a
datetime.
Rate
— Deposit interest rate
scalar decimal | vector of decimals
Deposit interest rate, specified as the comma-separated pair
consisting of 'Rate'
and a scalar decimal or an
NINST
-by-1
vector of
decimals.
Data Types: double
Deposit
Name-Value Pair ArgumentsPeriod
— Frequency of payments per year
1
(default) | scalar numeric value of 0
,
1
, 2
,
3
, 4
, 6
, or
12
| vector of numeric values of 0
,
1
, 2
,
3
, 4
, 6
, or
12
Frequency of payments per year, specified as the comma-separated
pair consisting of 'Period'
and scalar integer or
an NINST
-by-1
vector of
integers. Values for Period
are:
0
, 1
,
2
, 3
, 4
,
6
, or 12
.
Data Types: double
Basis
— Day count basis
0
(actual/actual) (default) | scalar integer from 0
to
13
| vector of integers from 0
to
13
Day count basis, specified as the comma-separated pair consisting
of 'Basis'
and a scalar integer or an
NINST
-by-1
vector of
integers using the following values:
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
— Principal amount
100
(default) | scalar numeric | numeric vector
Principal amount, specified as the comma-separated pair consisting
of 'Principal'
and a scalar numeric or an
NINST
-by-1
numeric
vector.
Data Types: double
BusinessDayConvention
— Business day convention
"actual"
(default) | string | string array | character vector | cell array of character vectors
Business day convention, specified as the comma-separated pair
consisting of 'BusinessDayConvention'
and a
string or character vector or an
NINST
-by-1
cell array of
character vectors or string array. 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 nonbusiness 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 nonbusiness 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
| string
Holidays
— Holidays used in computing business days
NaT
(default) | datetime array | string array | date character vector
Holidays used in computing business days, specified as the
comma-separated pair consisting of 'Holidays'
and
dates using an NINST
-by-1
vector of a datetime array, string array, or date character vectors.
For
example:
H = holidays(datetime('today'),datetime(2025,12,15)); DepositObj = fininstrument("deposit",'Maturity',datetime(2025,12,15),'Rate',0.027,'Holidays',H)
To support existing code, Deposit
also
accepts serial date numbers as inputs, but they are not recommended.
Name
— User-defined name for instrument
" "
(default) | string | string array | character vector | cell array of character vectors
User-defined name for one of more instruments, specified as the
comma-separated pair consisting of 'Name'
and a
scalar string or character vector or an
NINST
-by-1
cell array of
character vectors or string array.
Data Types: char
| cell
| string
Properties
Maturity
— Maturity date
datetime | vector of datetimes
Maturity date, returned as a scalar datetime or an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
Rate
— Deposit interest rate
scalar decimal | vector of decimals
Deposit interest rate, returned as a scalar decimal or an
NINST
-by-1
vector of
decimals.
Data Types: double
Period
— Frequency of payments per year
1
(default) | scalar integer | vector of integers
Frequency of payments per year, returned as a scalar integer or an
NINST
-by-1
vector of
integers.
Data Types: double
Basis
— Day count basis
0
(actual/actual) (default) | scalar integer from 0
to 13
| vector of integers from 0
to
13
Day count basis, returned as a scalar integer or an
NINST
-by-1
vector of integers.
Data Types: double
Principal
— Principal amount
100
(default) | scalar numeric | numeric vector
Principal amount, returned as a scalar numeric or an
NINST
-by-1
numeric vector.
Data Types: double
BusinessDayConvention
— Business day convention
"actual"
(default) | scalar string | string array
Business day convention, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Holidays
— Holidays used in computing business days
NaT
(default) | datetimes
Holidays used in computing business days, returned as an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
Name
— User-defined name for instrument
" "
(default) | string | string array
User-defined name for the instrument, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Object Functions
cashflows | Compute cash flow for FixedBond , FloatBond ,
Swap , FRA , STIRFuture ,
OISFuture , OvernightIndexedSwap , or
Deposit instrument |
Examples
Price Deposit
Instrument Using ratecurve
and Discount
Pricer
This example shows the workflow to price a Deposit
instrument when using a ratecurve
and a Discount
pricing method.
Create Deposit
Instrument Object
Use fininstrument
to create a Deposit
instrument object.
DepositObj = fininstrument("Deposit",'Maturity',datetime(2019,3,15),'Rate',0.0195,'Period',2,'Basis',1,'Principal',100,'Name',"deposit_instrument")
DepositObj = Deposit with properties: Rate: 0.0195 Period: 2 Basis: 1 Maturity: 15-Mar-2019 Principal: 100 BusinessDayConvention: "actual" Holidays: NaT Name: "deposit_instrument"
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Type = 'zero'; ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Discount
Pricer Object
Use finpricer
to create a Discount
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("Discount", 'DiscountCurve',myRC)
outPricer = Discount with properties: DiscountCurve: [1x1 ratecurve]
Price Deposit
Instrument
Use price
to compute the price and sensitivities for the Deposit
instrument.
[Price, outPR] = price(outPricer, DepositObj,["all"])
Price = 0.9725
outPR = priceresult with properties: Results: [1x2 table] PricerData: []
outPR.Results
ans=1×2 table
Price DV01
_______ __________
0.97249 4.8225e-05
Price Multiple Deposit
Instruments Using ratecurve
and Discount
Pricer
This example shows the workflow to price multiple Deposit
instruments when using a ratecurve
and a Discount
pricing method.
Create Deposit
Instrument Object
Use fininstrument
to create a Deposit
instrument object for three Deposit
instruments.
DepositObj = fininstrument("Deposit",'Maturity',datetime([2019,3,15 ; 2019,4,15 ; 2019,5,15]),'Rate',0.0195,'Period',2,'Basis',1,'Principal',[1000 ; 2000 ; 3000],'Name',"deposit_instrument")
DepositObj=3×1 Deposit array with properties:
Rate
Period
Basis
Maturity
Principal
BusinessDayConvention
Holidays
Name
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Type = 'zero'; ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Discount
Pricer Object
Use finpricer
to create a Discount
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value argument.
outPricer = finpricer("Discount", 'DiscountCurve',myRC)
outPricer = Discount with properties: DiscountCurve: [1x1 ratecurve]
Price Deposit
Instruments
Use price
to compute the prices and sensitivities for the Deposit
instruments.
[Price, outPR] = price(outPricer, DepositObj,["all"])
Price = 3×1
9.7249
22.6807
38.8632
outPR=1×3 priceresult array with properties:
Results
PricerData
outPR.Results
ans=1×2 table
Price DV01
______ __________
9.7249 0.00048225
ans=1×2 table
Price DV01
______ _________
22.681 0.0013173
ans=1×2 table
Price DV01
______ _________
38.863 0.0025767
More About
Deposit Instrument
A deposit instrument is an over-the-counter contract between banks for interbank lending.
Version History
Introduced in R2020aR2022b: Serial date numbers not recommended
Although Deposit
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.
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)