set | R Documentation |
Implemented e.g. for ContractModel
where
set
populates the value for specified contract
term(s) or for RiskFactor
implementations,
ValuationModel
, and whatever object of this
package that is carrying parameters.
Note that argument what
has to refer to the exact
names of the terms or parameters to populate. The values
need to be of the respective data type, i.e. numeric,
character, logical, etc. depending on the term to be set.
Allows to change certain elements of a portfolio. In particular,
this is a convenience function to change the
Reference Class's field values. Further, the method allows to
assign a RiskFactorConnector
to the portfolio, i.e.
all contracts in the portfolio.
See also the respective documentation in rActus.
A convenience-wrapper to change values of the fields of a
PortfolioTree
.
set(object, what, ...)
## S4 method for signature 'ContractType,ValuationEngine'
set(object, what)
## S4 method for signature 'ContractType,list'
set(object, what)
## S4 method for signature 'ContractType,RiskFactorConnector'
set(object, what)
## S4 method for signature 'YieldCurve,list'
set(object, what, ...)
## S4 method for signature 'EventSeries,list'
set(object, what)
## S4 method for signature 'Portfolio,list'
set(object, what)
## S4 method for signature 'Portfolio,RiskFactorConnector'
set(object, what, ...)
## S4 method for signature 'DynamicYieldCurve,missing'
set(object, what, ...)
## S4 method for signature 'DynamicYieldCurve,list'
set(object, what, ...)
## S4 method for signature 'ForeignExchangeRate,list'
set(object, what, ...)
## S4 method for signature 'MultiCurrencyDiscountingModel,list'
set(object, what, ...)
## S4 method for signature 'PortfolioTree,list'
set(object, what)
## S4 method for signature 'ReferenceIndex,list'
set(object, what, ...)
object |
A |
what |
A list with names and values of fields to change |
... |
terms,get
get
get
pam = Pam()
terms(pam) # get all term names
set(pam, what=list(NotionalPrincipal=1000,
DayCountConvention="A/AISDA",
InitialExchangeDate="2015-01-01T00"))
get(pam, what=c("NotionalPrincipal", "DayCountConvention",
"InitialExchangeDate"))
# define analysis data
ad <- "2015-01-02T00"
# construct portfolio
data(BondPortfolio)
ptf <- Portfolio()
import(ptf,BondPortfolio, valuationEngines=TRUE)
# construct market model
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))
# assign market model to portfolio
set(ptf, rf, valuationEngines=TRUE)
tree=Tree()
set(tree, what=list(leafs=list(L1=c(1001,1002),L2=c(1003,1004))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.