diff --git a/pyproject.toml b/pyproject.toml index 67ae55a..0e9e8a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, diff --git a/src/meatpy/market_processor.py b/src/meatpy/market_processor.py index a923e78..05ad8ba 100644 --- a/src/meatpy/market_processor.py +++ b/src/meatpy/market_processor.py @@ -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. diff --git a/tests/test_market_processor.py b/tests/test_market_processor.py index 26f7d8b..8e2b82e 100644 --- a/tests/test_market_processor.py +++ b/tests/test_market_processor.py @@ -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.""" @@ -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: