| events | R Documentation |
ContractTypeMethod 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.
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)
object |
The |
ad |
The analysis date as per which all future events are to be derived |
model |
(optional) The |
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.
A EventSeries object containing the resulting events
A list object (or EventTable in case of PortfolioFast argument) containing the resulting events
ContractType, EventSeries, RiskFactorConnector
ContractType, RiskFactorConnector, EventSeries, EventTable
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.