InteractiveBrokersMessageAdapter

StockSharp.InteractiveBrokers

The messages adapter for InteractiveBrokers.

継承元: MessageAdapter

実装: IAddressAdapter<EndPoint>

コンストラクター

InteractiveBrokersMessageAdapter(IdGenerator)

Initializes a new instance of the InteractiveBrokersMessageAdapter.

transactionIdGenerator
Transaction id generator.

プロパティ

Address : EndPoint

Address.

AllTimeFrames : IEnumerable<TimeSpan>

Possible time-frames.

CandlesBuildFrom : IEnumerable<Level1Fields>

Possible options for candles building.

CheckCertificateRevocation : bool

Check certificate revocation.

ClientId : int

Unique ID. Used when several clients are connected to one terminal or gateway.

ConnectedTime : DateTime?

The connection time.

ExtraAuth : bool

Extra authentication.

ExtraSetup : bool

The adapter requires extra setup.

FeatureName : string

Feature name.

IsAutoReplyOnTransactonalUnsubscription : bool

Send auto response for OrderStatusMessage and PortfolioLookupMessage unsubscribes.

MarketDataType : InteractiveBrokersMarketDataTypes

Whether to use RealTime data or Frozen on the broker server. By default, the RealTime data is used.

MaxVersion : ServerVersions

Max support version.

OptionalCapabilities : string

Optional capabilities.

ServerLogLevel : ServerLogLevels

The server messages logging level. The default is Information.

SslCertificate : string

SSL certificate.

SslCertificatePassword : SecureString

SSL certificate password.

SslProtocol : SslProtocols

SSL protocol to establish connect.

SupportedOrderBookDepths : IEnumerable<int>

Available options for MaxDepth.

TargetHost : string

The name of the server that shares SSL connection.

UseV100Plus : bool

Use V100 plus version at the connect time.

ValidateRemoteCertificates : bool

Validate remove certificates.

メソッド

CancelHistogramData(long, CancellationToken) : ValueTask

Cancels an active data histogram request.

requestId
Identifier specified in CancellationToken) request.
cancellationToken
CancellationToken
CancelTickByTickData(long, CancellationToken) : ValueTask

Cancels tick-by-tick data.

CancelWshEventData(long, CancellationToken) : ValueTask

Cancels pending WSH event data request.

CancelWshMetaData(long, CancellationToken) : ValueTask

Cancels pending request for WSH metadata.

ConvertPeriod(DateTime, DateTime) : string

used for reqHistoricalData.

ExerciseOptions(OrderRegisterMessage, bool, decimal, string, bool, DateTime?, string, bool?, CancellationToken) : ValueTask

Exercises an options contract. This function is affected by a TWS setting which specifies if an exercise request must be finalized.

message
this structure contains a description of the contract to be exercised. If no multiplier is specified, a default of 100 is assumed.
isExercise
this can have two values: 1 = specifies exercise 2 = specifies lapse.
volume
the number of contracts to be exercised.
portfolioName
specifies whether your setting will override the system's natural action. For example, if your action is "exercise" and the option is not in-the-money, by natural action the option would not exercise. If you have override set to "yes" the natural action would be overridden and the out-of-the money option would be exercised. Values are: 0 = no 1 = yes.
isOverride
specifies whether your setting will override the system's natural action. For example, if your action is "exercise" and the option is not in-the-money, by natural action the option would not exercise. If you have override set to "yes" the natural action would be overridden and the out-of-the money option would be exercised. Values are: 0 = no 1 = yes.
manualOrderTime
Manual Order Time.
customerAccount
Customer Account.
professionalCustomer
Professional Customer.
cancellationToken
CancellationToken
IsAllDownloadingSupported(DataType) : bool

Is for the specified all securities downloading enabled.

dataType
Data type info.

戻り値: Check result.

IsSupportCandlesUpdates(MarketDataMessage) : bool

Support candles subscription and live updates.

subscription
MarketDataMessage

戻り値: Check result.

Load(SettingsStorage)

Load settings.

storage
Settings storage.
QueryDisplayGroups(long, CancellationToken) : ValueTask

Requests all available Display Groups in TWS.

requestId
The ID of this request.
cancellationToken
CancellationToken
ReplaceFinancialAdvisor(long, string, string, CancellationToken) : ValueTask

Replaces Financial Advisor's settings.

requestId
dataType
Specifies the type of Financial Advisor configuration data being requested. Valid values include: Groups Profiles Account Aliases
config
The XML string containing the new FA configuration information.
cancellationToken
CancellationToken
RequestAllOpenOrders(CancellationToken) : ValueTask

Call this method to request the open orders that were placed from all clients and also from TWS. Each open order will be fed back through the openOrder() and orderStatus() functions on the EWrapper. No association is made between the returned orders and the requesting client.

RequestAutoOpenOrders(bool, CancellationToken) : ValueTask

Call this method to request that newly created TWS orders be implicitly associated with the client. When a new TWS order is created, the order will be associated with the client and fed back through the openOrder() and orderStatus() methods on the EWrapper. TWS orders can only be bound to clients with a clientId of “0”.

autoBind
If set to , newly created TWS orders will be implicitly associated with the client. If set to , no association will be made.
cancellationToken
CancellationToken
RequestCompletedOrders(bool, CancellationToken) : ValueTask

Requests completed orders.

apiOnly
Request only API orders.
cancellationToken
CancellationToken
RequestCurrentTime(CancellationToken) : ValueTask

Returns the current system time on the server side.

RequestFamilyCodes(CancellationToken) : ValueTask

Requests family codes for an account, for instance if it is a FA, IBroker, or associated account.

RequestFinancialAdvisor(string, CancellationToken) : ValueTask

Requests the FA configuration.

dataType
Specifies the type of Financial Advisor configuration data being requested. Valid values include: Groups Profiles Account Aliases
cancellationToken
CancellationToken
RequestHeadTimestamp(long, SecurityMessage, string, int, int, CancellationToken) : ValueTask

Returns the timestamp of earliest available historical data for a contract and data type.

requestId
An identifier for the request.
security
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.
formatDate
Set to 1 to obtain the bars' time as yyyyMMdd HH:mm:ss, set to 2 to obtain it like system time format in seconds.
cancellationToken
CancellationToken
RequestHistogramData(long, SecurityMessage, bool, string, CancellationToken) : ValueTask

Returns data histogram of specified contract.

requestId
An identifier for the request.
security
Contract object for which histogram is being requested.
useRth
Use regular trading hours only.
period
Period of which data is being requested, e.g. "3 days".
cancellationToken
CancellationToken
RequestHistoricalNews(long, int?, string, DateTime, DateTime, long, Tuple<string, string>[], CancellationToken) : ValueTask

Requests historical news headlines.

requestId
contractId
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).
tags
Reserved for internal use. Should be defined as empty.
cancellationToken
CancellationToken
RequestHistoricalTicks(MarketDataMessage, bool, bool, Tuple<string, string>[], CancellationToken) : ValueTask

Requests historical Time&Sales data for an instrument.

message
useRth
Data from regular trading hours, or all available hours.
ignoreSize
miscOptions
Should be defined as empty, reserved for internal use.
cancellationToken
CancellationToken
RequestIds(int, CancellationToken) : ValueTask

Returns one next valid Id.

numberOfIds
Has No Effect.
cancellationToken
CancellationToken
RequestMarketDataType(CancellationToken) : ValueTask

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.

RequestMarketDepthExchanges(CancellationToken) : ValueTask

Requests venues for which market data is returned to updateMktDepthL2 (those with market makers).

RequestMarketRule(int, CancellationToken) : ValueTask

Requests details about a given market rule. The market rule for an instrument on a particular exchange provides details about how the minimum price increment changes with price. A 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.

RequestMatchingSymbols(long, string, CancellationToken) : ValueTask

Requests matching symbols (implements 'google-like' suggestions as user starts typing symbol or contract name).

requestId
pattern
User typed string pattern.
cancellationToken
CancellationToken
RequestMyTrades(long, MyTradeFilter, CancellationToken) : ValueTask

When this method is called, the execution reports that meet the filter criteria are downloaded to the client via the execDetails() method.

requestId
filter
the filter criteria used to determine which execution reports are returned.
cancellationToken
CancellationToken
RequestNewsArticle(long, string, string, Tuple<string, string>[], CancellationToken) : ValueTask

Requests news article body given articleId.

requestId
Id of the request.
providerCode
Short code indicating news provider, e.g. FLY.
articleId
Id of the specific article.
tags
Reserved for internal use. Should be defined as empty.
cancellationToken
CancellationToken
RequestNewsProviders(CancellationToken) : ValueTask

Requests news providers which the user has subscribed to.

RequestOpenOrders(CancellationToken) : ValueTask

Call this method to request the open orders that were placed from this client. Each open order will be fed back through the openOrder() and orderStatus() functions on the EWrapper. The client with a clientId of "0" will also receive the TWS-owned open orders. These orders will be associated with the client and a new orderId will be generated. This association will persist over multiple API and TWS sessions.

RequestPortfolios(CancellationToken) : ValueTask

Call this method to request the list of managed accounts. The list will be returned by the managedAccounts() function on the EWrapper. This request can only be made when connected to a Financial Advisor (FA) account.

RequestScannerParameters(CancellationToken) : ValueTask

Call the reqScannerParameters() method to receive an XML document that describes the valid parameters that a scanner subscription can have.

RequestSecurityDefinitionOptionParams(long, string, string, SecurityTypes?, int?, CancellationToken) : ValueTask

Requests security definition option parameters for viewing a contract's option chain.

requestId
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.
underlyingContractId
The contract ID of the underlying security.
cancellationToken
CancellationToken
RequestSecurityInfo(SecurityLookupMessage, CancellationToken) : ValueTask

Call this function to download all details for a particular underlying. the contract details will be received via the contractDetails() function on the EWrapper.

criteria
summary description of the contract being looked up.
cancellationToken
CancellationToken
RequestSmartComponents(long, string, CancellationToken) : ValueTask

Returns the mapping of single letter codes to exchange names given the mapping identifier.

requestId
bboExchange
cancellationToken
CancellationToken
RequestSoftDollarTiers(long, CancellationToken) : ValueTask

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

RequestTickByTickData(long, SecurityMessage, Level1Fields, int, bool, CancellationToken) : ValueTask

Requests tick-by-tick data.

requestId
unique identifier of the request.
security
the contract for which tick-by-tick data is requested.
tickType
tick-by-tick data type: "Last", "AllLast", "BidAsk" or "MidPoint".
numberOfTicks
Number of ticks.
ignoreSize
Ignore size.
cancellationToken
CancellationToken
RequestWshEventData(MarketDataMessage, CancellationToken) : ValueTask

Requests event data from the WSH calendar.

RequestWshMetaData(MarketDataMessage, CancellationToken) : ValueTask

Requests metadata from the WSH calendar.

Save(SettingsStorage)

Save settings.

storage
Settings storage.
SendInMessageAsync(Message, CancellationToken) : ValueTask

Processes a generic message asynchronously.

message
The message to process.
cancellationToken
CancellationToken
SetServerLogLevel(CancellationToken) : ValueTask

Changes the TWS/GW log level. The default is Error.

SubscribeCalculateImpliedVolatility(OptionCalcMarketDataMessage, Tuple<string, string>[], CancellationToken) : ValueTask

To subscribe for receiving of the implied volatility for the specified instrument.

message
tags
Reserved for future use, must be blank.
cancellationToken
CancellationToken
SubscribeCalculateOptionPrice(OptionCalcMarketDataMessage, Tuple<string, string>[], CancellationToken) : ValueTask

To subscribe for Greeks getting for the specified instrument.

message
Security.
tags
Reserved for future use, must be blank.
cancellationToken
CancellationToken
SubscribeHistoricalCandles(MarketDataMessage, TimeSpan, Level1Fields, bool, Tuple<string, string>[], CancellationToken) : ValueTask

To subscribe for instrument historical values getting at specified intervals.

message
The message about subscription or unsubscription for market data.
timeFrame
field
The market data field. Following values are supported: Trades.Bid.Ask.Midpoint.BidAsk.ImpliedVolatility.HistoricalVolatility..
useRth
To get data only by the trading time. By default the trading time is used.
tags
cancellationToken
CancellationToken
SubscribeMarketData(MarketDataMessage, IEnumerable<Level1Fields>, bool, bool, IEnumerable<Tuple<string, string>>, CancellationToken) : ValueTask

Call this method to request market data. The market data will be returned by the tickPrice, tickSize, tickOptionComputation(), tickGeneric(), tickString() and tickEFP() methods.

message
this structure contains a description of the contract for which market data is being requested.
genericFields
comma delimited list of generic tick types. Tick types can be found here: (new Generic Tick Types page).
snapshot
Allows client to request snapshot market data.
regulatorySnaphsot
Regulatory snapshot requests NBBO snapshots for users which have "US Securities Snapshot Bundle" subscription but not corresponding Network A, B, or C subscription necessary for streaming.
mktDataOptions
Market Data Off - used in conjunction with RTVolume Generic tick type causes only volume data to be sent.
cancellationToken
CancellationToken
SubscribeMarketDepth(MarketDataMessage, bool, Tuple<string, string>[], CancellationToken) : ValueTask

Call this method to request market depth for a specific contract. The market depth will be returned by the updateMktDepth() and updateMktDepthL2() methods.

message
this structure contains a description of the contract for which market depth data is being requested.
isSmartDepth
Flag indicates that this is smart depth request.
tags
cancellationToken
CancellationToken
SubscribeNewsBulletins(bool, CancellationToken) : ValueTask

Call this method to start receiving news bulletins. Each bulletin will be returned by the updateNewsBulletin() method.

allMessages
if set to , returns all the existing bulletins for the current day and any new ones. IF set to , will only return new bulletins.
cancellationToken
CancellationToken
SubscribePnL(long, string, string, CancellationToken) : ValueTask

Creates subscription for real time daily PnL and unrealized PnL updates.

requestId
account
Account for which to receive PnL updates.
modelCode
Specify to request PnL updates for a specific model.
cancellationToken
CancellationToken
SubscribePnLSingle(long, string, string, long, CancellationToken) : ValueTask

Requests real time updates for daily PnL of individual positions.

requestId
account
Account for which to receive PnL updates.
modelCode
Specify to request PnL updates for a specific model.
contractId
Contract ID (conId) of contract to receive daily PnL updates for.
cancellationToken
CancellationToken
SubscribePortfolio(string, bool, CancellationToken) : ValueTask

Call this function to start getting account values, portfolio, and last update time information.

isSubscribe
If set to , the client will start receiving account and portfolio updates. If set to , the client will stop receiving this information.
portfolioName
the account code for which to receive account and portfolio updates.
cancellationToken
CancellationToken
SubscribePositionMulti(long, string, string, CancellationToken) : ValueTask

Requests positions for account and/or model.

requestId
Request's identifier.
account
If an account Id is provided, only the account's positions belonging to the specified model will be delivered.
modelCode
The code of the model's positions we are interested in.
cancellationToken
CancellationToken
SubscribePotfrolioMulti(long, string, string, bool, CancellationToken) : ValueTask

Requests account updates for account and/or model.

requestId
Identifier to label the request.
account
Account values can be requested for a particular account.
modelCode
Values can also be requested for a model.
ledgerAndNlv
Returns light-weight request; only currency positions as opposed to account values and currency positions.
cancellationToken
CancellationToken
SubscribeRealTimeCandles(MarketDataMessage, Level1Fields, bool, Tuple<string, string>[], CancellationToken) : ValueTask

To subscribe for real-time candles receiving.

message
field
Market data fields upon which candles will be created. The following values are supported: Trades.Bid.Ask.Midpoint..
useRth
To create candles only by the trading time. By default the trading time is used.
tags
cancellationToken
CancellationToken
SubscribeScanner(ScannerMarketDataMessage, Tuple<string, string>[], Tuple<string, string>[], CancellationToken) : ValueTask

To start the instrument scanner based on specified parameters.

message
Instrument scanner filter settings.
tags
filterOptions
cancellationToken
CancellationToken
SubscribeToGroupEvents(long, int, CancellationToken) : ValueTask

Integrates API client and TWS window grouping.

requestId
The Id chosen for this subscription request.
groupId
The display group for integration.
cancellationToken
CancellationToken
ToString() : string

Преобразовать к строковому представлению.

戻り値: Строковое представление.

UnSubscribeCalculateImpliedVolatility(long, CancellationToken) : ValueTask

To stop subscription for receiving of the implied volatility for the specified instrument, created earlier via CancellationToken).

requestId
cancellationToken
CancellationToken
UnSubscribeCalculateOptionPrice(long, CancellationToken) : ValueTask

To stop subscription for receiving of the Greeks for the specified instrument, created earlier via CancellationToken).

requestId
cancellationToken
CancellationToken
UnSubscribeFromGroupEvents(long, CancellationToken) : ValueTask

Cancels a TWS Window Group subscription.

requestId
cancellationToken
CancellationToken
UnSubscribeMarketData(long, CancellationToken) : ValueTask

After calling this method, market data for the specified Id will stop flowing.

UnSubscribeMarketDepth(long, bool, CancellationToken) : ValueTask

After calling this method, market depth data for the specified Id will stop flowing.

UnSubscribeNewsBulletins(CancellationToken) : ValueTask

Call this method to stop receiving news bulletins.

UnSubscribePnL(long, CancellationToken) : ValueTask

Cancels subscription for real time updated daily PnL.

requestId
cancellationToken
CancellationToken
UnSubscribePnLSingle(long, CancellationToken) : ValueTask

Cancels real time subscription for a positions daily PnL information.

requestId
cancellationToken
CancellationToken
UnSubscribePositionMulti(long, CancellationToken) : ValueTask

Cancels positions request for account and/or model.

requestId
The identifier of the request to be canceled.
cancellationToken
CancellationToken
UnSubscribePotfrolioMulti(long, CancellationToken) : ValueTask

Cancels account updates request for account and/or model.

requestId
cancellationToken
CancellationToken
UnSubscribeRealTimeCandles(long, CancellationToken) : ValueTask

To stop the candles receiving subscription, previously created by CancellationToken).

requestId
cancellationToken
CancellationToken
UnSubscribeScanner(long, CancellationToken) : ValueTask

To stop the instrument scanner previously started via CancellationToken).

UpdateDisplayGroup(long, string, CancellationToken) : ValueTask

Updates the contract displayed in a TWS Window Group.

requestId
The ID chosen for this request.
contractInfo
Is an encoded value designating a unique IB contract. Possible values include: none = empty selection contractID@exchange - any non-combination contract.Examples 8314@SMART for IBM SMART; 8314@ARCA for IBM ARCA combo = if any combo is selected
cancellationToken
CancellationToken
VerifyAndAuthMessage(string, string, CancellationToken) : ValueTask

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.

VerifyVerifyAndAuthRequest(string, string, string, CancellationToken) : ValueTask

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.

フィールド

DefaultAddress : EndPoint

Address by default.

DefaultGatewayAddress : EndPoint

Address by default.