IBKR.Net.Contracts 0.12.0

dotnet add package IBKR.Net.Contracts --version 0.12.0
                    
NuGet\Install-Package IBKR.Net.Contracts -Version 0.12.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IBKR.Net.Contracts" Version="0.12.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IBKR.Net.Contracts" Version="0.12.0" />
                    
Directory.Packages.props
<PackageReference Include="IBKR.Net.Contracts" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IBKR.Net.Contracts --version 0.12.0
                    
#r "nuget: IBKR.Net.Contracts, 0.12.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IBKR.Net.Contracts@0.12.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IBKR.Net.Contracts&version=0.12.0
                    
Install as a Cake Addin
#tool nuget:?package=IBKR.Net.Contracts&version=0.12.0
                    
Install as a Cake Tool

IBKR.Net

A .NET 10 client for the Interactive Brokers TWS / IB Gateway socket API — written from scratch, with no Interactive Brokers code inside, under the MIT license.

Early development (0.x): the API is not stable yet.

Why

IB's own API client is licensed by IB (non-commercial in older releases, GPL-3.0 from 10.50), and every .NET wrapper we know of bundles it. IBKR.Net talks to TWS / IB Gateway over its local socket itself, so an app built on it is free to choose its own license.

You still need TWS or IB Gateway running and logged in: it is the program that connects to IB's servers, and IBKR.Net connects to it on 127.0.0.1 (Gateway: 4001 live / 4002 paper).

Packages

Package Purpose
IBKR.Net.Contracts Models and options; no dependencies
IBKR.Net The client

Quick start

await using var client = await IbkrClient.ConnectAsync(
	new IbkrClientOptions { Host = "127.0.0.1", Port = 4002, ClientId = 1 }
);

var spy = (await client.GetContractDetailsAsync(
	new Contract { Symbol = "SPY", SecurityType = "STK", Exchange = "SMART", Currency = "USD" }
))[0].Contract;

await client.SetMarketDataTypeAsync(MarketDataType.Delayed);
await foreach (var tick in client.SubscribeMarketDataAsync(spy))
	Console.WriteLine($"{tick.Field}: {tick.Price} {tick.Size}");

Streams cancel their IB request when you stop reading; errors IB reports for a request throw IbkrException, informational messages arrive on client.Notice.

What it covers (0.12.0)

IbkrClient IB request
ConnectAsync, ManagedAccounts, Disconnected, Notice session, managedAccounts, errors
GetServerTimeAsync reqCurrentTime
GetContractDetailsAsync reqContractDetails
GetOptionChainParametersAsync reqSecDefOptParams
SetMarketDataTypeAsync, SubscribeMarketDataAsync reqMarketDataType, reqMktData (options: greeks from tickOptionComputation, open interest with generic tick 101)
GetMarketDataSnapshotAsync reqMktData snapshot (never the paid regulatory snapshot), until tickSnapshotEnd
GetHistoricalBarsAsync reqHistoricalData
SubscribeRealtimeBarsAsync reqRealTimeBars
GetPositionsAsync, SubscribePositionsAsync reqPositions
SubscribeAccountSummaryAsync reqAccountSummary
SubscribeAccountPnlAsync, SubscribePositionPnlAsync reqPnL, reqPnLSingle
PlaceOrderAsync, ModifyOrderAsync, CancelOrderAsync (version 178 only) placeOrder, placeOrder with the order's id, cancelOrder
GetOpenOrdersAsync reqAllOpenOrders
GetExecutionsAsync reqExecutions with commission reports
GetNewsProvidersAsync, GetHistoricalNewsAsync, GetNewsArticleAsync reqNewsProviders, reqHistoricalNews, reqNewsArticle
SubscribeNewsAsync, GetBroadTapeContractsAsync reqMktData news ticks (292), broad tape contracts
SubscribeMarketDepthAsync, GetMarketDepthExchangesAsync reqMktDepth (one exchange, Level 2, SMART depth), reqMktDepthExchanges
SubscribeTickByTickAsync reqTickByTickData (Last, AllLast, BidAsk, MidPoint; optional history first)
GetHistoricalTicksAsync reqHistoricalTicks (trades, bid / ask or midpoint, up to 1000 a request, before an end or from a start)
GetWshMetaDataAsync, GetWshEventDataAsync reqWshMetaData, reqWshEventData (Wall Street Horizon corporate events as JSON; needs IB's WSH subscription, else error 10276)

It speaks protocol version 187 (text messages), which current TWS / IB Gateway still accept.

Orders trade for real on a live account. They need a connection capped at IbkrClient.OrderProtocolVersion (178); what-if orders are not built.

Not yet: option greeks, scanners.

Building

dotnet build IBKR.Net.slnx
dotnet test                 # offline; never connects to TWS / IB Gateway
csharpier format .

Contributing

Work happens on the current advance/X.Y.Z branch; main only receives releases, and a push to main publishes the packages. See CLAUDE.md for the rules — especially the clean-room rule: never copy or translate Interactive Brokers' source code.

License

MIT. Not affiliated with or endorsed by Interactive Brokers. "Interactive Brokers", "IBKR", "TWS" and "IB Gateway" are trademarks of their owners.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IBKR.Net.Contracts:

Package Downloads
IBKR.Net

A from-scratch .NET client for the Interactive Brokers TWS / IB Gateway socket API. Contains no Interactive Brokers code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.12.0 224 10/30/2026
0.11.0 116 10/29/2026
0.10.0 113 10/28/2026
0.9.0 112 10/28/2026
0.8.0 115 10/26/2026
0.7.0 110 10/26/2026
0.6.0 106 10/26/2026
0.5.0 114 10/26/2026
0.4.0 102 10/26/2026
0.3.0 106 10/26/2026
0.2.0 105 10/25/2026
0.1.0 119 10/25/2026