[Blotter-commits] r1059 - pkg/quantstrat/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 20 23:26:51 CEST 2012
Author: opentrades
Date: 2012-06-20 23:26:51 +0200 (Wed, 20 Jun 2012)
New Revision: 1059
Modified:
pkg/quantstrat/demo/luxor.p3_2.R
Log:
* now using --vanilla and defining instruments in code
* added tradeStats()
Modified: pkg/quantstrat/demo/luxor.p3_2.R
===================================================================
--- pkg/quantstrat/demo/luxor.p3_2.R 2012-06-20 12:57:10 UTC (rev 1058)
+++ pkg/quantstrat/demo/luxor.p3_2.R 2012-06-20 21:26:51 UTC (rev 1059)
@@ -1,4 +1,4 @@
-#!/usr/bin/Rscript --no-save
+#!/usr/bin/Rscript --vanilla
#
# Jan Humme (@opentrades) - June 2012
#
@@ -9,11 +9,12 @@
.qty=100000
.th=0.0005
.txn=-6
+.txn=0
initDate = '2002-10-21'
.from='2002-10-21'
.to='2008-07-04'
-#.to='2002-10-30'
+#.to='2002-10-23'
####
@@ -21,8 +22,17 @@
a = 'IB1'
###
+
require(quantstrat)
+currency(c('GBP', 'USD'))
+
+exchange_rate(c('GBPUSD'), tick_size=0.0001)
+
+setSymbolLookup.FI('~/R.symbols/', 'GBPUSD')
+
+###
+
getSymbols('GBPUSD', from=.from, to=.to, verbose=FALSE)
GBPUSD = to.minutes30(GBPUSD)
GBPUSD = align.time(to.minutes30(GBPUSD), 1800)
@@ -135,13 +145,15 @@
#
-#summary(s)
+###############################################################################
+#applyStrategy(s, p, prefer='Open', verbose = FALSE)
+applyStrategy(s, p, verbose = FALSE)
+
+updatePortf(p, Symbols='GBPUSD', ,Dates=paste('::',as.Date(Sys.time()),sep=''), Prices=GBPUSD)
+
###############################################################################
-applyStrategy(s, p, prefer='Open', verbose = FALSE)
-#applyStrategy(s, p, verbose = FALSE)
-
chart.Posn(p, "GBPUSD")
print(getOrderBook(p))
@@ -151,4 +163,5 @@
##txns$Net
cat('Net profit:', sum(txns$Net.Txn.Realized.PL), '\n')
-#tradeStats(p, 'GBPUSD')
+tradeStats(p, 'GBPUSD')
+
More information about the Blotter-commits
mailing list