#' Object of class AssetClass Level Generator
#'
#' This function generates an S4 object of any Asset Class in a Fund
#'
AssetClass<-setClass("AssetClass", slots = representation(
Date = "factor",
AssetClass = "character",
OpeningMarketValue = "numeric",
Debit = "numeric",
Credit = "numeric",
ClosingMarketValue= "numeric",
FixedIncome = "numeric",
Weight = "numeric",
Benchmark = "numeric",
BenchmarkWeight = "numeric"),
prototype = list(Debit=0,#Default Values
Credit=0),
#Data validation
validity = function(object){
if(length(object@Debit)<=0){
return("Debits column is required")
}
else if(length(object@Credit)<=0){
return("Credits column is required")
}
else if(length(object@OpeningMarketValue)<=0 || length(object@ClosingMarketValue)<=0){
return("Closing or opening Market Values can not be NULL")
}
return(TRUE)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.