Main Content

classfin

Create financial structure or return financial structure class name

Description

example

Obj = classfin(ClassName) create a financial structure of class ClassName.

example

Obj = classfin(Struct,ClassName) create a converted MATLAB® financial structure of class ClassName.

example

ClassName = classfin(Obj) returns a character vector containing a financial structure's class name.

Examples

collapse all

This example shows how to create a financial structure HJMTimeSpec and complete its fields. (Typically, the function hjmtimespec is used to create HJMTimeSpec structures).

TimeSpec = classfin('HJMTimeSpec'); 
TimeSpec.ValuationDate = datetime(1999,12,10); 
TimeSpec.Maturity = datetime(2002,12,10); 
TimeSpec.Compounding = 2; 
TimeSpec.Basis = 0; 
TimeSpec.EndMonthRule = 1;
TimeSpec
TimeSpec = struct with fields:
           FinObj: 'HJMTimeSpec'
    ValuationDate: 10-Dec-1999
         Maturity: 10-Dec-2002
      Compounding: 2
            Basis: 0
     EndMonthRule: 1

This example shows how to convert an existing MATLAB structure into a financial structure.

TSpec.ValuationDate = datetime(1999,12,10); 
TSpec.Maturity = datetime(2002,12,10); 
TSpec.Compounding = 2; 
TSpec.Basis = 0; 
TSpec.EndMonthRule = 0; 
TimeSpec = classfin(TSpec, 'HJMTimeSpec')
TimeSpec = struct with fields:
    ValuationDate: 10-Dec-1999
         Maturity: 10-Dec-2002
      Compounding: 2
            Basis: 0
     EndMonthRule: 0
           FinObj: 'HJMTimeSpec'

This example shows how to obtain a character vector containing a financial structure's class name.

load deriv.mat 
ClassName = classfin(HJMTree)
ClassName = 
'HJMFwdTree'

Input Arguments

collapse all

Name of a financial structure class, specified by a character vector.

Data Types: char

Structure for conversion, specified as a MATLAB structure

Data Types: struct

Name of a financial structure, specified with an instance of an object.

Data Types: object

Output Arguments

collapse all

Name of a financial structure, returned as an instance of an object.

Name of a financial structure class, specified by a character vector.

Version History

Introduced before R2006a