Description Usage Arguments Details Value Author(s) Examples
If a Contract is no longer valid, this will request the new contract
1 | updateContract(x, add.identifier = TRUE, type = "instrument", ...)
|
x |
character primary_id of an instrument |
add.identifier |
logical. If the conId has changed, should a “old.conId” identifier be added to the instrument? |
type |
type of instrument being updated. Passed to
|
... |
arguments to pass to |
Interactive Brokers occationally changes the conId that is associated with
a given instrument (for example, after a split, they change the conId).
This function will check to make sure that the Contract that
getContract
finds is still valid. If not, it will request
the new Contract and store it in the IB attribute of the instrument.
This is a very simple function
character name of instrument
Garrett See
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
#backup instrument envir
ibak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
rm_instruments()
define_stocks("SPY")
contr <- getContract("SPY")
contr$conId <- "0000000"
instrument_attr("SPY", "IB", contr)
getContract("SPY") #bad conId
updateContract("SPY")
getInstrument("SPY") #updated
## Restore previous instrument environment
rm_instruments(keep=FALSE)
loadInstruments(ibak)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.