Beispiel #1
0
    def test_update_last_tick(self):
        tick = TickFactory()
        fr = FrameFactory()

        fr.on_new_tick(tick)

        assert fr.last_tick == tick
Beispiel #2
0
    def test_update_low_tick(self):
        fr = FrameFactory()
        fr.low_tick = TickFactory(bid=99, ask=101)

        new_low = TickFactory(bid=98, ask=100)
        fr.on_new_tick(new_low)

        assert fr.low_tick == new_low
Beispiel #3
0
    def test_update_high_tick(self):
        fr = FrameFactory()
        fr.high_tick = TickFactory(bid=99, ask=101)

        new_high = TickFactory(bid=100, ask=102)
        fr.on_new_tick(new_high)

        assert fr.high_tick == new_high
Beispiel #4
0
    def test_indicators_on_new_tick_called__indicator_none(
            self, mocker, market_open):
        epic_mock = mocker.Mock()
        epic_mock.market_open = market_open
        parent_framset = FrameSetFactory()
        indicator_mock = mocker.Mock()
        indicator_mock.ref = "my_indicator_ref"
        parent_framset.epic = epic_mock
        parent_framset.add_indicator(indicator_mock)
        fr = FrameFactory(parent_frameset=parent_framset)
        fr.indicators = {"my_indicator_ref": None}

        tick = TickFactory()
        fr.on_new_tick(tick)

        assert indicator_mock.build_value_from_frame.call_args_list == [
            call(fr, market_open),  # call on Frame Init
            call(fr, market_open),
        ]
Beispiel #5
0
    def test_nb_ticks_update(self):
        fr = FrameFactory()

        fr.on_new_tick(TickFactory())

        assert fr.nb_ticks == 2