trading.execution.engine.events.event_bus
trading.execution.engine.events.event_bus
EventBus
EventBus()
Allows for methods to subscribe whenever a specific event is published.
Initializes EventBus with empty subscriptions.
Source code in src\contango\trading\execution\engine\events\event_bus.py
30 31 32 33 34 35 | |
publish
publish(event: object) -> None
Publishes an event to all handlers registered for its type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
object
|
The underlying event to publish. |
required |
Source code in src\contango\trading\execution\engine\events\event_bus.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
subscribe
subscribe(event_type: type, handler: _handler_type, priority: int) -> None
Subscribes a handler to an event type. Higher priority handlers execute first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_type
|
type
|
The type for the event to be subscribed to. |
required |
handler
|
_handler_type
|
The method that recieves the event. |
required |
priority
|
int
|
The priority (highest first) for the subscription. |
required |
Source code in src\contango\trading\execution\engine\events\event_bus.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |