Skip to main content

QX-IB Bridge Server

QuantX-IB Bridge Server

Python 3.10+ FastAPI WebSocket + HTTP License

One IB connection. Every script shares it. Zero clientId collisions.


QX-IB Bridge Server is a thin multiplexer for traders already using ib_async, ib_insync, or direct IB Gateway/TWS scripts who have hit the same scaling wall: too many strategies, too many direct broker connections, and too many clientId conflicts. It is a FastAPI + SDK wrapper around ib_async, not a reimplementation of the IB stack, so the wire protocol, order state machines, and ticker logic still come from the real ib_async.IB.

Instead of opening many separate broker API sessions, the bridge keeps one managed IB connection alive and lets the rest of your scripts share it through a local HTTP/WebSocket layer. In practice, that means one real IB connection, many strategies, and a near-drop-in migration path.

This is not a replacement for the Interactive Brokers Python ecosystem. It is an operational upgrade for people already in it.

Why it exists

Without a bridge With QuantX-IB Bridge
Every script connects directly to IB Gateway/TWS One bridge process owns the real IB connection
Every script consumes an API client slot Many scripts share a single connection
clientId collisions and contention No collisions — bridge manages the single client
Scaling means connection juggling and manual clientId discipline Scaling stays inside one shared bridge

Architecture at a glance

┌─────────────┐   ┌─────────────┐   ┌─────────────┐
│  Strategy 1 │   │  Strategy 2 │   │  Strategy N │
│  (SDK)      │   │  (SDK)      │   │  (SDK)      │
└──────┬──────┘   └──────┬──────┘   └──────┬──────┘
       │ HTTP/WS         │ HTTP/WS         │ HTTP/WS
       └─────────────────┼─────────────────┘
                         ▼
              ┌─────────────────────┐
              │  QX-IB Bridge       │
              │  FastAPI Server     │
              │  (single process)   │
              └──────────┬──────────┘
                         │ ib_async.IB
                         ▼
              ┌─────────────────────┐
              │  IB Gateway / TWS   │
              │  (1 connection)     │
              └─────────────────────┘

What ib_async does (you don't touch): wire protocol, serialization, order state machines, ticker price aggregation, event loop management.

What the bridge does: keeps one managed IB session open, exposes it over a local FastAPI + WebSocket server, and gives existing IB Python code a much cleaner way to scale.

What you keep

  • Familiar IB() / connect() / disconnect() usage
  • Familiar request patterns like reqHistoricalData(), placeOrder(), positions()
  • Your existing Python scripts and strategy layout

What changes

  • One import line: from qx_ibbridge import *
  • Your scripts point at the local bridge instead of the raw broker socket

Quick start

Install the package:

pip install qx_ibbridge

Start the IB Gateway:

  1. Download the latest IB Gateway from Interactive Brokers
  2. Install and launch IB Gateway
  3. Log in with your Interactive Brokers credentials
  4. Ensure it listens on localhost:4004 (default)

Start the bridge:

qx-server --ib-host localhost --ib-port 4004 --host 127.0.0.1 --port 4002

Default local model:

  • external IB Gateway/TWS API socket: localhost:4004
  • local QuantX bridge server: localhost:4002

Drop-in SDK workflow

The same pip install qx_ibbridge package gives you both:

  • the qx-server CLI for running the bridge server
  • the qx_ibbridge import for drop-in strategy scripts

Then change your script from:

from ib_async import *
# or
from ib_insync import *

to:

from qx_ibbridge import *

and keep the same shape:

ib = IB()
ib.connect(host="localhost", port=4002)
print(ib.managedAccounts())

The SDK defaults to the local bridge at localhost:4002.

For ib_async users, this is the intended drop-in path. For ib_insync users, the workflow is the same in spirit: keep your IB-style code, but route it through one local bridge instead of many direct broker sessions.

Use it your way

1. Python

qx-server --ib-host localhost --ib-port 4004 --host 127.0.0.1 --port 4002

2. Desktop app

QuantX IB Bridge Server Desktop App

Download the latest desktop app from GitHub Releases.

If you prefer to launch the desktop UI from Python instead of downloading the packaged app:

pip install "qx_ibbridge[desktop]"
qx-ib-bridge-server-desktop

The desktop app is optional. It is only a launcher for the same bridge server, for users who prefer clicking a UI over running qx-server. It does not bundle IB Gateway, and it does not change the underlying bridge or SDK behavior. The core product already works through pip install qx_ibbridge; the desktop app is only an add-on for server-launch convenience.

Examples

Project layout

Directory Purpose
server/ Canonical FastAPI implementation
ib_bridge_server/ Generic Python server package and CLI
qx_ibbridge/ Drop-in SDK package
qx_ib_bridge_server/ Desktop launcher

Behind this repo

QuantX Alpha Technologies

QX-IB Bridge Server is open-sourced by Alpha Technologies.

Across the broader ecosystem, the team builds investor education, quant research, and operating workflows around systematic, data-driven trading.

Acknowledgements

This project stands on the work of two open-source efforts:

  • ib_async — the actively maintained IB API library that this bridge wraps. The bridge server delegates all wire-protocol, order state machine, and ticker logic to ib_async.IB, and the SDK re-exports its contract and order types so existing scripts keep working without change.

  • ib_insync by Ewald de Wit — the original Python IB API library whose elegant synchronous-style API design this SDK is compatible with. ib_async is itself a maintained fork of ib_insync.

Disclaimer

This software is provided "as is" without warranty of any kind. It is not financial advice, a solicitation to trade, or a guarantee of profitability. You are solely responsible for any trades placed using this software. The authors and contributors are not liable for any financial losses incurred.

Notes

  • Not affiliated with Interactive Brokers
  • IB Gateway/TWS remains external and user-managed
  • This bridge solves clientId contention but does not remove IB pacing, market data, or broker-side account limits
  • Released under the Apache License 2.0; see LICENSE
  • Never commit IB credentials to this repository

See also:

Metadata

Release files for qx-ibbridge 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qx-ibbridge 1.0.0
File Size Uploaded
qx_ibbridge-1.0.0.tar.gz 41.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qx-ibbridge 1.0.0
File Interpreter ABI Platform
qx_ibbridge-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 80.5 kB

Release files / qx_ibbridge-1.0.0.tar.gz

Download URL qx_ibbridge-1.0.0.tar.gz
Size 41.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16d2aea7c19dca8d08d6f351a9c2b24b71116566a429782f583f1d02de677030
BLAKE2b-256 checksum
How to use checksums
471606c9f0ab72075ae1fbdedac0088ef682f5ae88e6ec2b6bf1f4f1736bcadb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / qx_ibbridge-1.0.0-py3-none-any.whl

Download URL qx_ibbridge-1.0.0-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc24e0c03cc01ed830fbfbe758460d9d7d1c7b9bb7df8f46b9095ba648127caa
BLAKE2b-256 checksum
How to use checksums
c6cc148015d8f8c7d74c1fc84bc7bb3226c50764584a2e00d2c596af15b7ca06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page