[Blotter-commits] r1285 - pkg/quantstrat/sandbox/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 12 21:26:24 CET 2012


Author: milktrader
Date: 2012-12-12 21:26:24 +0100 (Wed, 12 Dec 2012)
New Revision: 1285

Modified:
   pkg/quantstrat/sandbox/tests/bbands_version_for_tests.r
   pkg/quantstrat/sandbox/tests/svunit_bbands.r
   pkg/quantstrat/sandbox/tests/testthat_bbands.r
Log:
shortened bbands tests and modified to Max.Drawdown

Modified: pkg/quantstrat/sandbox/tests/bbands_version_for_tests.r
===================================================================
--- pkg/quantstrat/sandbox/tests/bbands_version_for_tests.r	2012-12-12 18:18:30 UTC (rev 1284)
+++ pkg/quantstrat/sandbox/tests/bbands_version_for_tests.r	2012-12-12 20:26:24 UTC (rev 1285)
@@ -1,4 +1,5 @@
 require(quantstrat)
+
 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'))
@@ -7,6 +8,7 @@
 
 data('ttrc')
 TTRC = xts(ttrc[,-1],ttrc[,1])
+TTRC = head(TTRC, n=500)
 
 ###################### DEFINE VARIABLES #################
 SD = 2 

Modified: pkg/quantstrat/sandbox/tests/svunit_bbands.r
===================================================================
--- pkg/quantstrat/sandbox/tests/svunit_bbands.r	2012-12-12 18:18:30 UTC (rev 1284)
+++ pkg/quantstrat/sandbox/tests/svunit_bbands.r	2012-12-12 20:26:24 UTC (rev 1285)
@@ -9,16 +9,16 @@
 
   stats = tradeStats(portfolio.st)
 
-  checkEquals( stats$Num.Txns, 622)
-  checkEquals( stats$Num.Trades, 258)
-  checkEquals( stats$Net.Trading.PL, -204)
-  checkEquals( stats$Largest.Winner, 417)
-  checkEquals( stats$Largest.Loser, -824)
-  checkEquals( stats$maxDrawdown, -2618)
+  checkEquals( stats$Num.Txns, 51)
+  checkEquals( stats$Num.Trades, 21)
+  checkEquals( stats$Net.Trading.PL, 46)
+  checkEquals( stats$Largest.Winner, 24)
+  checkEquals( stats$Largest.Loser, -38)
+  checkEquals( stats$Max.Drawdown, -84)
 }
 
 
 clearLog()
 runTest(bbands)
 Log()
-#summary(Log())
+summary(Log())

Modified: pkg/quantstrat/sandbox/tests/testthat_bbands.r
===================================================================
--- pkg/quantstrat/sandbox/tests/testthat_bbands.r	2012-12-12 18:18:30 UTC (rev 1284)
+++ pkg/quantstrat/sandbox/tests/testthat_bbands.r	2012-12-12 20:26:24 UTC (rev 1285)
@@ -11,7 +11,7 @@
 NetPL     = stratstat$Net.Trading.PL
 LWinner   = stratstat$Largest.Winner
 LLoser    = stratstat$Largest.Loser
-MaxDD     = stratstat$maxDrawdown
+MaxDD     = stratstat$Max.Drawdown
 
 suppressWarnings(rm("order_book.bbands",pos=.strategy))
 suppressWarnings(rm("account.bbands","portfolio.bbands",pos=.blotter))
@@ -23,32 +23,32 @@
 
 test_that('Number of transactions is consistent', {
 
-  expect_that(Txns, equals(622))
+  expect_that(Txns, equals(51))
 })
 
 test_that('Number of the number of trades is consistent', {
 
-  expect_that(Trades, equals(258))
+  expect_that(Trades, equals(21))
 })
 
 test_that('Net Trading PL is consistent', {
 
-  expect_that(NetPL, equals(-204))
+  expect_that(NetPL, equals(46))
 })
 
 test_that('Largest Winner is consistent', {
 
-  expect_that(LWinner, equals(417))
+  expect_that(LWinner, equals(24))
 })
 
 test_that('Largest Loser is consistent', {
 
-  expect_that(LLoser, equals(-824))
+  expect_that(LLoser, equals(-38))
 })
 
 test_that('Max Drawdown is consistent', {
 
-  expect_that(MaxDD, equals(-2618 ))
+  expect_that(MaxDD, equals(-84))
        
 })
 



More information about the Blotter-commits mailing list