• C#
  • Java
  • VB
  • C++
  • Python
Contact us
EClientSocketSSL Class Reference

Implements a Secure Socket Layer (SSL) on top of the EClientSocket class. More...

Inheritance diagram for EClientSocketSSL:
EClientSocket EClient

Public Member Functions

 EClientSocketSSL (EWrapper wrapper, EReaderSignal signal)
 
- Public Member Functions inherited from EClientSocket
 EClientSocket (EWrapper wrapper, EReaderSignal eReaderSignal)
 
void eConnect (string host, int port, int clientId)
 
void eConnect (string host, int port, int clientId, bool extraAuth)
 Creates socket connection to TWS/IBG.
 
void redirect (string host)
 Redirects connection to different host.
 
- Public Member Functions inherited from EClient
 EClient (EWrapper wrapper)
 Constructor. More...
 
void SetConnectOptions (string connectOptions)
 Ignore. Used for IB's internal purposes.
 
void DisableUseV100Plus ()
 Allows to switch between different current (V100+) and previous connection mechanisms.
 
bool IsConnected ()
 Notifies whether or not a socket connection exists between the API client and the Host. Note this does not check the connection between TWS/IBG and the IB server. More...
 
void startApi ()
 Initiates the message exchange between the client application and the TWS/IB Gateway.
 
void Close ()
 Terminates the connection and notifies the EWrapper implementing class. More...
 
void eDisconnect ()
 Closes the socket connection and terminates its thread.
 
void cancelHistoricalData (int reqId)
 Cancels a historical data request. More...
 
void calculateImpliedVolatility (int reqId, Contract contract, double optionPrice, double underPrice, List< TagValue > impliedVolatilityOptions)
 Calculate the volatility for an option. Request the calculation of the implied volatility based on hypothetical option and its underlying prices. The calculation will be return in EWrapper's tickOptionComputation callback. More...
 
void calculateOptionPrice (int reqId, Contract contract, double volatility, double underPrice, List< TagValue > optionPriceOptions)
 Calculates an option's price. Calculates an option's price based on the provided volatility and its underlying's price. The calculation will be return in EWrapper's tickOptionComputation callback. More...
 
void cancelAccountSummary (int reqId)
 Cancels the account's summary request. After requesting an account's summary, invoke this function to cancel it. More...
 
void cancelCalculateImpliedVolatility (int reqId)
 Cancels an option's implied volatility calculation request. More...
 
void cancelCalculateOptionPrice (int reqId)
 Cancels an option's price calculation request. More...
 
void cancelFundamentalData (int reqId)
 Cancels Fundamental data request. More...
 
void cancelMktData (int tickerId)
 Cancels a RT Market Data request. More...
 
void cancelMktDepth (int tickerId)
 Cancel's market depth's request. More...
 
void cancelNewsBulletin ()
 Cancels IB's news bulletin subscription. More...
 
void cancelOrder (int orderId)
 Cancels an active order placed by that specific client (one with the same client ID) More...
 
void cancelPositions ()
 Cancels all account's positions request. More...
 
void cancelRealTimeBars (int tickerId)
 Cancels Real Time Bars' subscription. More...
 
void cancelScannerSubscription (int tickerId)
 Cancels Scanner Subscription. More...
 
void exerciseOptions (int tickerId, Contract contract, int exerciseAction, int exerciseQuantity, string account, int ovrd)
 Exercises your options. More...
 
void placeOrder (int id, Contract contract, Order order)
 Places or modifies an order. More...
 
void replaceFA (int faDataType, string xml)
 Replaces Financial Advisor's settings A Financial Advisor can define three different configurations: More...
 
void requestFA (int faDataType)
 Requests the FA configuration A Financial Advisor can define three different configurations: More...
 
void reqAccountSummary (int reqId, string group, string tags)
 Requests a specific account's summary. This method will subscribe to the account summary as presented in the TWS' Account Summary tab. The data is returned at EWrapper::accountSummary https://www.interactivebrokers.com/en/software/tws/accountwindowtop.htm. More...
 
void reqAccountUpdates (bool subscribe, string acctCode)
 Subscribes to an specific account's information and portfolio Through this method, a single account's subscription can be started/stopped. As a result from the subscription, the account's information, portfolio and last update time will be received at EWrapper::updateAccountValue, EWrapper::updateAccountPortfolio, EWrapper::updateAccountTime respectively. All account values and positions will be returned initially, and then there will only be updates when there is a change in a position, or to an account value every 3 minutes if it has changed. Only one account can be subscribed at a time. A second subscription request for another account when the previous one is still active will cause the first one to be canceled in favour of the second one. Consider user reqPositions if you want to retrieve all your accounts' portfolios directly. More...
 
void reqAllOpenOrders ()
 Requests all current open orders in all associated accounts. The existing orders will be received via the openOrder and orderStatus events. More...
 
void reqAutoOpenOrders (bool autoBind)
 Requests status updates about future orders placed from TWS. Can only be used with client ID 0. More...
 
void reqContractDetails (int reqId, Contract contract)
 Requests contract information. This 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. More...
 
void reqCurrentTime ()
 Requests TWS's current time. More...
 
void reqExecutions (int reqId, ExecutionFilter filter)
 Requests current day's (since the last IB server reset) executions matching the filter. Only the current day's executions can be retrieved. Along with the executions, the CommissionReport will also be returned. The execution details will arrive at EWrapper:execDetails. More...
 
void reqFundamentalData (int reqId, Contract contract, String reportType, List< TagValue > fundamentalDataOptions)
 Requests the contract's Reuters' global fundamental data. Reuters funalmental data will be returned at EWrapper::fundamentalData. More...
 
void reqGlobalCancel ()
 Cancels all the active orders. This method will cancel ALL open orders including those placed directly from TWS. More...
 
void reqHistoricalData (int tickerId, Contract contract, string endDateTime, string durationString, string barSizeSetting, string whatToShow, int useRTH, int formatDate, bool keepUpToDate, List< TagValue > chartOptions)
 Requests contracts' historical data. When requesting historical data, a finishing time and date is required along with a duration string. For example, having: More...
 
void reqIds (int numIds)
 Requests the next valid order ID at the current moment. More...
 
void reqManagedAccts ()
 Requests the accounts to which the logged user has access to. More...
 
void reqMktData (int tickerId, Contract contract, string genericTickList, bool snapshot, bool regulatorySnaphsot, List< TagValue > mktDataOptions)
 Requests real time market data. This function will return the product's market data. It is important to notice that only real time data can be delivered via the API. More...
 
void reqMarketDataType (int marketDataType)
 indicates the TWS to enable "frozen", "delayed" or "delayed-frozen" market data. Requires TWS/IBG v963+. The API can receive frozen market data from Trader Workstation. Frozen market data is the last data recorded in our system. During normal trading hours, the API receives real-time market data. Invoking this function with argument 2 requests a switch to frozen data immediately or after the close. When the market reopens the next data the market data type will automatically switch back to real time if available. More...
 
void reqMarketDepth (int tickerId, Contract contract, int numRows, List< TagValue > mktDepthOptions)
 Requests the contract's market depth (order book). Note this 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 equity, commissions, and quote booster packs. More...
 
void reqNewsBulletins (bool allMessages)
 Subscribes to IB's News Bulletins. More...
 
void reqOpenOrders ()
 Requests all open orders places by this specific API client (identified by the API client id). For client ID 0, this will bind previous manual TWS orders. More...
 
void reqPositions ()
 Subscribes to position updates for all accessible accounts. All positions sent initially, and then only updates as positions change. More...
 
void reqRealTimeBars (int tickerId, Contract contract, int barSize, string whatToShow, bool useRTH, List< TagValue > realTimeBarsOptions)
 Requests real time bars Currently, 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. Real time bars subscriptions are also included in the calculation of the number of Level 1 market data subscriptions allowed in an account. More...
 
void reqScannerParameters ()
 Requests an XML list of scanner parameters valid in TWS. Note: not all parameters are valid from API scanner. More...
 
void reqScannerSubscription (int reqId, ScannerSubscription subscription, List< TagValue > scannerSubscriptionOptions)
 Starts a subscription to market scan results based on the provided parameters. More...
 
void setServerLogLevel (int logLevel)
 Changes the TWS/GW log level. Valid values are:
1 = SYSTEM
2 = ERROR
3 = WARNING
4 = INFORMATION
5 = DETAIL
.
 
void verifyRequest (string apiName, string apiVersion)
 For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.
 
void verifyMessage (string apiData)
 For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.
 
void verifyAndAuthRequest (string apiName, string apiVersion, string opaqueIsvKey)
 For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.
 
void verifyAndAuthMessage (string apiData, string xyzResponse)
 For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.
 
void queryDisplayGroups (int requestId)
 Requests all available Display Groups in TWS requestId is the ID of this request.
 
void subscribeToGroupEvents (int requestId, int groupId)
 Integrates API client and TWS window grouping. requestId is the Id chosen for this subscription request groupId is the display group for integration.
 
void updateDisplayGroup (int requestId, string contractInfo)
 Updates the contract displayed in a TWS Window Group requestId is the ID chosen for this request contractInfo is an encoded value designating a unique IB contract. Possible values include: More...
 
void unsubscribeFromGroupEvents (int requestId)
 Cancels a TWS Window Group subscription.
 
void reqPositionsMulti (int requestId, string account, string modelCode)
 Requests positions for account and/or model. More...
 
void cancelPositionsMulti (int requestId)
 Cancels positions request for account and/or model. More...
 
void reqAccountUpdatesMulti (int requestId, string account, string modelCode, bool ledgerAndNLV)
 Requests account updates for account and/or model. More...
 
void cancelAccountUpdatesMulti (int requestId)
 Cancels account updates request for account and/or model. More...
 
void reqSecDefOptParams (int reqId, string underlyingSymbol, string futFopExchange, string underlyingSecType, int underlyingConId)
 Requests security definition option parameters for viewing a contract's option chain reqId the ID chosen for the request underlyingSymbol futFopExchange The exchange on which the returned options are trading. Can be set to the empty string "" for all exchanges. underlyingSecType The type of the underlying security, i.e. STK underlyingConId the contract ID of the underlying security. More...
 
void reqSoftDollarTiers (int reqId)
 Requests 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...
 
void reqFamilyCodes ()
 Requests family codes for an account, for instance if it is a FA, IBroker, or associated account. More...
 
void reqMatchingSymbols (int reqId, string pattern)
 Requests matching symbols (implements 'google-like' suggestions as user starts typing symbol or contract name) pattern - user typed string pattern. More...
 
void reqMktDepthExchanges ()
 Requests venues for which market data is returned to updateMktDepthL2 (those with market makers) More...
 
void reqSmartComponents (int reqId, String bboExchange)
 Returns the mapping of single letter codes to exchange names given the mapping identifier. More...
 
void reqNewsProviders ()
 Requests news providers which the user has subscribed to. More...
 
void reqNewsArticle (int requestId, string providerCode, string articleId)
 Requests news article body given articleId. More...
 
void reqHistoricalNews (int requestId, int conId, string providerCodes, string startDateTime, string endDateTime, int totalResults)
 Requests historical news headlines requestId conId - contract id of ticker providerCodes - a '+'-separated list of provider codes startDateTime - marks the (exclusive) start of the date range. The format is yyyy-MM-dd HH:mm:ss.0 endDateTime - marks the (inclusive) end of the date range. The format is yyyy-MM-dd HH:mm:ss.0 totalResults - the maximum number of headlines to fetch (1 - 300) More...
 
void reqHeadTimestamp (int tickerId, Contract contract, string whatToShow, int useRTH, int formatDate)
 Returns the timestamp of earliest available historical data for a contract and data type tickerId - an identifier for the request contract - contract object for which head timestamp is being requested whatToShow - type of data for head timestamp - "BID", "ASK", "TRADES", etc useRTH - use regular trading hours only, 1 for yes or 0 for no formatDate -. More...
 
void cancelHeadTimestamp (int tickerId)
 
void reqHistogramData (int tickerId, Contract contract, bool useRTH, string period)
 Returns data histogram of specified contract tickerId - an identifier for the request contract - Contract object for which histogram is being requested useRTH - use regular trading hours only, 1 for yes or 0 for no period - period of which data is being requested, e.g. "3 days". More...
 
void cancelHistogramData (int tickerId)
 Cancels an active data histogram request tickerId - identifier specified in reqHistogramData request. More...
 
int ReadInt ()
 
byte[] ReadAtLeastNBytes (int msgSize)
 
byte[] ReadByteArray (int msgSize)
 

Protected Member Functions

override Stream createClientStream (string host, int port)
 
- Protected Member Functions inherited from EClientSocket
override uint prepareBuffer (BinaryWriter paramsList)
 
override void CloseAndSend (BinaryWriter request, uint lengthPos)
 
- Protected Member Functions inherited from EClient
void sendConnectRequest ()
 
bool CheckServerVersion (int requiredVersion)
 
bool CheckServerVersion (int requestId, int requiredVersion)
 
bool CheckServerVersion (int requiredVersion, string updatetail)
 
bool CheckServerVersion (int tickerId, int requiredVersion, string updatetail)
 
void CloseAndSend (BinaryWriter paramsList, uint lengthPos, CodeMsgPair error)
 
void CloseAndSend (int reqId, BinaryWriter paramsList, uint lengthPos, CodeMsgPair error)
 
bool CheckConnection ()
 
void ReportError (int reqId, CodeMsgPair error, string tail)
 
void ReportUpdateTWS (int reqId, string tail)
 
void ReportUpdateTWS (string tail)
 
void ReportError (int reqId, int code, string message)
 
void SendCancelRequest (OutgoingMessages msgType, int version, int reqId, CodeMsgPair errorMessage)
 
void SendCancelRequest (OutgoingMessages msgType, int version, CodeMsgPair errorMessage)
 
bool VerifyOrderContract (Contract contract, int id)
 
bool VerifyOrder (Order order, int id, bool isBagOrder)
 

Additional Inherited Members

- Protected Attributes inherited from EClient
int serverVersion
 
ETransport socketTransport
 
EWrapper wrapper
 
bool isConnected
 
int clientId
 
bool extraAuth
 
bool useV100Plus = true
 
bool allowRedirect = false
 
Stream tcpStream
 
- Properties inherited from EClient
EWrapper Wrapper [get]
 Reference to the EWrapper implementing object.
 
bool AllowRedirect [get, set]
 
int ServerVersion [get]
 returns the Host's version. Some of the API functionality might not be available in older Hosts and therefore it is essential to keep the TWS/Gateway as up to date as possible.
 
string ServerTime [get, set]
 
string optionalCapabilities [get, set]
 
bool AsyncEConnect [get, set]
 

Detailed Description

Implements a Secure Socket Layer (SSL) on top of the EClientSocket class.