[Blotter-commits] r1375 - pkg/quantstrat/inst/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 22 00:20:44 CET 2013


Author: milktrader
Date: 2013-01-22 00:20:44 +0100 (Tue, 22 Jan 2013)
New Revision: 1375

Modified:
   pkg/quantstrat/inst/tests/TEMPLATE_test_demo.R
   pkg/quantstrat/inst/tests/test_bbandParameters.R
   pkg/quantstrat/inst/tests/test_bbands.R
   pkg/quantstrat/inst/tests/test_bee.R
   pkg/quantstrat/inst/tests/test_faber.R
   pkg/quantstrat/inst/tests/test_faberMC.R
   pkg/quantstrat/inst/tests/test_faber_rebal.R
   pkg/quantstrat/inst/tests/test_luxor-3.11.R
   pkg/quantstrat/inst/tests/test_luxor-3.12.R
   pkg/quantstrat/inst/tests/test_luxor-3.16.R
   pkg/quantstrat/inst/tests/test_luxor.1.R
   pkg/quantstrat/inst/tests/test_luxor.2.R
   pkg/quantstrat/inst/tests/test_luxor.3.Parameters.R
   pkg/quantstrat/inst/tests/test_luxor.3.Parameters.tradegraphs.R
   pkg/quantstrat/inst/tests/test_luxor.3.R
   pkg/quantstrat/inst/tests/test_luxor.4.R
   pkg/quantstrat/inst/tests/test_luxor.4.Timespans.R
   pkg/quantstrat/inst/tests/test_luxor.4.Timespans.tradegraphs.R
   pkg/quantstrat/inst/tests/test_luxor.StopLoss.R
   pkg/quantstrat/inst/tests/test_luxor.StopTrailing.R
   pkg/quantstrat/inst/tests/test_luxor.TakeProfit.R
   pkg/quantstrat/inst/tests/test_luxor.exits.R
   pkg/quantstrat/inst/tests/test_luxor.orderchains.R
   pkg/quantstrat/inst/tests/test_luxor.strategy.R
   pkg/quantstrat/inst/tests/test_maCross.R
   pkg/quantstrat/inst/tests/test_macd.R
   pkg/quantstrat/inst/tests/test_macdParameters.R
   pkg/quantstrat/inst/tests/test_macdRebalancing.R
   pkg/quantstrat/inst/tests/test_pair_trade.R
   pkg/quantstrat/inst/tests/test_rocema.R
   pkg/quantstrat/inst/tests/test_rsi.R
Log:
revamped test script templates

Modified: pkg/quantstrat/inst/tests/TEMPLATE_test_demo.R
===================================================================
--- pkg/quantstrat/inst/tests/TEMPLATE_test_demo.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/TEMPLATE_test_demo.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,9 +1,15 @@
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+# 
+# if(isTRUE(options('in_test')$in_test))
+#   # use test dates
+#   {initDate="2011-01-01" 
+#   endDate="2012-12-31"   
+#   } else
+#   # use demo defaults
+#   {initDate="1999-12-31"
+#   endDate=Sys.Date()}
+#       
+###############################################################
 
 ##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
 # book  = getOrderBook(port)
@@ -25,13 +31,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_bbandParameters.R
===================================================================
--- pkg/quantstrat/inst/tests/test_bbandParameters.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_bbandParameters.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_bbands.R
===================================================================
--- pkg/quantstrat/inst/tests/test_bbands.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_bbands.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_bee.R
===================================================================
--- pkg/quantstrat/inst/tests/test_bee.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_bee.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,54 +1,26 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
-################## TEMPLATE FILL OUT ###########################
-#####                                                       ####
-##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
-##### PORTFOLIO =  %s/PORTFOLIO/_the_name_of_my_portfolio/g ####
-##### STOCK     =  %s/STOCK/_the_name_of_my_stock/g         ####
-#####                                                       ####
-################################################################
-
 ################## LOAD TESTING FRAMEWORK ######################
 
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE BEE #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('bee.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 
-qty    = book$PORTFOLIO$STOCK[,"Order.Qty"]
-price  = book$PORTFOLIO$STOCK[,"Order.Price"]
-type   = book$PORTFOLIO$STOCK[,"Order.Type"]
-side   = book$PORTFOLIO$STOCK[,"Order.Side"]
-status = book$PORTFOLIO$STOCK[,"Order.Status"]
-fees   = book$PORTFOLIO$STOCK[,"Txn.Fees"]
-rule   = book$PORTFOLIO$STOCK[,"Rule"]
+qty    = book$bug$GLD[,"Order.Qty"]
+price  = book$bug$GLD[,"Order.Price"]
+type   = book$bug$GLD[,"Order.Type"]
+side   = book$bug$GLD[,"Order.Side"]
+status = book$bug$GLD[,"Order.Status"]
+fees   = book$bug$GLD[,"Txn.Fees"]
+rule   = book$bug$GLD[,"Rule"]
 
 ######################## ORDER BOOK ############################
 
-context("DEMO order book is consistent ")
+context("bee order book is consistent ")
 
 ## quantity
 test_that("The first entry is 100", 
@@ -83,7 +55,7 @@
 
 ######################## STATS  #################################
 
-context("DEMO trade statistics are consistent ")
+context("bee trade statistics are consistent ")
 
 test_that("Num.Txns is 19", 
           { expect_that(stats$Num.Txns , equals(19)) })
@@ -140,9 +112,9 @@
 test_that("End.Equity is -36", 
           { expect_equal(stats$End.Equity , -36, .0001) })
 
-######################## PORTFOLIO RETURNS ######################
+######################## bug RETURNS ######################
 
-context("DEMO portfolio returns are consistent ")
+context("bee portfolio returns are consistent ")
 
 test_that("min return is -0.00597", 
           { expect_equal(min(rets), -0.00597, .0001) })

Modified: pkg/quantstrat/inst/tests/test_faber.R
===================================================================
--- pkg/quantstrat/inst/tests/test_faber.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_faber.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_faberMC.R
===================================================================
--- pkg/quantstrat/inst/tests/test_faberMC.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_faberMC.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_faber_rebal.R
===================================================================
--- pkg/quantstrat/inst/tests/test_faber_rebal.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_faber_rebal.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor-3.11.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor-3.11.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor-3.11.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor-3.12.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor-3.12.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor-3.12.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor-3.16.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor-3.16.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor-3.16.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.1.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.1.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.1.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.2.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.2.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.2.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.3.Parameters.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.3.Parameters.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.3.Parameters.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.3.Parameters.tradegraphs.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.3.Parameters.tradegraphs.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.3.Parameters.tradegraphs.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.3.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.3.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.3.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-#!/usr/bin/Rscript --vanilla
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.4.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.4.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.4.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.4.Timespans.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.4.Timespans.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.4.Timespans.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.4.Timespans.tradegraphs.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.4.Timespans.tradegraphs.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.4.Timespans.tradegraphs.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.StopLoss.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.StopLoss.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.StopLoss.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.StopTrailing.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.StopTrailing.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.StopTrailing.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.TakeProfit.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.TakeProfit.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.TakeProfit.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
-################################################################
-
-
 ################## TEMPLATE FILL OUT ###########################
 #####                                                       ####
 ##### DEMO      =  %s/DEMO/_the_name_of_my_demo/g           ####
@@ -28,13 +11,10 @@
 require(testthat)
 require(PortfolioAnalytics)
 
-######### INITIALIZE DATES AND SOURCE DEMO #####################
+######### ACTIVATE TEST DATES AND SOURCE DEMO #####################
 
-in_test   <- TRUE
-initDate  <- "2011-01-01"
-endDate   <- "2012-12-31"
- 
-demo("DEMO", ask=FALSE, echo=FALSE)
+options(in_test=TRUE)
+source('DEMO.R')
 
 ################### DEFINE VARIABLES TO BE TESTED ##############
 

Modified: pkg/quantstrat/inst/tests/test_luxor.exits.R
===================================================================
--- pkg/quantstrat/inst/tests/test_luxor.exits.R	2013-01-21 19:10:54 UTC (rev 1374)
+++ pkg/quantstrat/inst/tests/test_luxor.exits.R	2013-01-21 23:20:44 UTC (rev 1375)
@@ -1,20 +1,3 @@
-
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-#
-# if(!exists('in_test') || !isTRUE(in_test)){
-#     initDate='2005-12-31' # ensure this is demo default
-#     endDate=Sys.Date()    # ensure this is demo default
-# }
-################################################################
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### 
-#
-# book  = getOrderBook(port)
-# stats = tradeStats(port)
-# rets  = PortfReturns(acct)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/blotter -r 1375


More information about the Blotter-commits mailing list