[Blotter-commits] r1544 - in pkg/quantstrat: . demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 21 20:34:05 CEST 2013
Author: opentrades
Date: 2013-10-21 20:34:05 +0200 (Mon, 21 Oct 2013)
New Revision: 1544
Added:
pkg/quantstrat/demo/luxor.7.exit.and.risk.R
Removed:
pkg/quantstrat/demo/luxor.7.exit+risk.R
Modified:
pkg/quantstrat/DESCRIPTION
pkg/quantstrat/NAMESPACE
pkg/quantstrat/man/rulePctEquity.Rd
Log:
- renamed quantstrat/demo/luxor.7.exit+risk.R to luxor.7.exit.and.risk.R to fix problem using demo(luxor.7.risk+exit.R, package='quantstrat') ie. demo name without quotes
Modified: pkg/quantstrat/DESCRIPTION
===================================================================
--- pkg/quantstrat/DESCRIPTION 2013-10-19 17:26:25 UTC (rev 1543)
+++ pkg/quantstrat/DESCRIPTION 2013-10-21 18:34:05 UTC (rev 1544)
@@ -15,8 +15,31 @@
Maintainer: Brian G. Peterson <brian at braverock.com>
Description: Specify, build, and back-test quantitative
financial trading and portfolio strategies
-Contributors: Yu Chen, Joe Dunn, Dirk Eddelbuettel,
+Contributors: Yu Chen, Joe Dunn, Dirk Eddelbuettel,
Jeffrey A. Ryan, Garrett See
LazyLoad: yes
License: GPL-3
ByteCompile: TRUE
+Collate:
+ 'applyStrategy.rebalancing.R'
+ 'chart.forward.R'
+ 'chart.forward.training.R'
+ 'indicators.R'
+ 'initialize.R'
+ 'match.names.R'
+ 'orders.R'
+ 'osFUNs.R'
+ 'parameters.R'
+ 'paramsets.R'
+ 'rebalance.rules.R'
+ 'ruleOrderProc.R'
+ 'ruleRevoke.R'
+ 'rules.R'
+ 'ruleSignal.R'
+ 'signals.R'
+ 'strategy.R'
+ 'tradeGraphs.R'
+ 'tradeOrderStats.R'
+ 'utils.R'
+ 'walk.forward.R'
+ 'wrapup.R'
Modified: pkg/quantstrat/NAMESPACE
===================================================================
--- pkg/quantstrat/NAMESPACE 2013-10-19 17:26:25 UTC (rev 1543)
+++ pkg/quantstrat/NAMESPACE 2013-10-21 18:34:05 UTC (rev 1544)
@@ -1,5 +1,5 @@
+export(add.distribution.constraint)
export(add.distribution)
-export(add.distribution.constraint)
export(add.indicator)
export(add.init)
export(add.rule)
@@ -11,10 +11,10 @@
export(applyParameter)
export(applyRules)
export(applySignals)
+export(applyStrategy.rebalancing)
export(applyStrategy)
-export(applyStrategy.rebalancing)
+export(chart.forward.training)
export(chart.forward)
-export(chart.forward.training)
export(delete.paramset)
export(enable.rule)
export(get.orderbook)
Deleted: pkg/quantstrat/demo/luxor.7.exit+risk.R
===================================================================
--- pkg/quantstrat/demo/luxor.7.exit+risk.R 2013-10-19 17:26:25 UTC (rev 1543)
+++ pkg/quantstrat/demo/luxor.7.exit+risk.R 2013-10-21 18:34:05 UTC (rev 1544)
@@ -1,83 +0,0 @@
-#!/usr/bin/Rscript --vanilla
-#
-# Jan Humme (@opentrades) - April 2013
-#
-# Tested and found to work correctly using blotter r1457
-#
-# After Jaekle & Tamasini: A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)
-#
-# Paragraph 3.5: determination of appropriate exit and risk management
-
-require(quantstrat)
-
-source(paste0(path.package("quantstrat"),"/demo/luxor.include.R"))
-
-##### 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()}
-
-source(paste0(path.package("quantstrat"),"/demo/luxor.getSymbols.R"))
-
-### blotter
-
-initPortf(portfolio.st, symbols='GBPUSD', initDate=initDate, currency='USD')
-initAcct(account.st, portfolios=portfolio.st, initDate=initDate, currency='USD')
-
-### quantstrat
-
-load.strategy('luxor')
-
-### BEGIN uncomment lines to activate StopLoss and/or StopTrailing and/or TakeProfit rules
-
-#enable.rule('luxor', 'chain', 'StopLoss')
-#enable.rule('luxor', 'chain', 'StopTrailing')
-#enable.rule('luxor', 'chain', 'TakeProfit')
-
-### END uncomment lines to activate StopLoss and/or StopTrailing and/or TakeProfit rules
-
-addPosLimit(
- portfolio=portfolio.st,
- symbol='GBPUSD',
- timestamp=initDate,
- maxpos=.orderqty)
-
-initOrders(portfolio.st, initDate=initDate)
-
-applyStrategy(strategy.st, portfolio.st, prefer='Open')
-
-View(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
-
-###############################################################################
-
-updatePortf(portfolio.st, Symbols='GBPUSD', Dates=paste('::',as.Date(Sys.time()),sep=''))
-
-chart.Posn(portfolio.st, "GBPUSD")
-
-###############################################################################
-
-View(t(tradeStats(portfolio.st, 'GBPUSD')))
-
-###############################################################################
-
-print(tradeQuantiles('forex', 'GBPUSD'))
-
-dev.new()
-
-### Uncomment to choose appropriate MAE of MFE graph
-
-chart.ME(portfolio.st, 'GBPUSD', scale='percent', type='MAE')
-dev.new()
-chart.ME(portfolio.st, 'GBPUSD', scale='percent', type='MFE')
-
-##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
-# book = getOrderBook(port)
-# stats = tradeStats(port)
-# rets = PortfReturns(acct)
-################################################################
Copied: pkg/quantstrat/demo/luxor.7.exit.and.risk.R (from rev 1539, pkg/quantstrat/demo/luxor.7.exit+risk.R)
===================================================================
--- pkg/quantstrat/demo/luxor.7.exit.and.risk.R (rev 0)
+++ pkg/quantstrat/demo/luxor.7.exit.and.risk.R 2013-10-21 18:34:05 UTC (rev 1544)
@@ -0,0 +1,83 @@
+#!/usr/bin/Rscript --vanilla
+#
+# Jan Humme (@opentrades) - April 2013
+#
+# Tested and found to work correctly using blotter r1457
+#
+# After Jaekle & Tamasini: A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)
+#
+# Paragraph 3.5: determination of appropriate exit and risk management
+
+require(quantstrat)
+
+source(paste0(path.package("quantstrat"),"/demo/luxor.include.R"))
+
+##### 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()}
+
+source(paste0(path.package("quantstrat"),"/demo/luxor.getSymbols.R"))
+
+### blotter
+
+initPortf(portfolio.st, symbols='GBPUSD', initDate=initDate, currency='USD')
+initAcct(account.st, portfolios=portfolio.st, initDate=initDate, currency='USD')
+
+### quantstrat
+
+load.strategy('luxor')
+
+### BEGIN uncomment lines to activate StopLoss and/or StopTrailing and/or TakeProfit rules
+
+#enable.rule('luxor', 'chain', 'StopLoss')
+#enable.rule('luxor', 'chain', 'StopTrailing')
+#enable.rule('luxor', 'chain', 'TakeProfit')
+
+### END uncomment lines to activate StopLoss and/or StopTrailing and/or TakeProfit rules
+
+addPosLimit(
+ portfolio=portfolio.st,
+ symbol='GBPUSD',
+ timestamp=initDate,
+ maxpos=.orderqty)
+
+initOrders(portfolio.st, initDate=initDate)
+
+applyStrategy(strategy.st, portfolio.st, prefer='Open')
+
+View(getOrderBook(portfolio.st)[[portfolio.st]]$GBPUSD)
+
+###############################################################################
+
+updatePortf(portfolio.st, Symbols='GBPUSD', Dates=paste('::',as.Date(Sys.time()),sep=''))
+
+chart.Posn(portfolio.st, "GBPUSD")
+
+###############################################################################
+
+View(t(tradeStats(portfolio.st, 'GBPUSD')))
+
+###############################################################################
+
+print(tradeQuantiles('forex', 'GBPUSD'))
+
+dev.new()
+
+### Uncomment to choose appropriate MAE of MFE graph
+
+chart.ME(portfolio.st, 'GBPUSD', scale='percent', type='MAE')
+dev.new()
+chart.ME(portfolio.st, 'GBPUSD', scale='percent', type='MFE')
+
+##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
+# book = getOrderBook(port)
+# stats = tradeStats(port)
+# rets = PortfReturns(acct)
+################################################################
Modified: pkg/quantstrat/man/rulePctEquity.Rd
===================================================================
--- pkg/quantstrat/man/rulePctEquity.Rd 2013-10-19 17:26:25 UTC (rev 1543)
+++ pkg/quantstrat/man/rulePctEquity.Rd 2013-10-21 18:34:05 UTC (rev 1544)
@@ -51,7 +51,7 @@
add.rule(strategy.name, 'rulePctEquity',
arguments=list(rebalance_on='months',
trade.percent=.02,
- refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')])),
+ refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')])[,1]),
digits=0
),
type='rebalance',
More information about the Blotter-commits
mailing list