Description Usage Arguments Details Examples
This function will search the .instrument
environment for objects of
class type
, using first the primary_id
and then any
identifiers
to locate the instrument. Finally, it will try adding 1
and then 2 dots to the beginning of the primary_id
to see if an
instrument was stored there to avoid naming conflicts.
1 | getInstrument(x, Dates = NULL, silent = FALSE, type = "instrument")
|
x |
String identifier of instrument to retrieve |
Dates |
date range to retrieve 'as of', may not currently be implemented |
silent |
if TRUE, will not warn on failure, default FALSE |
type |
class of object to look for. See Details |
future
and option
objects may have a primary_id
that begins with 1 or 2 dots (in order to avoid naming conflics). For
example, the root specs for options (or futures) on the stock with ticker
"SPY" may be stored with a primary_id of "SPY", ".SPY", or "..SPY".
getInstrument
will try using each possible primary_id
until it finds an instrument of the appropriate type
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
option('..VX', multiplier=100,
underlying_id=future('.VX',multiplier=1000,
underlying_id=synthetic('VIX', currency("USD"))))
getInstrument("VIX")
getInstrument('VX') #returns the future
getInstrument("VX",type='option')
getInstrument('..VX') #finds the option
## End(Not run)
|
Loading required package: quantmod
Loading required package: xts
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Version 0.4-0 included new data defaults. See ?getSymbols.
[1] "..VX"
primary_id :"VIX"
currency :"USD"
multiplier :1
tick_size : NULL
identifiers: list()
type :"synthetic"
members : NULL
primary_id :".VX"
currency :"USD"
multiplier :1000
tick_size : NULL
identifiers : list()
type :"future"
underlying_id:"VIX"
primary_id :"..VX"
currency :"USD"
multiplier :100
tick_size : NULL
identifiers : list()
type :"option"
underlying_id:".VX"
primary_id :"..VX"
currency :"USD"
multiplier :100
tick_size : NULL
identifiers : list()
type :"option"
underlying_id:".VX"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.