Hi all;
I've been following the discussion here on backtesting
([R-SIG-Finance] Backtesting framework package -
<https://stat.ethz.ch/pipermail/r-sig-finance/2009q2/004404.html> and
the discussion [R-SIG-Finance] QuantMod trading models docs?
initiated by Mark Knecht and decided to give the blotter package a
try.
I tried running through the example provided by the blotter package.
</usr/lib64/R/library/blotter/html/blotter-package.html>
I installed the latest version from R-forge. I am running R version
2.9.1 (2009-06-26) on an AMD Turion 64 with a Gentoo 2.6.31 kernel.
Things ran smoothly as shown below until I got to the "p =
updatePortf(p,'2007-01')" step, where R kicked out
"Error in if (mid != 0 && key < vec[mid]) { :
missing value where TRUE/FALSE needed".
So I went along and looked at the
"/usr/lib64/R/library/blotter/html/00Index.html", which sent me along
to "/usr/lib64/R/library/blotter/html/updatePosPL.html" and attempted
to adjust some of the values because the usage seems to indicate that
additional values may be required
"Usage
updatePosPL(Portfolio, Symbol, StartDate, EndDate, Prices = Cl(get(Symbol)))
updatePortf(Portfolio, StartDate, EndDate)"
I added an EndDate using the same format as in the getSymbols command.
and received the following error.
p = updatePortf(p,'2007-01-01`, '2007-01-31')
Error: unexpected numeric constant in "p = updatePortf(p,'2007-01-01`, '2007"
I tried a couple of variations on the updatePosPL()
Error in if (any(i < 0)) { : missing value where TRUE/FALSE needed
At this point I am at a bit of a loss. I tried looking through some of
the stuff on R-Project to see if there are guidelines for code
examples and where and if they should work. I guess I would expect the
code examples include in the library or
"/usr/lib64/R/library/blotter/R-ex" to just work.
So, I am I doing something glaringly wrong? Do I need to update my
version of R, xts, zoo or quantmod? I know I am on still on the steep
part of the learning curve as far as R in general is concerned and
specifically with time series and financial data with R but R texts
I've seen suggest that working through examples with real data and
known steps is a great way to learn. Successfully working through
examples allows one small sign posts of success along the way
Any assistance would be appreciated.
Jan
Blotter example entered into R and responses after the first _________
I tried looking at the output for "p", see below the second ______. It
appears to be included in the data.frame
Values obtained through quantmod are below the third _______
________________________________
library(blotter)
Loading required package: xts
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
xts now requires a valid TZ environment variable to be set
no TZ var is set, setting to TZ=GMT