def test_handle_quote_tick_updates_indicator(self):
        # Arrange
        indicator = SimpleMovingAverage(10, PriceType.MID)

        tick = TestDataStubs.quote_tick_5decimal(AUDUSD_SIM.id)

        # Act
        indicator.handle_quote_tick(tick)

        # Assert
        assert indicator.has_inputs
        assert indicator.value == 1.00002
Exemple #2
0
    def test_handle_quote_tick_updates_indicator(self):
        # Arrange
        indicator = SimpleMovingAverage(10, PriceType.MID)

        tick = TestStubs.quote_tick_5decimal(AUDUSD_SIM.symbol)

        # Act
        indicator.handle_quote_tick(tick)

        # Assert
        self.assertTrue(indicator.has_inputs)
        self.assertEqual(1.00002, indicator.value)
Exemple #3
0
    def test_handle_quote_tick_updates_with_expected_value(self):
        # Arrange
        sma_for_ticks1 = SimpleMovingAverage(10, PriceType.ASK)
        sma_for_ticks2 = SimpleMovingAverage(10, PriceType.MID)
        sma_for_ticks3 = SimpleMovingAverage(10, PriceType.BID)

        tick = TestStubs.quote_tick_5decimal(AUDUSD_FXCM)

        # Act
        sma_for_ticks1.handle_quote_tick(tick)
        sma_for_ticks2.handle_quote_tick(tick)
        sma_for_ticks3.handle_quote_tick(tick)

        # Assert
        self.assertTrue(sma_for_ticks1.has_inputs)
        self.assertTrue(sma_for_ticks2.has_inputs)
        self.assertTrue(sma_for_ticks3.has_inputs)
        self.assertEqual(1.00003, sma_for_ticks1.value)
        self.assertEqual(1.00002, sma_for_ticks2.value)
        self.assertEqual(1.00001, sma_for_ticks3.value)
    def test_handle_quote_tick_updates_with_expected_value(self):
        # Arrange
        sma_for_ticks1 = SimpleMovingAverage(10, PriceType.ASK)
        sma_for_ticks2 = SimpleMovingAverage(10, PriceType.MID)
        sma_for_ticks3 = SimpleMovingAverage(10, PriceType.BID)

        tick = TestDataStubs.quote_tick_5decimal(AUDUSD_SIM.id)

        # Act
        sma_for_ticks1.handle_quote_tick(tick)
        sma_for_ticks2.handle_quote_tick(tick)
        sma_for_ticks3.handle_quote_tick(tick)

        # Assert
        assert sma_for_ticks1.has_inputs
        assert sma_for_ticks2.has_inputs
        assert sma_for_ticks3.has_inputs
        assert sma_for_ticks1.value == 1.00003
        assert sma_for_ticks2.value == 1.00002
        assert sma_for_ticks3.value == 1.00001