Skip to content
Prev 12294 / 15274 Next

quantstrat demo(faber_rebal)

Dear Gei,

Thanks for the swift reply. Replacing timestamp by pindex[i] in the
add.rule doesn't solve the problem. Does the quick fix work for you?
The downloaded data doesn't have any missing values.

Simon

library(quantstrat)
Sys.setenv(TZ = "America/New_York")
source("faber_rebal.R")

[1] "setup completed"
Error in if (is.na(price)) stop("order at timestamp ", timestamp, "
must not have price of NA") :
  argument is of length zero

# add quaterly rebalancing
add.rule('faber', 'rulePctEquity',
        arguments=list(rebalance_on='quarters',
                trade.percent=1/length(symbols),

refprice=quote(last(getPrice(mktdata)[paste('::',pindex[i],sep='')][,1])),
                digits=0
        ),
        type='rebalance',
        label='rebalance'
)
On Fri, Mar 28, 2014 at 11:36 PM, Gei Lin <gmonaie at gmail.com> wrote: