Quantstrat faber_rebal.R demo error -
i have been going through demos in quantstrat. have problem running faber_rebal.r. fails following error:
> out<-applystrategy.rebalancing(strategy='faber' , portfolios='faber') error in `colnames<-`(`*tmp*`, value = c("maxpos", "longlevels", "minpos", : length of 'dimnames' [2] not equal array extent
here output of sessioninfo():
r version 3.0.1 (2013-05-16) platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] lc_collate=english_south africa.1252 lc_ctype=english_south africa.1252 [3] lc_monetary=english_south africa.1252 lc_numeric=c [5] lc_time=english_south africa.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] quantstrat_0.7.8 foreach_1.4.1 blotter_0.8.15 [4] performanceanalytics_1.1.0 financialinstrument_1.1 quantmod_0.4-0 [7] defaults_1.1-1 ttr_0.22-0 xts_0.9-5 [10] zoo_1.7-10 lattice_0.20-23 loaded via namespace (and not attached): [1] codetools_0.2-8 grid_3.0.1 iterators_1.0.6 tools_3.0.1
the problem occurs within function applystrategy.rebalancing when calls private function ruleproc.
i same error on ubuntu 12.04 machine r 3.0.1.
any working appreciated.
thanks charles
i had problems getting faber_rebal.r demo work well.
first, have set timezone:
ttz<-sys.getenv('tz') sys.setenv(tz='utc')
second, following line in add.rule rebalance work:
refprice=quote(last(getprice(mktdata)[paste('::',timestamp,sep='')][,1])),
so changed to:
refprice=quote(last(getprice(mktdata)[paste('::','20140119',sep='')][,1])),
i hope helps.
best, peter
Comments
Post a Comment