import | R Documentation |
This method allows to import ACTUS contracts from a data source and append the contracts to an R-portfolio.
import(object, source, ...)
## S4 method for signature 'Portfolio,data.frame'
import(object, source, ...)
## S4 method for signature 'Portfolio,character'
import(object, source, ...)
object |
The portfolio where to append the imported contracts.
Can be an object of class |
source |
The data source where ACTUS contract data is imported
from. This can be a |
... |
Additional parameters can be a |
Parameter object
contains the portfolio to which
to append the imported contracts. Note that existing
contracts in the portfolio are not removed. Yet, in case
of object
being a PortfolioFast
,
existing contracts with same 'ContractID' than newly
imported contracts are overwritten.
The data source must contain ACTUS contract data in a table format with column names indicating the ACTUS contract attribute using official attribute long-names (cf. www.projectactus.org). Currently, three data formats are supported:
R-data.frame
MS Excel 'xls' files
flat-files such as 'txt' or 'csv'
If the data is in flat-file format, parameter source
contains the path to the file. Further, additional parameters
'sheet' or 'sep' may be used.
The contract data can be extended with additional parameters specifying a valuation engine and its parameters for every contract. The format for such parameters is as follows:
'Valuation_[engine]'
'Valuation_[par1]'
'Valuation_[par2]'
...
where '[engine]' specifies the type of valuation engine (currently supported are 'Discounting', 'MultiCurrencyDiscounting', 'CapitalAssetPricingModel') and '[par1]', ... refer to parameters to the specific type of valuation engine:
Discounting: 'RiskFactorObjectLink', 'dc.spread'
MultiCurrencyDiscounting: 'CurrencyPair', 'TargetCurrency', 'Currency1', 'Currency2', 'Spread1', 'Spread2', 'InterestRateModelObjectLink1', 'InterestRateModelObjectLink2'
CapitalAssetPricingModel: 'IndexObjectLink', 'RiskFreeRatesObjectLink', 'MarketValueObserved', 'ModelAlpha', 'ModelBeta', 'StatusDate'
Further, any number of selection criteria for aggregation purposes
can be added using the following format: 'Selection_[criteria]'
where '[criteria]' refers to the specific criteria e.g. 'LineOfBusiness'.
Notice that the selection criteria are added to the results table
of a PortfolioFast
only.
a data.frame
containing all the exceptions which were thrown
Portfolio
,PortfolioFast
,export
# define analysis data
ad <- "2015-01-02T00"
# load demo portfolio data
data(BondPortfolio)
# check data structure
# (note the format of certain column headers,
# e.g. Valuation_XX, or Selection_XX)
str(BondPortfolio)
# now create portfolio structure and import demo data
# as portfolio
ptf <- PortfolioFast()
import(ptf,BondPortfolio, valuationEngines=TRUE)
# check portfolio
ptf
get(ptf, what="ids")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.