Public Member Functions

View as MarkdownOpen in Claude
NameTypeDescription
SetConnectOptions (string connectOptions)voidIgnore. Used for IB’s internal purposes.
DisableUseV100Plus ()voidAllows to switch between different current (V100+) and previous connection mechanisms.
IsConnected ()boolIndicates whether the API-TWS connection has been closed. Note: This function is not automatically invoked and must be by the API client. More…
startApi ()voidInitiates the message exchange between the client application and the TWS/IB Gateway.
Close ()voidTerminates the connection and notifies the EWrapper implementing class. More…
eDisconnect (bool resetState=true)virtual voidCloses the socket connection and terminates its thread.
reqCompletedOrders (bool apiOnly)voidRequests completed orders.
None. More…None
cancelTickByTickData (int requestId)voidCancels tick-by-tick data.
None. More…None
reqTickByTickData (int requestIdvoidContract contract
None. More…None
cancelHistoricalData (int reqId)voidCancels a historical data request. More…
calculateImpliedVolatility (int reqIdvoidContract contract
NoneRequest the calculation of the implied volatility based on hypothetical option and its underlying prices.None
NoneThe calculation will be return in EWrapper’s tickOptionComputation callback.None
None. More…None
calculateOptionPrice (int reqIdvoidContract contract
NoneThe calculation will be return in EWrapper’s tickOptionComputation callback.None
None. More…None
cancelAccountSummary (int reqId)voidCancels the account’s summary request. After requesting an account’s summary
cancelCalculateImpliedVolatility (int reqId)voidCancels an option’s implied volatility calculation request. More…
cancelCalculateOptionPrice (int reqId)voidCancels an option’s price calculation request. More…
cancelFundamentalData (int reqId)voidCancels Fundamental data request. More…
cancelMktData (int tickerId)voidCancels a RT Market Data request. More…
cancelMktDepth (int tickerIdvoidbool isSmartDepth)
cancelNewsBulletin ()voidCancels IB’s news bulletin subscription. More…
cancelOrder (int orderIdvoidstring manualOrderCancelTime)
NoneNote: API clients cannot cancel individual orders placed by other clients. Only reqGlobalCancel is available.None
None. More…None
cancelPositions ()voidCancels a previous position subscription request made with reqPositions. More…
cancelRealTimeBars (int tickerId)voidCancels Real Time Bars’ subscription. More…
cancelScannerSubscription (int tickerId)voidCancels Scanner Subscription. More…
exerciseOptions (int tickerIdvoidContract contract
NoneNote: this function is affected by a TWS setting which specifies if an exercise request must be finalized. More…None
placeOrder (int idvoidContract contract
replaceFA (int reqIdvoidint faDataType
requestFA (int faDataType)voidRequests the FA configuration A Financial Advisor can define three different configurations: More…
reqAccountSummary (int reqIdvoidstring group
NoneThis method will subscribe to the account summary as presented in the TWS’ Account Summary tab. The data is returned at EWrapper::accountSummaryNone
Nonehttps://www.interactivebrokers.com/en/software/tws/accountwindowtop.htm. More…None
reqAccountUpdates (bool subscribevoidstring acctCode)
reqAllOpenOrders ()voidRequests all current open orders in associated accounts at the current moment. The existing orders will be received via the openOrder and orderStatus events. Open orders are returned once; this function does not initiate a subscription. More…
reqAutoOpenOrders (bool autoBind)voidRequests status updates about future orders placed from TWS. Can only be used with client ID 0. More…
reqContractDetails (int reqIdvoidContract contract)
NoneThis method will provide all the contracts matching the contract provided. It can also be used to retrieve complete options and futures chains. This information will be returned at EWrapper:contractDetails. Though it is now (in API version > 9.72.12) advised to use reqSecDefOptParams for that purpose.None
None. More…None
reqCurrentTime ()voidRequests TWS’s current time. More…
reqExecutions (int reqIdvoidExecutionFilter filter)
reqFundamentalData (int reqIdvoidContract contract
reqGlobalCancel ()voidCancels all active orders.
NoneThis method will cancel ALL open orders including those placed directly from TWS. More…None
reqHistoricalData (int tickerIdvoidContract contract
reqIds (int numIds)voidRequests the next valid order ID at the current moment. More…
reqManagedAccts ()voidRequests the accounts to which the logged user has access to. More…
reqMktData (int tickerIdvoidContract contract
reqMarketDataType (int marketDataType)voidSwitches data type returned from reqMktData request to “frozen”
NoneThe API can receive frozen market data from Trader Workstation. Frozen market data is the last data recorded in our system.None
the API receives real-time market data. Invoking this function with argument 2 requests a switch to frozen data immediately or after the close.During normal trading hoursNone
the market data type will automatically switch back to real time if available. More…When the market reopensNone
reqMarketDepth (int tickerIdvoidContract contract
commissionsThis request must be direct-routed to an exchange and not smart-routed. The number of simultaneous market depth requests allowed in an account is calculated based on a formula that looks at an accounts equityand quote booster packs. More…
reqNewsBulletins (bool allMessages)voidSubscribes to IB’s News Bulletins. More…
reqOpenOrders ()voidRequests all open orders places by this specific API client (identified by the API client id). For client ID 0
reqPositions ()voidSubscribes to position updates for all accessible accounts. All positions sent initially
reqRealTimeBars (int tickerIdvoidContract contract
only 5 seconds bars are provided. This request is subject to the same pacing as any historical data request: no more than 60 API queries in more than 600 seconds.CurrentlyNone
NoneReal time bars subscriptions are also included in the calculation of the number of Level 1 market data subscriptions allowed in an account. More…None
reqScannerParameters ()voidRequests an XML list of scanner parameters valid in TWS.
NoneNot all parameters are valid from API scanner. More…None
reqScannerSubscription (int reqIdvoidScannerSubscription subscription
reqScannerSubscription (int reqIdvoidScannerSubscription subscription
setServerLogLevel (int logLevel)voidChanges the TWS/GW log level. The default is 2 = ERROR
None5 = DETAIL is required for capturing all API messages and troubleshooting API programsNone
NoneValid values are:None
None1 = SYSTEMNone
None2 = ERRORNone
None3 = WARNINGNone
None4 = INFORMATIONNone
None5 = DETAILNone
None.None
verifyRequest (string apiNamevoidstring apiVersion)
verifyMessage (string apiData)voidFor IB’s internal purpose. Allows to provide means of verification between the TWS and third party programs.
verifyAndAuthRequest (string apiNamevoidstring apiVersion
verifyAndAuthMessage (string apiDatavoidstring xyzResponse)
queryDisplayGroups (int requestId)voidRequests all available Display Groups in TWS. More…
subscribeToGroupEvents (int requestIdvoidint groupId)
updateDisplayGroup (int requestIdvoidstring contractInfo)
unsubscribeFromGroupEvents (int requestId)voidCancels a TWS Window Group subscription.
reqPositionsMulti (int requestIdvoidstring account
cancelPositionsMulti (int requestId)voidCancels positions request for account and/or model. More…
reqAccountUpdatesMulti (int requestIdvoidstring account
cancelAccountUpdatesMulti (int requestId)voidCancels account updates request for account and/or model. More…
reqSecDefOptParams (int reqIdvoidstring underlyingSymbol
reqSoftDollarTiers (int reqId)voidRequests pre-defined Soft Dollar Tiers. This is only supported for registered professional advisors and hedge and mutual funds who have configured Soft Dollar Tiers in Account Management. Refer to: https://www.interactivebrokers.com/en/software/am/am/manageaccount/requestsoftdollars.htm?Highlight=soft%20dollar%20tier. More…
reqFamilyCodes ()voidRequests family codes for an account
reqMatchingSymbols (int reqIdvoidstring pattern)
reqMktDepthExchanges ()voidRequests venues for which market data is returned to updateMktDepthL2 (those with market makers) More…
reqSmartComponents (int reqIdvoidstring bboExchange)
reqNewsProviders ()voidRequests news providers which the user has subscribed to. More…
reqNewsArticle (int requestIdvoidstring providerCode
reqHistoricalNews (int requestIdvoidint conId
reqHeadTimestamp (int tickerIdvoidContract contract
cancelHeadTimestamp (int tickerId)voidCancels a pending reqHeadTimeStamp request
None. More…None
reqHistogramData (int tickerIdvoidContract contract
None. More…None
cancelHistogramData (int tickerId)voidCancels an active data histogram request. More…
reqMarketRule (int marketRuleId)voidRequests details about a given market rule
NoneThe market rule for an instrument on a particular exchange provides details about how the minimum price increment changes with priceNone
NoneA list of market rule ids can be obtained by invoking reqContractDetails on a particular contract. The returned market rule ID list will provide the market rule ID for the instrument in the correspond valid exchange list in contractDetails.None
None. More…None
reqPnL (int reqIdvoidstring account
cancelPnL (int reqId)voidcancels subscription for real time updated daily PnL params reqId
reqPnLSingle (int reqIdvoidstring account
cancelPnLSingle (int reqId)voidCancels real time subscription for a positions daily PnL information. More…
reqHistoricalTicks (int reqIdvoidContract contract
reqWshMetaData (int reqId)voidRequests metadata from the WSH calendar. More…
cancelWshMetaData (int reqId)voidCancels pending request for WSH metadata. More…
reqWshEventData (int reqIdvoidWshEventData wshEventData)
cancelWshEventData (int reqId)voidCancels pending WSH event data request. More…
reqUserInfo (int reqId)voidRequests user info. More…
IsDataAvailable ()boolNone
ReadInt ()intNone
ReadAtLeastNBytes (int msgSize)byte[]None
ReadByteArray (int msgSize)byte[]None