Skip to content

FinancialInstrument functions output / side effect variables

3 messages · Doug Edmunds, G See

#
How can I see what the names of variables and what is being stored
in them when running functions in the FinancialInstrument package?  I am 
using R-Studio.

For example, running:
 > currency("USD")
outputs this to the console window:
[1] "USD"

but gives me no clue as to where that value is being
stored or how to access it.

Similarly, reading a tutorial such as:

http://blog.fosstrading.com/2011/07/creating-financial-instrument-metadata.html, 
it says:

"build_series_symbols returns a vector of series symbols that we could 
use to request data or create future_series instruments."

But what is the name of the vector?  Where is it stored?

Thanks.
#
Hi Doug,

You can use getInstrument to see the instruments

e.g.

  stock("SPY", currency("USD"))
  getInstrument("USD")
  getInstrument("SPY")

Please take a look at the files in the demo directory
(https://r-forge.r-project.org/scm/viewvc.php/pkg/FinancialInstrument/demo/FIdemo2.R?view=markup&root=blotter)

You'll also probably be interested in ?buildHierarchy

build_series_symbols does nothing but return a character vector and it
does not store it anywhere and it does not create any instruments. (I
personally use future_id from the twsInstrument package to serve the
purpose of build_series_symbols)

HTH,
Garrett
On Fri, Aug 24, 2012 at 11:37 AM, Doug Edmunds <dougedmunds at gmail.com> wrote:
#
Doug,

I re-read your question.  Let me clarify.  Instruments are stored in
an environment called .instrument at the top level of the package.
You can see everything in that environment like this

  ls(FinancialInstrument:::.instrument)

However, there are lots of functions show the primary_ids of
instruments that do some checking to make sure that what is being
shown are indeed primary_ids of instruments.

e.g

  ls_stocks()
  ls_currencies()
  ls_instruments()

Let me know if I can offer more clarity.

Best,
Garrett
On Fri, Aug 24, 2012 at 11:44 AM, G See <gsee000 at gmail.com> wrote: