ev-methods: Derive the events for a 'ContractType'

eventsR Documentation

Derive the events for a ContractType

Description

Method generating the EventSeries of a contract, cf. section Details.

The events of a portfolio of contracts is in fact the set of events of all contracts in the portfolio. For more information on events of a contract see events function with ContractType-signature.

Usage

events(object, ad, model, ...)

## S4 method for signature 'ContractType,character,missing'
events(object, ad, model)

## S4 method for signature 'ContractType,AD0,missing'
events(object, ad, model)

## S4 method for signature 'ContractType,character,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'ContractType,AD0,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'Portfolio,character,missing'
events(object, ad, model)

## S4 method for signature 'Portfolio,timeDate,missing'
events(object, ad, model)

## S4 method for signature 'Portfolio,AD0,missing'
events(object, ad, model)

## S4 method for signature 'Portfolio,character,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'Portfolio,AD0,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'Node,character,RiskFactorConnector'
events(object, ad, model, end_date)

## S4 method for signature 'Node'
showEvents(object, ...)

## S4 method for signature 'Operations,character,missing'
events(object, ad, model)

## S4 method for signature 'Operations,AD0,missing'
events(object, ad, model)

## S4 method for signature 'Operations,timeDate,missing'
events(object, ad, model)

## S4 method for signature 'Operations,character,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'Operations,AD0,RiskFactorConnector'
events(object, ad, model)

## S4 method for signature 'Operations,timeDate,RiskFactorConnector'
events(object, ad, model)

Arguments

object

The Portfolio or PortfolioFast for which to derive the events

ad

The analysis date as per which all future events are to be derived

model

(optional) The RiskFactorConnector conditional to which events are computed

Details

The events of a contract are directly derived from the legal obligations defined therein. Events mark the exchange of a cash flow among the parties involved in the contract or changes in the inner states of the contract affecting cash flows to be exchanged in future. As such, events methods generates the raw results that are the input for many financial analyses.

Value

A EventSeries object containing the resulting events

A list object (or EventTable in case of PortfolioFast argument) containing the resulting events

See Also

ContractType, EventSeries, RiskFactorConnector

ContractType, RiskFactorConnector, EventSeries, EventTable

Examples

# define the contract
pam <- Pam(ContractID = "001",
           Currency = "CHF",
           ContractRole = "RPA",               
           StatusDate = "2016-05-30",
           ContractDealDate = "2016-05-30",
           InitialExchangeDate = "2016-05-30",
           MaturityDate = "2020-06-01",
           NotionalPrincipal = 1000,
           NominalInterestRate = 0.05,
           CycleAnchorDateOfInterestPayment = "2017-06-01",
           CycleOfInterestPayment = "P1YL1",
           CycleAnchorDateOfRateReset = "2017-06-01",
           CycleOfRateReset = "P1YL1",
           MarketObjectCodeOfRateReset = "RiskFreeYC",
           DayCountConvention = "30E360")

ad <- "2016-06-01"

yc <- YieldCurve(label = "RiskFreeYC",
                 ReferenceDate = ad, 
                 Tenors = c("1W", "1M", "6M", "1Y", "2Y", "5Y"), 
                 Rates = c(0.001, 0.0015, 0.002, 0.01, 0.02, 0.03))

rf <- RFConn(yc)
set(pam, rf)

evs <- events(pam, ad)
as.data.frame(evs)

# import a portfolio
data(BondPortfolio)
ptf <- Portfolio()
import(ptf,BondPortfolio, valuationEngines=TRUE)

## set analysis date
ad <- "2015-01-02T00"

# define risk factors
yc <- YieldCurve()
tenors <- c("1W", "1M", "6M", "1Y", "2Y", "5Y")
rates <- c(0.001, 0.0015, 0.002, 0.01, 0.02, 0.03)
set(yc, what = list(
  MarketObjectCode = "YC_EA_AAA",
  Nodes = list(ReferenceDate = ad, 
               Tenors = tenors, Rates = rates)))
cpi <- Index()
times <- c("2015-01-01T00", "2016-01-01T00", "2017-01-01T00", "2018-01-01T00",
           "2019-01-01T00")
values <- c(100, 110, 120, 130, 140)
set(cpi, what=list(
  MarketObjectCode = "IND_CPI_EA",
  Data=list(Dates=times,Values=values)))
rf <- RFConn()
add(rf, list(yc, cpi))

# compute events
evs=events(ptf, ad, rf)
evs
as.data.frame(evs)


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