[Blotter-commits] r1119 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 5 19:00:54 CEST 2012
Author: opentrades
Date: 2012-08-05 19:00:54 +0200 (Sun, 05 Aug 2012)
New Revision: 1119
Modified:
pkg/quantstrat/R/parameters.R
Log:
parameters.R: removed some unused vars, renamed a couple of other vars for better readability
Modified: pkg/quantstrat/R/parameters.R
===================================================================
--- pkg/quantstrat/R/parameters.R 2012-08-05 16:47:17 UTC (rev 1118)
+++ pkg/quantstrat/R/parameters.R 2012-08-05 17:00:54 UTC (rev 1119)
@@ -339,7 +339,7 @@
#need to create combination of distribution values in each slot of the parameterPool
initialPortf<-getPortfolio(portfolios)
- stock.str<-names(initialPortf$symbols)
+ symbols<-names(initialPortf$symbols)
initDate<-time(first(initialPortf$symbols[[1]]$posPL))
limits<-list()
@@ -348,29 +348,21 @@
tmp_strategy<-strategy
- testPackList<-list()
- testPackList$stats<-NULL
+ results<-list()
+ results$stats<-NULL
- testPackListPRLStructure<-list()
- testPackListPRLStructure$stats<-NULL
-
-
-
if (!is.strategy(tmp_strategy)) {
tmp_strategy<-try(getStrategy(tmp_strategy))
if(inherits(tmp_strategy,"try-error"))
stop ("You must supply an object of type 'strategy'.")
}
-
out<-list()
paramdist<-list()
paramweight<-list()
paramLabel<-list()
lvmatch<-list()
-
-
for (i in 1:length(parameterPool)){
distr<-parameterPool[[i]]
@@ -458,21 +450,9 @@
}
-
- testPackList$paramTable<-paramTable
- testPackList$paramdist<-paramdist
- testPackList$paramweight<-paramweight
- testPackList$paramLabel<-paramLabel
-
strategyList<-list()
if(verbose >=1) print("ParamTable generated")
-
- psize=nrow(paramTable)
- if(verbose >=1) print(psize)
-
-
-
instruments<-as.list(FinancialInstrument:::.instrument)
getSymbols<-as.list(.getSymbols)
blotter<-as.list(.blotter)
@@ -480,7 +460,7 @@
#Pack all symbols downloaded in .GlobalEnv
symbols<-names(.getSymbols)
- testPackListPRL<-foreach (i = 1:psize, .export=c('instruments',symbols,'getSymbols','blotter','tmp_strategy'),.verbose=TRUE,...=...) %dopar%
+ testPackListPRL<-foreach (i = 1:nrow(paramTable), .export=c('instruments',symbols,'getSymbols','blotter','tmp_strategy'),.verbose=TRUE,...=...) %dopar%
{
#if(verbose)
@@ -586,7 +566,7 @@
# try(rm(list=paste("account",portfolios,sep='.'),pos=.blotter))
# try(rm(list=paste("portfolio",portfolios,sep='.'),pos=.blotter))
- try({initPortf(testPack$portfolio.st,symbols=stock.str, initDate=initDate)})
+ try({initPortf(testPack$portfolio.st,symbols=symbols, initDate=initDate)})
try({initAcct(testPack$account.st,testPack$portfolio.st, initDate=initDate)})
try({initOrders(portfolio=testPack$portfolio.st,initDate=initDate)})
@@ -637,7 +617,7 @@
for (k in 1: nrow(paramTable)){
- testPackListPRLStructure$statsTable<-rbind(testPackListPRLStructure$stats,cbind(testPackListPRL[[k]]$parameters,testPackListPRL[[k]]$stats))
+ results$statsTable<-rbind(results$stats,cbind(testPackListPRL[[k]]$parameters,testPackListPRL[[k]]$stats))
if(verbose >=1) print(names(testPackListPRL[[k]]$blotterl))
for(nn in 1:length(testPackListPRL[[k]]$blotterl)){
@@ -648,14 +628,14 @@
}
- testPackListPRLStructure$eachRun<-testPackListPRL
- testPackListPRLStructure$paramTable<-paramTable
- testPackListPRLStructure$paramConstrainTable<-data.frame(parameterConstraints)
+ results$eachRun<-testPackListPRL
+ results$paramTable<-paramTable
+ results$paramConstrainTable<-data.frame(parameterConstraints)
- testPackListPRLStructure$parameterDistribution<-parameterPool
- testPackListPRLStructure$parameterConstraints<-parameterConstraints
+ results$parameterDistribution<-parameterPool
+ results$parameterConstraints<-parameterConstraints
- return(testPackListPRLStructure)
+ return(results)
}
More information about the Blotter-commits
mailing list