Skip to main content

a ibkr event project

Project description

ibevent

A library for simplifying event listening for Interactive Brokers (IBKR).

Installation

pip install ibevent

Quick Start

To get started with ibevent, follow these steps:

  1. Connect to Interactive Brokers.
  2. Create a contract for the asset you want to trade.
  3. Register event handlers to listen for market data updates.

Example

from ib_async import IB
from ibevent.events import IBEventType
from ib_async.contract import Forex

# Create IB connection
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)

# Create USD/JPY contract
usd_jpy = Forex('USDJPY')

# Register bar update handler
@ib.events.register(
    IBEventType.BAR_UPDATE,
    bind_to=ib.reqRealTimeBars(
        usd_jpy,
        barSize=5,
        whatToShow='MIDPOINT',
        useRTH=True
    )
)
def handle_bar(ib, bars, has_new_bar):
    if has_new_bar:
        print(bars[-1])

# Run until interrupted
ib.run()

Features

  • Event-driven framework for handling IB API events.
  • Support for asynchronous event handling.
  • Priority-based event handlers for multiple data streams.

IBEventType Enumeration

The IBEventType enumeration defines all supported IB API event types. Each event type corresponds to a specific event in the IB API that can be subscribed to and handled.

Attributes:

  • BAR_UPDATE: Real-time bar data update event.
  • ERROR: Error event from IB API.
  • CONNECTED: Connection established event.
  • DISCONNECTED: Connection lost event.
  • (Other attributes as needed)

Example Usage:

from ibevent.events import IBEventType

# Example of using IBEventType
event_type = IBEventType.BAR_UPDATE
print(event_type)

API Reference

For detailed API documentation, please refer to the MkDocs documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibevent-0.2.0.tar.gz (46.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibevent-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file ibevent-0.2.0.tar.gz.

File metadata

  • Download URL: ibevent-0.2.0.tar.gz
  • Upload date:
  • Size: 46.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for ibevent-0.2.0.tar.gz
Algorithm Hash digest
SHA256 785256575dd527391717e0f83491ddc4188639d5ab03621afa4fd29211d25be6
MD5 402184d29b39fd34959e9c65763c7044
BLAKE2b-256 58f88c67d8837de85d6dec685b85f3c5a7f530c6ea3f52c0032351506f5691cc

See more details on using hashes here.

File details

Details for the file ibevent-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ibevent-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for ibevent-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5e99323da4a16d6bba736f67ddbc14d49403a38e8f52de136dd75177c02127d
MD5 32547a5370892847e4351376a26bd0e0
BLAKE2b-256 1f7d367c9cf182b12047e0acd1232933e812754a717f0d1a265cd6f46793b2bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page