[R-SIG-Finance] Potential bug in quantstrat in how it handles "F" symbol
Sergey Pisarenko
drseergio at gmail.com
Thu Mar 1 06:46:26 CET 2012
Hi,
I have been running a strategy against a large selection of market
symbols and stumbled across of what appears to be a bug in how
quanstrat gets market data in "applyStrategy" method.
The problem lies in the strategy.R file, in the applyStrategy method:
applyStrategy <- function(strategy , portfolios, mktdata=NULL ,
parameters=NULL, ..., verbose=TRUE, symbols=NULL, initStrat=FALSE,
updateStrat=FALSE ) {
..
for (symbol in symbols){
if(isTRUE(load.mktdata)) mktdata <- get(symbol)
The issue here is that get('F') will return FALSE because F is defined
as FALSE in R. This will obviously cause a failure down the road where
market data is read and manipulated.
Perhaps it should be looking in a specific environment instead of
using get against all environments.
/Sergey
More information about the R-SIG-Finance
mailing list