create ratecurve object for interest-凯发k8网页登录
create ratecurve
object for interest-rate curve from dates
and data
since r2020a
description
build a ratecurve
object using
ratecurve
.
after creating a ratecurve
object, you can use the associated
object functions , , and
.
note
if you have the ratespec
obtained previously from
intenvset
or for an or for an , refer to
.
to price a , , , , or instrument, you
must create a ratecurve
object and then create pricer
object.
for more detailed information on this workflow, see .
for more information on the available instruments, models, and pricing methods, see .
creation
description
creates a ratecurve_obj
= ratecurve(___,name,value
)ratecurve
object using name-value pairs and any
of the arguments in the previous syntax. for example, myrc =
ratecurve("zero",settle,zerodates,zerorates,'compounding',2,'basis',5,'interpmethod',"pchip",'shortextrapmethod',"linear",'longextrapmethod',"cubic")
creates a ratecurve
object for a zero curve. you can
specify multiple name-value pair arguments.
input arguments
type
— type of interest-rate curve
string with value "zero"
,
"forward"
, or
"discount"
| character vector with value 'zero'
,
'forward'
, or
'discount'
type of interest-rate curve, specified as a string or character vector for one of the supported types.
data types: char
| string
settle
— settlement date
datetime scalar | string scalar | date character vector
settlement date, specified as a scalar datetime, string, or date character vector.
to support existing code, ratecurve
also
accepts serial date numbers as inputs, but they are not recommended.
if you use a date character vector or string, the format must be
recognizable by because the
settle
property is stored as a datetime.
dates
— dates corresponding to rate data
datetime array | string array | date character vector
dates corresponding to the rate data, specified as vector using a datetime array, string array, or date character vectors.
to support existing code, ratecurve
also
accepts serial date numbers as inputs, but they are not recommended.
if you use a date character vectors or strings, the format must be
recognizable by because the
dates
property is stored as a datetime.
rates
— interest-rate data for the curve
numeric
interest-rate data for the curve, specified as a scalar numeric.
data types: double
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: myrc =
ratecurve("zero",settle,zerodates,zerorates,'compounding',2,'basis',5,'interpmethod',"pchip",'shortextrapmethod',"linear",'longextrapmethod',"cubic")
compounding
— compounding frequency
-1
(default) | possible values include: –1
,
0
, 1
,
2
, 3
, 4
,
6
, or 12
.
compounding frequency, specified as the comma-separated pair
consisting of 'compounding'
and a scalar numeric
using the supported values: –1
,
0
, 1
,
2
, 3
, 4
,
6
, or 12
.
data types: double
basis
— day count basis
0
(actual/actual) (default) | integer from 0
to
13
day count basis, specified as the comma-separated pair consisting
of 'basis'
and a scalar integer.
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 .
data types: double
interpmethod
— interpolation method
"linear"
(default) | string with value "linear"
,
"cubic"
, "next"
,
"previous"
, "pchip"
,
"v5cubic"
, "makima"
, or
"spline"
| character vector with value 'linear'
,
'cubic'
, 'next'
,
'previous'
, 'pchip'
,
'v5cubic'
, 'makima'
, or
'spline'
interpolation method, specified as the comma-separated pair
consisting of 'interpmethod'
and a scalar string
or character vector using a supported value. for more information
on interpolation methods, see .
data types: char
| string
shortextrapmethod
— extrapolation method for data before first data
"next"
(default) | string with value "linear"
,
"next"
, "previous"
,
"pchip"
,
"cubic"
,"v5cubic"
,
"makima"
, or
"spline"
| character vector with value 'linear'
,
'next'
, 'previous'
,
'pchip'
,
'cubic'
,'v5cubic'
,
'makima'
, or
'spline'
extrapolation method for data before first data, specified as the
comma-separated pair consisting of
'shortextrapmethod'
and a scalar string or
character vector using a supported value. for more information on
interpolation methods, see .
data types: char
| string
longextrapmethod
— extrapolation method for data after last data
"previous"
(default) | string with value "linear"
,
"next"
, "previous"
,
"pchip"
,
"cubic"
,"v5cubic"
,
"makima"
, or
"spline"
| character vector with value 'linear'
,
'next'
, 'previous'
,
'pchip'
,
'cubic'
,'v5cubic'
,
'makima'
, or
'spline'
extrapolation method for data after last data, specified as the
comma-separated pair consisting of
'longextrapmethod'
and a scalar string or
character vector using a supported value. for more information on
interpolation methods, see .
data types: char
| string
properties
type
— type of interest-rate curve
string with value "zero"
,
"forward"
, or "discount"
type of interest-rate curve, returned as a string.
data types: string
compounding
— compounding frequency
-1
(default) | possible values include: –1
, 0
,
1
, 2
, 3
,
4
, 6
, or
12
.
compounding frequency, returned as a scalar numeric.
data types: double
basis
— day count basis
0
(actual/actual) (default) | integer from 0
to 13
day count basis of the instrument, returned as a scalar integer.
data types: double
dates
— dates corresponding to rate data
datetime
dates corresponding to the rate data, returned as a datetime.
data types: datetime
rates
— rates corresponding to dates data
vector
rates corresponding to dates data, returned as vector.
data types: datetime
settle
— settlement date
datetime
settlement date, returned as a datetime.
data types: datetime
interpmethod
— interpolation method
"linear"
(default) | string with value "linear"
,
"cubic"
, "next"
,
"previous"
, "pchip"
,
"v5cubic"
, "makima"
, or
"spline"
interpolation method, returned as a scalar string.
data types: string
shortextrapmethod
— short extrapolation method
"next"
(default) | string with value "linear"
, "next"
,
"previous"
, "pchip"
,
"cubic"
,"v5cubic"
,
"makima"
, or "spline"
short extrapolation method, returned as a scalar string.
data types: string
longextrapmethod
— long extrapolation method
"previous"
(default) | string with value "linear"
, "next"
,
"previous"
, "pchip"
,
"cubic"
,"v5cubic"
,
"makima"
, or "spline"
log extrapolation method, returned as a scalar string.
data types: string
object functions
calculate forward rates for ratecurve object | |
calculate discount factors for a ratecurve object | |
calculate zero rates for ratecurve object | |
bootstrap interest-rate curve from market data |
examples
create ratecurve
object
create a ratecurve
object using .
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,'compounding',2,'basis',5,'interpmethod',"pchip",'shortextrapmethod',"linear",'longextrapmethod',"cubic")
myrc = ratecurve with properties: type: "zero" compounding: 2 basis: 5 dates: [10x1 datetime] rates: [10x1 double] settle: 15-sep-2018 interpmethod: "pchip" shortextrapmethod: "linear" longextrapmethod: "cubic"
version history
introduced in r2020ar2022b: serial date numbers not recommended
although ratecurve
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 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 命令
您点击的链接对应于以下 matlab 命令:
请在 matlab 命令行窗口中直接输入以执行命令。web 浏览器不支持 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
- (español)
- (english)
- (english)
europe
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
asia pacific
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)