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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 13 03:10:55 CET 2012


Author: milktrader
Date: 2012-12-13 03:10:48 +0100 (Thu, 13 Dec 2012)
New Revision: 1289

Modified:
   pkg/quantstrat/inst/tests/testthat_bbands.r
   pkg/quantstrat/inst/tests/testthat_bee.R
Log:
added KFactor, RINAindex, TimeinMarket, BuyandHold

Modified: pkg/quantstrat/inst/tests/testthat_bbands.r
===================================================================
--- pkg/quantstrat/inst/tests/testthat_bbands.r	2012-12-12 23:04:25 UTC (rev 1288)
+++ pkg/quantstrat/inst/tests/testthat_bbands.r	2012-12-13 02:10:48 UTC (rev 1289)
@@ -12,44 +12,56 @@
 LWinner   = stratstat$Largest.Winner
 LLoser    = stratstat$Largest.Loser
 MaxDD     = stratstat$Max.Drawdown
+KFactor   = stratstat$K.Factor
+RINAindex = stratstat$RINA.Index
+InMarket  = stratstat$In.Market
+BuyHold   = stratstat$Buy.Hold
 
 # suppressWarnings(rm("order_book.bbands",pos=.strategy))
 # suppressWarnings(rm("account.bbands","portfolio.bbands",pos=.blotter))
+
+# suppressWarnings(rm("order_book.bbands",pos=.strategy))
+# suppressWarnings(rm("account.bbands","portfolio.bbands",pos=.blotter))
+
+# suppressWarnings(rm("order_book.bbands",pos=.strategy))
+# suppressWarnings(rm("account.bbands","portfolio.bbands",pos=.blotter))
+
+# suppressWarnings(rm("order_book.bbands",pos=.strategy))
+# suppressWarnings(rm("account.bbands","portfolio.bbands",pos=.blotter))
 # suppressWarnings(rm("account.st","portfolio.st","stock.str","stratBBands","initDate","initEq",'start_t','end_t'))
 # 
 ######################## RUN TEST SUITE #######################
 
 context('Consistent trade statistics for bbands.R')
 
-test_that('Number of transactions is consistent', {
+test_that("Number of transactions is consistent", 
+          { expect_that(Txns, equals(51)) })
 
-  expect_that(Txns, equals(51))
-})
+test_that("Number of the number of trades is consistent", 
+          { expect_that(Trades, equals(21)) })
 
-test_that('Number of the number of trades is consistent', {
+test_that("Net Trading PL is consistent", 
+          { expect_that(NetPL, equals(46)) })
 
-  expect_that(Trades, equals(21))
-})
+test_that("Largest Winner is consistent", 
+          { expect_that(LWinner, equals(24)) })
 
-test_that('Net Trading PL is consistent', {
+test_that("Largest Loser is consistent", 
+          { expect_that(LLoser, equals(-38)) })
 
-  expect_that(NetPL, equals(46))
-})
+test_that("Max Drawdown is consistent", 
+          { expect_that(MaxDD, equals(-84)) })
 
-test_that('Largest Winner is consistent', {
+test_that("K Factor is consistent", 
+          { expect_that(KFactor, equals(0)) })
 
-  expect_that(LWinner, equals(24))
-})
+test_that("RINA Index is consistent", 
+          { expect_that(RINAindex, equals(0)) })
 
-test_that('Largest Loser is consistent', {
+test_that("Time in Market is consistent", 
+          { expect_that(InMarket, equals(0)) })
 
-  expect_that(LLoser, equals(-38))
-})
+test_that("Buy and Hold is consistent", 
+          { expect_that(BuyHold, equals(0)) })
 
-test_that('Max Drawdown is consistent', {
 
-  expect_that(MaxDD, equals(-84))
-       
-})
-
-

Modified: pkg/quantstrat/inst/tests/testthat_bee.R
===================================================================
--- pkg/quantstrat/inst/tests/testthat_bee.R	2012-12-12 23:04:25 UTC (rev 1288)
+++ pkg/quantstrat/inst/tests/testthat_bee.R	2012-12-13 02:10:48 UTC (rev 1289)
@@ -2,7 +2,7 @@
 
 ################## bee.r  #########################
 
-source('bee_version_for_tests.R')
+source("bee_version_for_tests.R")
 
 #  bing = ls()
 #  bang = ls(.strategy)
@@ -16,6 +16,10 @@
 LWinner   = stratstat$Largest.Winner
 LLoser    = stratstat$Largest.Loser
 MaxDD     = stratstat$Max.Drawdown
+KFactor   = stratstat$K.Factor
+RINAindex = stratstat$RINA.Index
+InMarket  = stratstat$In.Market
+BuyHold   = stratstat$Buy.Hold
 
 
 # suppressWarnings(rm(list=ls()))
@@ -24,37 +28,36 @@
 
 ######################## RUN TEST SUITE #######################
 
-context('Consistent trade statistics for bee.R')
+context("Consistent trade statistics for bee.R")
 
-test_that('Number of transactions is consistent', {
+test_that("Number of transactions is consistent", 
+          { expect_that(Txns, equals(24)) })
 
-  expect_that(Txns, equals(24))
-})
+test_that("Number of the number of trades is consistent", 
+          { expect_that(Trades, equals(16)) })
 
-test_that('Number of the number of trades is consistent', {
+test_that("Net Trading PL is consistent", 
+          { expect_that(NetPL, equals(63)) })
 
-  expect_that(Trades, equals(16))
-})
+test_that("Largest Winner is consistent", 
+          { expect_that(LWinner, equals(12)) })
 
-test_that('Net Trading PL is consistent', {
+test_that("Largest Loser is consistent", 
+          { expect_that(LLoser, equals(-32)) })
 
-  expect_that(NetPL, equals(63))
-})
+test_that("Max Drawdown is consistent", 
+          { expect_that(MaxDD, equals(-867)) })
 
-test_that('Largest Winner is consistent', {
+test_that("K Factor is consistent", 
+          { expect_that(KFactor, equals(0)) })
 
-  expect_that(LWinner, equals(12))
-})
+test_that("RINA Index is consistent", 
+          { expect_that(RINAindex, equals(0)) })
 
-test_that('Largest Loser is consistent', {
+test_that("Time in Market is consistent", 
+          { expect_that(InMarket, equals(0)) })
 
-  expect_that(LLoser, equals(-32))
-})
+test_that("Buy and Hold is consistent", 
+          { expect_that(BuyHold, equals(0)) })
 
-test_that('Max Drawdown is consistent', {
 
-  expect_that(MaxDD, equals(-867))
-       
-})
-
-



More information about the Blotter-commits mailing list