Skip to content

Emit an event right before the event dispatch loop starts#58

Merged
gbeced merged 5 commits into
developfrom
feature/dispatch-loop-started-event
Jun 3, 2026
Merged

Emit an event right before the event dispatch loop starts#58
gbeced merged 5 commits into
developfrom
feature/dispatch-loop-started-event

Conversation

@gbeced

@gbeced gbeced commented Jun 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “loop started” hook to Basana’s dispatchers so consumers can run async initialization logic exactly once right before the dispatcher begins its dispatch loop (useful for pre-loop setup that must happen after run() begins, but before any events are processed).

Changes:

  • Introduces subscribe_event_loop_started() on EventDispatcher and notifies registered handlers at the start of the dispatch loop.
  • Wires the notification into both RealtimeDispatcher and BacktestingDispatcher dispatch loops.
  • Adds/updates tests and documentation (CHANGELOG + repo Copilot instructions) to cover and describe the new behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
basana/core/dispatcher/base.py Adds loop-started handler type, subscription API, and notification helper.
basana/core/dispatcher/realtime.py Calls the loop-start notification before entering the realtime dispatch loop.
basana/core/dispatcher/backtesting.py Sets initial backtesting “now” (from next event) and calls the loop-start notification before processing.
basana/core/dispatcher/__init__.py Exports LoopStartedHandler in the dispatcher package API surface.
tests/test_realtime_dispatcher.py Adds coverage ensuring realtime loop-start handlers are invoked once.
tests/test_backtesting_dispatcher.py Adds coverage for backtesting loop-start invocation and duplicate subscription behavior.
CHANGELOG.md Documents the new subscribe_event_loop_started feature.
.github/copilot-instructions.md Updates repository workflow/testing guidance and adds testing conventions.

Comment thread basana/core/dispatcher/base.py
Comment thread tests/test_backtesting_dispatcher.py
Comment thread tests/test_backtesting_dispatcher.py
gbeced and others added 3 commits June 3, 2026 09:32
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Will take it into account for your his performance review.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gbeced
gbeced merged commit 6c3f9ad into develop Jun 3, 2026
30 checks passed
@gbeced
gbeced deleted the feature/dispatch-loop-started-event branch June 3, 2026 15:29
@gbeced gbeced self-assigned this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants