classfin - Create financial structure or return financial structure class name

Syntax

Obj = classfin(ClassName)
Obj = classfin(Struct, ClassName)
ClassName = classfin(Obj)

Arguments

ClassName

String containing the name of a financial structure class.

Struct

MATLAB structure to be converted into a financial structure.

Obj

Name of a financial structure.

Description

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

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

Examples

Example 1. Create an HJMTimeSpec financial structure and complete its fields. (Typically, the function hjmtimespec is used to create HJMTimeSpec structures).

TimeSpec = classfin('HJMTimeSpec'); 
TimeSpec.ValuationDate = datenum('Dec-10-1999'); 
TimeSpec.Maturity = datenum('Dec-10-2002'); 
TimeSpec.Compounding = 2; 
TimeSpec.Basis = 0; 
TimeSpec.EndMonthRule = 1;
TimeSpec = 

           FinObj: 'HJMTimeSpec'
    ValuationDate: 730464
         Maturity: 731560
      Compounding: 2
            Basis: 0
     EndMonthRule: 1

Example 2. Convert an existing MATLAB structure into a financial structure.

TSpec.ValuationDate = datenum('Dec-10-1999'); 
TSpec.Maturity = datenum('Dec-10-2002'); 
TSpec.Compounding = 2; 
TSpec.Basis = 0; 
TSpec.EndMonthRule = 0; 
TimeSpec = classfin(TSpec, 'HJMTimeSpec')
 
TimeSpec = 

    ValuationDate: 730464
         Maturity: 731560
      Compounding: 2
            Basis: 0
     EndMonthRule: 0
           FinObj: 'HJMTimeSpec'

Example 3. Obtain a financial structure's class name.

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

HJMFwdTree

See Also

isafin

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS