Description Usage Arguments Details Value Note Author(s) Examples
Given a name, this function will attempt to create an instrument of the appropriate type.
1 2 3 4 |
primary_id |
charater primary identifier of instrument to be created |
currency |
character name of currency that instrument will be denominated it. Default=“USD” |
multiplier |
numeric product multiplier |
silent |
TRUE/FALSE. silence warnings? |
default_type |
What type of instrument to make if it is not clear from the primary_id. ("stock", "future", etc.) Default is NULL. |
root |
character string to pass to
|
assign_i |
TRUE/FALSE. Should the |
... |
other passthrough parameters |
If currency
is not already defined, it will be
defined (unless it is not 3 uppercase characters). The
default value for currency
is “USD”. If
you do not provide a value for currency
,
“USD” will be defined and used to create the
instrument.
If primary_id
is 6 uppercase letters and
default_type
is not provided, it will be assumed
that it is the primary_id of an
exchange_rate
, in which case, the 1st and
2nd half of primary_id
will be defined as
currency
s if not the names of already
defined instrument
s. If the
primary_id
begins with a “^” it will be
assumed that it is a yahoo symbol and that the instrument
is an index (synthetic), and the ‘src’ will be set
to “yahoo”. (see setSymbolLookup
)
If it is not clear from the primary_id
what type
of instrument to create, an instrument of type
default_type
will be created (which is 'NULL' by
default). This will happen when primary_id
is
that of a stock
, future
,
option
, or bond
. This may
also happen if primary_id
is that of a
future_series
or
option_series
but the corresponding
future
or option
cannot be found. In this
case, the instrument type would be default_type
,
but a lot of things would be filled in as if it were a
valid series instrument (e.g. ‘expires’,
‘strike’, ‘suffix_id’, etc.)
Primarily called for its side-effect, but will return the name of the instrument that was created
This is not intended to be used to create instruments of
type stock
, future
, option
, or
bond
although it may be updated in the future.
Garrett See
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
instrument.auto("CL_H1.U1")
getInstrument("CL_H1.U1") #guaranteed_spread
instrument.auto("ES_H1.YM_H1")
getInstrument("ES_H1.YM_H1") #synthetic
currency(c("USD","EUR"))
instrument.auto("EURUSD")
getInstrument("EURUSD") #made an exchange_rate
instrument.auto("VX_H11") #no root future defined yet!
getInstrument("VX_H11") #couldn't find future, didnt make future_series
future("VX","USD",1000,underlying_id=synthetic("SPX","USD")) #make the root
instrument.auto("VX_H11") #and try again
getInstrument("VX_H11") #made a future_series
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.