SCM

SCM Repository

[blotter] Annotation of /pkg/quantstrat/demo/luxor.3.paramset.sma.R
ViewVC logotype

Annotation of /pkg/quantstrat/demo/luxor.3.paramset.sma.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1565 - (view) (download)

1 : opentrades 1457 #!/usr/bin/Rscript --vanilla
2 :     #
3 :     # Jan Humme (@opentrades) - August 2012, revised April 2013
4 :     #
5 : opentrades 1458 # Tested and found to work correctly using blotter r1457
6 : opentrades 1457 #
7 : opentrades 1458 # After Jaekle & Tamasini: A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)
8 : opentrades 1457 #
9 : opentrades 1458 # Paragraph 3.3: luxor SMA paramset optimization
10 : opentrades 1457
11 :     ###
12 : erastus 1515 require(quantstrat)
13 : opentrades 1457
14 : erastus 1515 source(paste0(path.package("quantstrat"),"/demo/luxor.include.R"))
15 :     source(paste0(path.package("quantstrat"),"/demo/luxor.getSymbols.R"))
16 : opentrades 1457
17 :     ### blotter
18 :    
19 :     initPortf(portfolio.st, symbols='GBPUSD', initDate=initDate, currency='USD')
20 :     initAcct(account.st, portfolios=portfolio.st, initDate=initDate, currency='USD')
21 :    
22 :     ### quantstrat
23 :    
24 :     initOrders(portfolio.st, initDate=initDate)
25 :    
26 :     load.strategy(strategy.st)
27 :    
28 :     ### doMC
29 : erastus 1515 if (!"doMC" %in% installed.packages()[,1]) {
30 :     install.packages("doMC")
31 :     }
32 : opentrades 1457 require(doMC)
33 :     registerDoMC(cores=8)
34 :    
35 :     #require(doParallel)
36 :     #registerDoParallel(cores=2)
37 :    
38 :     #require(doRedis)
39 :     #registerDoRedis('jobs')
40 :    
41 :     results <- apply.paramset(strategy.st, paramset.label='SMA', portfolio.st=portfolio.st, account.st=account.st, nsamples=.nsamples, verbose=TRUE)
42 :    
43 :     ###
44 :    
45 :     stats <- results$tradeStats
46 :    
47 :     print(stats)
48 :    
49 : opentrades 1565 save(stats, file='luxor.3.paramset.sma.RData')
50 : opentrades 1457

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge