ctm-methods: 'ContractModel'-class constructor

CTMR Documentation

ContractModel-class constructor

Description

Create an instance of an implementation of class ContractModel (e.g. PrincipalAtMaturityModel, StockModel, etc).

Usage

CTM(model)

## S4 method for signature 'character'
CTM(model)

Arguments

object

If an object of class jobjRef, then this parameter is expected to be a reference to a Java contract model and a new R-object of the same class is created where the Java reference attached as the classes' jref-field. If a character, then object is expected to be the R-class name of the CT for which a contract model is to be instantiated.

Details

This constructor is in fact a short cut to the constructors of the implemented classes such as PamModel for PrincipalAtMaturityModel or StkModel for StockModel. Note that it is not possible to instantiate class ContractModel itself but only the implementing classes extending ContractModel.

Value

An object of a class extending ContractModel

See Also

ContractModel,PrincipalAtMaturityModel

Examples

# example 1: create a new 'PAM-Model' object
# This example does not work
# pam.model = CTM("PrincipalAtMaturity")

# example 2: attach the reference to a Java 'PAM-Model' object 
#            to a new R-'PAM' object. Note, the new object will
#            refer to the same Java contract.
# This example does not work
# pam.model = CTM("PrincipalAtMaturity")
# set(pam.model, what=list(
#                    ContractID = "001",
#                    Currency = "CHF",
#                    ContractRole = "RPA",
#                    StatusDate       = "2012-12-31T00",
#                    ContractDealDate = "2012-12-31T00",
#                    InitialExchangeDate = "2013-01-01T00",
#                    MaturityDate = "2013-03-31T00",
#                    NotionalPrincipal = 1000, 
#                    NominalInterestRate = 0.01,
#                    DayCountConvention = "30E/360"))
# same.pam.model = CTM(pam.model$jref)

# example 3: create a new 'PAM-Model' object using the
#            CT-specific model constructor method
pam.model = PamModel()


wbreymann/FEMS documentation built on Dec. 8, 2022, 9:43 a.m.