IBKR Event Daemon
A flexible event-driven daemon for Interactive Brokers TWS/Gateway that handles real-time market data and trading events.
Features
- Event-driven architecture for handling IBKR market data and trading events
- Simple handler pattern for implementing custom event processors
- Built-in support for real-time bar data
- Configurable via environment variables or command-line options
- Comprehensive logging with rotation and retention policies
- Supervisor integration for process management
Installation
pip install ibkr-event-daemon
Quick Start
- Configure your environment variables in
.env:
IB_EVENT_DAEMON_HOST=127.0.0.1
IB_EVENT_DAEMON_PORT=7497
IB_EVENT_DAEMON_CLIENTID=1
IB_EVENT_DAEMON_TIMEOUT=4
IB_EVENT_DAEMON_READONLY=False
IB_EVENT_DAEMON_ACCOUNT=
IB_EVENT_DAEMON_RAISESYNCERRORS=False
IB_EVENT_DAEMON_SETUP_PATHS="./example"
- Start the daemon:
ibkr-daemon start
Or with custom logging:
ibkr-daemon start --log-level DEBUG --log-file logs/daemon.log
Creating Custom Handlers
Handlers are Python modules that process IBKR events. Place your handlers in the directory specified by IB_EVENT_DAEMON_SETUP_PATHS.
Example handler for real-time bar data (example/realtimebar_example.py):
from ib_async import IB, Forex
from ibkr_event_daemon.core import LoggerType
def setup(ib: IB, logger: LoggerType) -> None:
usd_jpy = Forex('USDJPY')
bars = ib.reqRealTimeBars(
usd_jpy,
barSize=5,
whatToShow="MIDPOINT",
useRTH=True
)
bars.updateEvent += onBarUpdate
def onBarUpdate(bars, hasNewBar):
if hasNewBar:
print(bars[-1])
Configuration
Configuration can be managed through:
- Environment variables (
.envfile) - Command-line options
- Configuration commands
Show current configuration:
ibkr-daemon config show
Initialize default configuration:
ibkr-daemon config init
Process Management
The project includes a supervisord.conf for process management. This allows for:
- Automatic restart on failure
- Process monitoring
- Log management
Development
To run in development mode:
- Clone the repository
- Install dependencies:
pip install -e .
- Create and configure
.envfile:
ibkr-daemon config init
- Start the daemon:
python -m ibkr_event_daemon start
License
Metadata
Release files for ibkr_event_daemon 0.3.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 | Provenance | Actions |
|---|---|---|---|---|
| ibkr_event_daemon-0.3.0.tar.gz | 55.0 kB | Without provenance | Details for ibkr_event_daemon-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ibkr_event_daemon-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for ibkr_event_daemon-0.3.0-py3-none-any.whl |
Total release size: 65.8 kB
Release files / ibkr_event_daemon-0.3.0.tar.gz
| Download URL | ibkr_event_daemon-0.3.0.tar.gz |
|---|---|
| Size | 55.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e01f42e97e474260ef52112081df35523e003e2ce87d9b7abc0cfd3473badfa1
|
|
BLAKE2b-256 checksum How to use checksums |
5f433ee294e7c61c288f941ed211616f7211a92370881919173f28dc3b413425
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Release files / ibkr_event_daemon-0.3.0-py3-none-any.whl
| Download URL | ibkr_event_daemon-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc87cb25bbd3e6a1a98037e22c19d27c54d8d053b92100c319a0f247a72b8a5b
|
|
BLAKE2b-256 checksum How to use checksums |
64a42aff1513eecc71418678b41e0b0ee592e92d6952dcaed481891ed00c49d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Security for ibkr_event_daemon 0.3.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.