R/TestFunctionOutputs.R

# # #JSON==========================================================================================---------------------------=====================================------------------
# #
# # library(rjson)
# #
# # ##DATA INPUT____________________________________________________________________________________________________
# # # Asset------------------------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetLevelPerformanceInput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data2<-as.data.frame(do.call("cbind", json_file))
# # View(data2)
# # sum(as.numeric(levels(data2$Weight))[data2$Weight])
# #
# #
# # # Asset Cattergory-----------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetCategoriesPerformanceInput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data<-as.data.frame(do.call("cbind", json_file))
# # View(data)
# # sum(as.numeric(levels(data$Weight))[data$Weight])
# #
# # # Asset Class------------------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetClassPerformanceInput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data<-as.data.frame(do.call("cbind", json_file))
# # View(data)
# # sum(as.numeric(levels(data$Weight))[data$Weight])
# #
# #
# # #####DATA OUTPUT___________________________________________________________________________________
# #
# # library(rjson)
# # # Asset------------------------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetLevelPerformanceOutput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data3<-as.data.frame(do.call("rbind", json_file))
# # View(data3)
# # sum(as.numeric(levels(data3$PortfolioWeight))[data3$PortfolioWeight])
# #
# # data3$PortfolioWeight
# # data2$Weight
# # # Asset Cattergory-----------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetCategoriesPerformanceOutput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data<-as.data.frame(do.call("rbind", json_file))
# # View(data)
# # sum(as.numeric(levels(data$PortfolioWeight))[data$PortfolioWeight])
# #
# # # Asset Class------------------------------------------------------
# # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetClassPerformanceOutput.json")
# #
# # json_file <- lapply(json_file, function(x) {
# #   x[sapply(x, is.null)] <- NA
# #   unlist(x)
# # })
# #
# # data<-as.data.frame(do.call("rbind", json_file))
# # View(data)
# # sum(as.numeric(levels(data$PortfolioWeight))[data$PortfolioWeight])
# #
# #
# #
# # #JSON==========================================================================================---------------------------=====================================------------------
# #
# #
# #
# #
# # #Load Test Data
# assetClassData <- read.csv("P:\\Projects\\R.Financial\\DataSets\\AssetClass.csv")
# assetData<- read.csv("P:\\Projects\\R.Financial\\DataSets\\AssetLevel.csv")
# assetCategoryData <- read.csv("P:\\Projects\\R.Financial\\DataSets\\AssetCategory.csv")
#
# ##ASSET Performance--------------------------------------
# assetPerformance<-function(AssetLevelData){
#
#   #Object of Class Asset
#   object<-class.Asset(AssetLevelData)
#   object
#   #Time weighted returns
#   Returns<-AssetTimeWeightedReturns(object)
#   Returns
#
#   performanceData<-class.SecurityAttribution(Returns)
#   SecurityperformanceAttribution(performanceData)
# }
#
# AssetClass<-assetClassPerformance(assetClassData)
# Asset<-assetPerformance(assetData)
# Assetcategory<-assetCategoryPerformance(assetCategoryData)
# # ##-------------------------------------------------------------------
# #
# #
# ##ASSET CATEGORY Performance-------------------------------------
# assetCategoryPerformance<-function(AssetLevelData){
#
#   #Object of Class Asset
#   object<-class.AssetCategory(AssetLevelData)
#
#   #Time weighted returns
#   Returns<-AssetCategoryTimeWeightedReturns(object)
#   #Returns
#   #Performance Attribution
#   performanceData<-class.AssetCategoryAttribution(Returns)
#   performanceData
#   # Attribution
#   AssetCategoryperformanceAttribution(performanceData)
#
# }
#
# ##
# assetCategoryPerformance(assetClassData)
#
# # ##----------------------------------------------------------------------------
# #
# #
# #
# # ##ASSET CLASS Performance-------------------------------------
# # assetClassPerformance<-function(AssetLevelData){
# #
# #   #Object of Class Asset
# #   object<-class.AssetClass(AssetLevelData)
# #   #object
# #   #Time weighted returns
# #   Returns<-AssetClassTimeWeightedReturns(object)
# #   #Returns
# #   #Performance Attribution
# #   performanceData<-class.AssetClassAttribution(Returns)
# #   performanceData
# #   # Attribution
# #   AssetClassperformanceAttribution(performanceData)
# #
# # }
# #
# # ##
# # assetClassPerformance(assetClassData)
# # ######------------------------------------------------------------
#
# # #
# # # #
# # # # assetCategoryPerformance(assetCategoryData)
# # # #
# # # # AssetCategoryTimeWeightedReturns(assetCategoryData)
# # # # assetCategoryData <- read.csv("P:\\Projects\\R.Financial\\DataSets\\AssetCategory.csv")
# # # #
# # # # #JSON
# # # # # Give the input file name to the function.
# # # # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetClassPerformanceInput (3).json")
# # # # # result<-as.data.frame(result)
# # # # # View(result)
# # # #
# # # #
# # # # json_file <- lapply(json_file, function(x) {
# # # #   x[sapply(x, is.null)] <- NA
# # # #   unlist(x)
# # # # })
# # # #
# # # # View(do.call("rbind", json_file))
# # # #
# # # #
# # # # # Give the input file name to the function.
# # # # json_file <- fromJSON(file="P:\\Projects\\R.Financial\\DataSets\\New folder\\AssetLevelPerformanceInput (2).json")
# # # # # result<-as.data.frame(result)
# # # # # View(result)
# # # #
# # # #
# # # # json_file <- lapply(json_file, function(x) {
# # # #   x[sapply(x, is.null)] <- NA
# # # #   unlist(x)
# # # # })
# # # #
# # # # View(do.call("rbind", json_file))
# #
# #
CarlvinJerry/InnovaPerformanceAttribution documentation built on May 16, 2019, 7:26 a.m.