[R-SIG-Finance] Blotter package - problem with example.

kafkaz kafka at centras.lt
Sun Feb 28 20:11:05 CET 2010


Brian,
I tried demo('longtrend') and the result is:

# Load data with quantmod
> print("Loading data")
[1] "Loading data"

> currency("USD")
Error in eval.with.vis(expr, envir, enclos) : 
  could not find function "currency"
In addition: There were 11 warnings (use warnings() to see them)

My problems started, then I tried to add a new transaction:

addTxn(portfolio, "SPY", '2007-01-03', 50, 96.5, -0.05*50) 
[1] "2007-01-03 SPY 50 @ 96.5"
Warning messages:
1: In getInstrument(Symbol) :
  Instrument SPY  not found, please create it first.


I debugged a bit and I found, that getInstrument function fails on this
line:
if (inherits(tmp_instr, "try-error") | !is.instrument(tmp_instr)) {

I suspect, that FinancialInstrument package isn't committed properly.
Currency, stock methods
do not exist in my environment. The version of FI is 0.02, blotter v.0.4

As well, I have noticed, that environment variables are used very heavily.
What is the reason of using
environment variables instead of local variables? For example, in initPortf
method:
if (exists(paste("portfolio", name, sep = "."), envir = .blotter, 
        inherits = TRUE))
I found it frustrating, when I tried to recreate a portfolio and an account,
but I couldn't.

Thanks,
kafka
-- 
View this message in context: http://n4.nabble.com/Blotter-package-problem-with-example-tp1018634p1572896.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list