IBKR SDK
A Python SDK for interacting with Interactive Brokers Web API.
Installation
From PyPI
pip install ibkr-sdk
Quick Start
from ibkr import IBKRClient
client = IBKRClient()
client.connect("username", "password")
# List accounts
accounts = client.portfolio.accounts()
# Get positions
positions = client.portfolio.positions("DU123456")
# Get open orders
orders = client.orders.list_orders()
Features
- Full API Coverage: All REST endpoints from IBKR API v2.31.0
- Pydantic Models: Type-safe request/response parsing with validation
- Cookie-based Auth: Session authentication via
/iserver/auth/status - snake_case Fields: Pythonic attribute names with camelCase alias support
Architecture
ibkr/
├── client.py # IBKRClient and API classes
├── auth.py # Session/auth handling
├── exceptions.py # Custom exceptions
├── types.py # Enums
└── models/ # Pydantic models
├── account.py
├── portfolio.py
├── orders.py
├── marketdata.py
├── contract.py
├── scanner.py
├── fa.py
└── fyi.py
API Classes
| Class | Description |
|---|---|
client.portfolio |
Account info, positions, ledger, summary |
client.orders |
Open orders, order status |
client.marketdata |
Snapshot, historical data |
client.contract |
Contract search, info |
client.scanner |
Scanner parameters, run |
client.fa |
Financial advisor endpoints |
client.fyi |
Notifications, settings |
Authentication
client = IBKRClient()
client.connect(username, password)
# Keep session alive
client.tickle()
# End session
client.disconnect()
Models
All models accept camelCase JSON (from API) and expose snake_case attributes:
from ibkr.models import AccountAttributes, IndividualPosition
# Works with API JSON
acct = AccountAttributes(**{"accountId": "DU123", "currency": "USD"})
print(acct.account_id) # "DU123"
Exceptions
| Exception | Description |
|---|---|
IBKRError |
Base exception |
IBKRAPIError |
API error response |
IBKRValidationError |
JSON/validation error |
IBKRConnectionError |
Network error |
Development
# Install dependencies
uv sync
# Run tests
uv run pytest tests/
# Lint
ruff check
Metadata
Release files for ibkr-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ibkr_sdk-0.2.0.tar.gz | 20.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ibkr_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.4 kB
Release files / ibkr_sdk-0.2.0.tar.gz
| Download URL | ibkr_sdk-0.2.0.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76a4ee553488bf0cbf498b01d428667356fbb8e12d8b5b05692da5bcbe1ecb28
|
|
BLAKE2b-256 checksum How to use checksums |
8400c8a9b5b98064df1f6810e38af8387556e4893fef4e5768830295a7adebb4
|
| 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 Jun 9, 2026.
Transparency logRelease files / ibkr_sdk-0.2.0-py3-none-any.whl
| Download URL | ibkr_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5279a1ba5be6f45b342e9e6f1446e3e87a748de2bfb1e12623d57cd00a6e07ca
|
|
BLAKE2b-256 checksum How to use checksums |
ebe73f28cd5fba330ef169e86109119870e6c615df11e47920955cc74e3a7a2e
|
| 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 Jun 9, 2026.
Transparency log