Description Usage Arguments Details Value Author(s) See Also Examples
display the names of or delete instruments, stocks, options, futures, currencies, bonds, funds, spreads, guaranteed_spreads, synthetics, derivatives, or non-derivatives.
pattern |
an optional regular expression. Only names matching ‘pattern’ are returned. |
match |
return only exact matches? |
verbose |
be verbose? |
include.series |
should future_series or option_series instruments be included. |
x |
what to remove. if not supplied all instruments
of relevent class will be removed. For
|
keep.currencies |
If TRUE, currencies will not be deleted. |
includeFX |
should exchange_rates be included in ls_non_currencies results |
ls functions return the names of all the instruments of the class implied by the function name. rm functions remove the instruments of the class implied by the function name
rm_instruments and rm_non_derivatives will not delete currencies unless the keep.currencies argument is FALSE.
For the rm functions, x can be a vector of instrument
names, or nothing. If x
is missing, all
instruments of the relevant type will be removed.
It can be useful to nest these functions to get things like futures denominated in USD.
ls functions return vector of character strings corresponding to instruments of requested type rm functions are called for side-effect
Garrett See
ls_instruments_by, ls_by_currency, ls_by_expiry, ls, rm, instrument, stock, future, option, currency, FinancialInstrument::sort_ids
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Not run:
#rm_instruments(keep.currencies=FALSE) #remove everything from .instrument
# First, create some instruments
currency(c("USD", "EUR", "JPY"))
#stocks
stock(c("S", "SE", "SEE", "SPY"), 'USD')
synthetic("SPX", "USD", src=list(src='yahoo', name='^GSPC'))
#derivatives
option('.SPY', 'USD', multiplier=100, underlying_id='SPY')
option_series(root_id="SPY", expires='2011-06-18', callput='put', strike=130)
option_series(root_id="SPY", expires='2011-09-17', callput='put', strike=130)
option_series(root_id="SPY", expires='2011-06-18', callput='call', strike=130)
future('ES', 'USD', multiplier=50, expires='2011-09-16', underlying_id="SPX")
option('.ES','USD',multiplier=1, expires='2011-06',strike=1350, right='C', underlying_id='ES')
# Now, the examples
ls_instruments() #all instruments
ls_instruments("SE") #only the one stock
ls_instruments("S", match=FALSE) #anything with "S" in name
ls_currencies()
ls_stocks()
ls_options()
ls_futures()
ls_derivatives()
ls_puts()
ls_non_derivatives()
#ls_by_expiry('20110618',ls_puts()) #put options that expire on Jun 18th, 2011
#ls_puts(ls_by_expiry('20110618')) #same thing
rm_options('SPY_110618C130')
rm_futures()
ls_instruments()
#rm_instruments('EUR') #Incorrect
rm_instruments('EUR', keep.currencies=FALSE) #remove the currency
rm_currencies('JPY') #or remove currency like this
ls_currencies()
ls_instruments()
rm_instruments() #remove all but currencies
rm_currencies()
option_series.yahoo('DIA')
ls_instruments_by('underlying_id','DIA') #underlying_id must exactly match 'DIA'
ls_derivatives('DIA',match=FALSE) #primary_ids that contain 'DIA'
rm_instruments()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.