Learn R Programming

IBrokers (version 0.10-2)

reqContractDetails: Request Contract Details From TWS

Description

Returns an object (a list of class twsContractDetails objects) of IB contract details relating to a particular IB tradeable product.

Usage

reqContractDetails(conn,
                   Contract,
                   reqId = "1",
                   verbose = FALSE,
                   eventWrapper = eWrapper(),
                   CALLBACK = twsCALLBACK, ...)

Value

A twsContractDetails object, or list of the same.

Arguments

conn

a valid twsConnection

Contract

a valid twsContract

reqId

a unique ID

verbose

be verbose?

eventWrapper

event callback closure

CALLBACK

main callback loop

...

be verbose?

Author

Jeffrey A. Ryan

Details

Returns a list of details for the product specified. See the TWS API for specifics at this point.

References

Interactive Brokers https://www.interactivebrokers.com/

See Also

twsContract

Examples

Run this code
if (FALSE) {
tws <- twsConnect()
reqContractDetails(tws, twsEquity("QQQQ"))

# retrieve all QQQQ contracts as a list
reqContractDetails(tws, twsOption(local="", right="", symbol="QQQQ"))
# retrieve only calls
reqContractDetails(tws, twsOption(local="", right="C", symbol="QQQQ"))
# retrieve only puts
reqContractDetails(tws, twsOption(local="", right="P", symbol="QQQQ"))

opt.details <- lapply(c("MSFT","AAPL"),
                      function(x) {
                                    reqContractDetails(tws,
                                      twsOption(local="", right="",
                                                symbol=x))
                                  } )

length(opt.details) #number of symbols passed e.g. 2
sapply(opt.details, length) # contracts per symbol
}

Run the code above in your browser using DataLab