Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "meatpy"
version = "0.2.7"
version = "0.2.8"
description = "Read and process limit order book data"
authors = [
{ name = "Vincent Grégoire", email = "vincent.gregoire@hec.ca" },
Expand Down
2 changes: 1 addition & 1 deletion src/meatpy/market_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def before_lob_update(self, new_timestamp: Timestamp) -> None:
new_timestamp: The new timestamp for the upcoming update
"""
for x in self.handlers:
x.before_lob_update(self.current_lob, new_timestamp)
x.before_lob_update(self, new_timestamp)

def message_event(self, timestamp: Timestamp, message: MarketMessage) -> None:
"""Notify handlers of a raw message event.
Expand Down
16 changes: 12 additions & 4 deletions tests/test_market_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ def setup_method(self):
def test_before_lob_update(self):
"""Test before_lob_update method."""
self.processor.before_lob_update(self.timestamp)
self.handler.before_lob_update.assert_called_once_with(self.lob, self.timestamp)
self.handler.before_lob_update.assert_called_once_with(
self.processor, self.timestamp
)

def test_before_lob_update_with_no_lob(self):
"""Test before_lob_update method with no LOB."""
self.processor.current_lob = None
self.processor.before_lob_update(self.timestamp)
self.handler.before_lob_update.assert_called_once_with(None, self.timestamp)
self.handler.before_lob_update.assert_called_once_with(
self.processor, self.timestamp
)

def test_message_event(self):
"""Test message_event method."""
Expand Down Expand Up @@ -224,12 +228,16 @@ def test_pre_lob_event(self):
"""Test pre_lob_event method."""
self.processor.pre_lob_event(self.timestamp)
# This method should call before_lob_update on handlers
self.handler.before_lob_update.assert_called_once_with(self.lob, self.timestamp)
self.handler.before_lob_update.assert_called_once_with(
self.processor, self.timestamp
)

def test_pre_lob_event_with_new_snapshot(self):
"""Test pre_lob_event method with new snapshot flag."""
self.processor.pre_lob_event(self.timestamp, new_snapshot=True)
self.handler.before_lob_update.assert_called_once_with(self.lob, self.timestamp)
self.handler.before_lob_update.assert_called_once_with(
self.processor, self.timestamp
)


class TestMarketProcessorCleanup:
Expand Down
Loading