TWS protocol coverage

Last reviewed: 2026-05-25 13:40 CEST

pkg/ibkr is a clean-room Go implementation of the TWS wire protocol. It is not a full replacement for every TWS API method; it covers the read-side calls that the ibkr binary, daemon, CLI, and MCP server need.

Order-writing methods exist only for wire-format completeness and downstream forks. Default builds return pkg/ibkr.ErrTradingDisabled before any order write reaches the socket; intentionally order-capable forks must rebuild with -tags trading. The shipped daemon, CLI, MCP server, and Claude plugin expose no order interface.

CapabilityWire opcodesLibrary entry pointStatus
Account summaryreqAccountSummary (62), accountSummary (63), acctValue (6)Connector.RequestAccountSummary, GetAccountSummaryready
Positions + portfolioreqPositions (61), position (61), portfolioValue (7), $LEDGER:ALLConnector.GetCachedPositionsready
Snapshot quotereqMktData (1) snapshot=true, tickPrice (1), tickSnapshotEnd (57)Connector.FetchMarketSnapshotready
Streaming quotereqMktData (1) snapshot=false, tickPrice / tickSize / tickGeneric / tickStringConnector.SubscribeMarketData, GetMarketDataready
Generic-tick setgen-ticks 100, 101, 104, 106, 165 (option vol, OI, HV, IV, misc stats including range / average volume)populated into MarketData automaticallyready
Contract resolutionreqContractData (9), contractData (10)Connector.FetchContractDetailsready
Option chainsreqSecDefOptParams (78), tickOptionComputation (21)Connector.FetchOptionExpiries, FetchOptionExpiryStrikes, GetOptionGreeks, GetOptionIVready
Daily historical barsreqHistoricalData (20), historicalData (17)Connector.FetchHistoricalDailyBarsready
Market scannerreqScannerSubscription (22), reqScannerParameters (24)Connector.RunScannerSubscription, RunScannerParametersready
Market-data type switchreqMarketDataType (59), marketDataType (58)Connector.SetMarketDataTypeready
Order placement / cancelplaceOrder (3), cancelOrder (4)Connector.SubmitOrder, CancelOrderdisabled by default (ErrTradingDisabled); -tags trading only
Real-time barsreqRealTimeBars (50)-not implemented
Market depth (L2)reqMktDepth (10), reqMktDepthL2 (13)-not implemented
Fundamental datareqFundamentalData (52)-not implemented
News bulletinsreqNewsBulletins (12)-not implemented
Financial Advisor (FA)reqFA (18)-not implemented
IV / option-price calculatorsreqCalcImpliedVolatility (54), reqCalcOptionPrice (55)-not implemented

Tested against IB Gateway server versions 100 through 203. Handshake auto-negotiates the highest protocol version the gateway and library agree on.