[R-SIG-Finance] Blotter package - problem with example.
Brian G. Peterson
brian at braverock.com
Sun Feb 28 20:25:47 CET 2010
kafkaz wrote:
> 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:
>
>
<...>
> 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
>
>
Yes, I tried using @alias tags (getting fancy) in the documentation, and
it messed up the NAMESPACE file. Sorry.
This was fixed in revision 270 a couple of days ago, which looks like
it's available as prebuilt packages on R-Forge now.
updating FinancialInstrument should fix this.
> 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.
>
getPortfolio() and getAccount()
will let you examine the Portfolio and Account objects by providing
local copies in the global environment.
The primary reason for using the environment is performance. By using
get() and assign() we can minimize unnecessary copying as things are called.
The secondary (but important) reason for using environment variables
instead of local (passed) variables is that we need to maintain control
over the objects. By putting them in an environment, they don't clutter
the global environment, and we have a reasonable belief that only expert
users will 'touch' the objects themselves.
The tertiary reason is that we expect that these objects and/or their
methods will probably get reimplemented in C/C++ at some point, and will
not necessarily remain as pure R code for performance. We've (mostly)
stabilized the API and function calls, so those should (mostly) remain
the same (I'm relying on this code on real portfolios at this point) but
the 'internals' may change as we optimize the execution.
Regards,
- Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list