ls_twsInstruments: display the names of or delete twsInstruments.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

Arguments

pattern

an optional regular expression. Only names matching pattern are returned.

match

return only exact matches?

x

For the rm_ functions: x is what to remove. if not supplied all instruments of relevent class will be removed For ls_defined.by x is the string describing how the instrument was defined.

keep.currencies

If TRUE, currencies will not be deleted.

Details

rm_twsInstruments, and rm_non_twsInstruments 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.

ls_yahoo and ls_IB look for instruments with ‘yahoo’ or ‘IB’ in the defined.by slot, respectively Equivalently, ls_defined.by("yahoo") or ls_defined.by("IB") could be used. Note that being defined.by IB does does not necessarily mean that the instrument is a twsInstrument (i.e. the details may have been updated by IB, without an IB slot being added.)

Often is is useful to nest these functions.

Value

ls functions return vector of character strings corresponding to instruments of requested type rm functions are called for side-effect

Author(s)

Garrett See

See Also

ls_instruments, ls_currencies, ls_instruments_by, ls, rm, twsInstrument, instrument, stock, future, option, currency

Examples

 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
## Not run: 
rm_instruments(keep.currencies=FALSE) #remove everything from .instrument

# First, create some instruments
currency('USD')
currency('EUR')
currency('JPY')
#stocks
stock("S","USD")
stock('SPY','USD',1)
twsInstrument('XOM') #requires Interactive Brokers
twsInstrument(option(primary_id='XOM', currency='USD', multiplier=100,
    tick_size=0.01, expiry='201106', right='P', strike=80, underlying_id='XOM'))

# Now, the examples
ls_twsInstruments() #all instruments containing IB slot with twsContract object
ls_non_twsInstruments()

ls_defined.by('IB')
ls_IB() #same as above
ls_defined.by('IB', ls_options())

ls_yahoo()

rm_twsInstruments()
rm_yahoo()
rm_instruments() #remove all but currencies
rm_currencies()

## End(Not run)

gsee/twsInstrument documentation built on May 17, 2019, 8:55 a.m.