[Blotter-commits] r1734 - pkg/quantstrat/demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 11 17:31:39 CET 2016


Author: bodanker
Date: 2016-03-11 17:31:38 +0100 (Fri, 11 Mar 2016)
New Revision: 1734

Modified:
   pkg/quantstrat/demo/faber.R
   pkg/quantstrat/demo/faber_rebal.R
   pkg/quantstrat/demo/luxor.1.strategy.basic.R
   pkg/quantstrat/demo/luxor.6.paramset.stoploss.R
   pkg/quantstrat/demo/luxor.6.paramset.stoptrailing.R
   pkg/quantstrat/demo/luxor.6.paramset.takeprofit.R
   pkg/quantstrat/demo/luxor.7.exit.and.risk.R
Log:
Replace calls to View with print in demos

As of R-3.2.3, calling View() on an xts object with duplicate index
values fails. This is because the data.frame will have duplicate row
names and the format.data.frame method no longer appears to support it.


Modified: pkg/quantstrat/demo/faber.R
===================================================================
--- pkg/quantstrat/demo/faber.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/faber.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -137,7 +137,7 @@
 ret1 <- PortfReturns('faber')
 ret1$total <- rowSums(ret1)
 
-View(ret1)
+print(ret1)
 
 if("package:PerformanceAnalytics" %in% search() || require("PerformanceAnalytics",quietly=TRUE)){
 	getSymbols("SPY", src='yahoo', index.class=c("POSIXt","POSIXct"), from='1999-01-01')
@@ -148,7 +148,7 @@
 }
 
 faber.stats<-tradeStats('faber')[,c('Net.Trading.PL','Max.Drawdown','Num.Trades','Profit.Factor','Std.Dev.Trade.PL','Largest.Winner','Largest.Loser','Max.Equity','Min.Equity')]
-View(faber.stats)
+print(faber.stats)
 
 Sys.setenv(TZ=oldtz)
 ###############################################################################

Modified: pkg/quantstrat/demo/faber_rebal.R
===================================================================
--- pkg/quantstrat/demo/faber_rebal.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/faber_rebal.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -156,7 +156,7 @@
 ret1 <- PortfReturns('faber')
 ret1$total <- rowSums(ret1)
 
-View(ret1)
+print(ret1)
 
 if("package:PerformanceAnalytics" %in% search() || require("PerformanceAnalytics",quietly=TRUE)){
   getSymbols("SPY", src='yahoo', index.class=c("POSIXt","POSIXct"), from='1999-01-01')

Modified: pkg/quantstrat/demo/luxor.1.strategy.basic.R
===================================================================
--- pkg/quantstrat/demo/luxor.1.strategy.basic.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/luxor.1.strategy.basic.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -117,7 +117,7 @@
 
 applyStrategy(strategy.st, portfolio.st)
 
-View(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
+print(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
 
 ###############################################################################
 
@@ -127,7 +127,7 @@
 
 ###############################################################################
 
-View(t(tradeStats(portfolio.st, 'GBPUSD')))
+print(t(tradeStats(portfolio.st, 'GBPUSD')))
 
 ###############################################################################
 

Modified: pkg/quantstrat/demo/luxor.6.paramset.stoploss.R
===================================================================
--- pkg/quantstrat/demo/luxor.6.paramset.stoploss.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/luxor.6.paramset.stoploss.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -58,6 +58,6 @@
 
 stats <- results$tradeStats
 
-View(t(stats))
+print(t(stats))
 
 plot(100*stats$StopLossLONG, stats$Net.Trading.PL, type='b', xlab='Stoploss %', ylab='Net.Trading.PL', main='Luxor')

Modified: pkg/quantstrat/demo/luxor.6.paramset.stoptrailing.R
===================================================================
--- pkg/quantstrat/demo/luxor.6.paramset.stoptrailing.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/luxor.6.paramset.stoptrailing.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -58,6 +58,6 @@
 
 stats <- results$tradeStats
 
-View(t(stats))
+print(t(stats))
 
 plot(100*stats$StopTrailingLONG, stats$Net.Trading.PL, type='b', xlab='StopTrailing %', ylab='Net.Trading.PL', main='Luxor')

Modified: pkg/quantstrat/demo/luxor.6.paramset.takeprofit.R
===================================================================
--- pkg/quantstrat/demo/luxor.6.paramset.takeprofit.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/luxor.6.paramset.takeprofit.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -58,6 +58,6 @@
 
 stats <- results$tradeStats
 
-View(t(stats))
+print(t(stats))
 
 plot(100*stats$TakeProfitLONG, stats$Net.Trading.PL, type='b', xlab='TakeProfit %', ylab='Net.Trading.PL', main='Luxor')

Modified: pkg/quantstrat/demo/luxor.7.exit.and.risk.R
===================================================================
--- pkg/quantstrat/demo/luxor.7.exit.and.risk.R	2016-03-06 20:04:46 UTC (rev 1733)
+++ pkg/quantstrat/demo/luxor.7.exit.and.risk.R	2016-03-11 16:31:38 UTC (rev 1734)
@@ -41,7 +41,7 @@
 
 applyStrategy(strategy.st, portfolio.st, prefer='Open')
 
-View(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
+print(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
 
 ###############################################################################
 
@@ -51,7 +51,7 @@
 
 ###############################################################################
 
-View(t(tradeStats(portfolio.st, 'GBPUSD')))
+print(t(tradeStats(portfolio.st, 'GBPUSD')))
 
 ###############################################################################
 



More information about the Blotter-commits mailing list