contango.trading.execution.engine.events.event_bus
contango.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
14 15 16 17 18 19 | |
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
49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
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
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |