Esempio n. 1
0
    def test_handle_quote_tick_when_not_running_does_not_send_to_on_quote_tick(
            self):
        # Arrange
        actor = MockActor()
        actor.register_base(
            trader_id=self.trader_id,
            msgbus=self.msgbus,
            cache=self.cache,
            clock=self.clock,
            logger=self.logger,
        )

        ticker = TestDataStubs.ticker()

        # Act
        actor.handle_ticker(ticker)

        # Assert
        assert actor.calls == []
        assert actor.object_storer.get_store() == []
Esempio n. 2
0
    def test_handle_ticker_when_running_sends_to_on_quote_tick(self):
        # Arrange
        actor = MockActor()
        actor.register_base(
            trader_id=self.trader_id,
            msgbus=self.msgbus,
            cache=self.cache,
            clock=self.clock,
            logger=self.logger,
        )

        actor.start()

        ticker = TestDataStubs.ticker()

        # Act
        actor.handle_ticker(ticker)

        # Assert
        assert actor.calls == ["on_start", "on_ticker"]
        assert actor.object_storer.get_store()[0] == ticker