main content

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

ratecurve_obj = ratecurve(type,settle,dates,rates) creates a ratecurve object.

ratecurve_obj = ratecurve(___,name,value) creates a 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 of interest-rate curve, specified as a string or character vector for one of the supported types.

data types: char | string

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 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.

interest-rate data for the curve, specified as a scalar numeric.

data types: double

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: myrc = ratecurve("zero",settle,zerodates,zerorates,'compounding',2,'basis',5,'interpmethod',"pchip",'shortextrapmethod',"linear",'longextrapmethod',"cubic")

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

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

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

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

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 of interest-rate curve, returned as a string.

data types: string

compounding frequency, returned as a scalar numeric.

data types: double

day count basis of the instrument, returned as a scalar integer.

data types: double

dates corresponding to the rate data, returned as a datetime.

data types: datetime

rates corresponding to dates data, returned as vector.

data types: datetime

settlement date, returned as a datetime.

data types: datetime

interpolation method, returned as a scalar string.

data types: string

short extrapolation method, returned as a scalar string.

data types: string

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 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 r2020a

see also

functions

topics

    网站地图