示例#1
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in BatterySeries.create():
            self.snr.update(point + 0.00010, point)
            output.append(self.snr.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#2
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in BatterySeries.create():
            self.atr.update_raw(point, sys.float_info.epsilon, sys.float_info.epsilon)
            output.append(self.atr.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#3
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in BatterySeries.create():
            self.vwap.update(point, 10000, UNIX_EPOCH)
            output.append(self.vwap.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#4
0
    def test_with_battery_signal(self):
        # Arrange
        self.kp = KeltnerPosition(10, 2.5, atr_floor=0.00010)
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in BatterySeries.create():
            self.kp.update(point, sys.float_info.epsilon,
                           sys.float_info.epsilon)
            output.append(self.kp.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#5
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output1 = []
        output2 = []
        output3 = []

        # Act
        for point in BatterySeries.create():
            self.kc.update_raw(point, sys.float_info.epsilon, sys.float_info.epsilon)
            output1.append(self.kc.value_upper_band)
            output2.append(self.kc.value_middle_band)
            output3.append(self.kc.value_lower_band)

        # Assert
        self.assertEqual(len(battery_signal), len(output1))
        self.assertEqual(len(battery_signal), len(output2))
        self.assertEqual(len(battery_signal), len(output3))
示例#6
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in battery_signal:
            self.rsi.update_raw(point)
            output.append(self.rsi.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#7
0
    def test_reset_successfully_returns_indicator_to_fresh_state(self):
        # Arrange
        battery_signal = BatterySeries.create()

        for point in battery_signal:
            self.swings.update(point, point, UNIX_EPOCH)

        # Act
        self.swings.reset()

        # Assert
        self.assertEqual(0, self.swings.value)  # No assertion errors.
示例#8
0
    def test_with_battery_signal(self):
        # Arrange
        tt = time.time()
        battery_signal = BatterySeries.create(length=1000000)
        output = []

        # Act
        for point in battery_signal:
            self.sma.update_raw(point)
            output.append(self.sma.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
        print(self.sma.value)
        print(time.time() - tt)
示例#9
0
    def test_with_battery_signal_raises_no_exceptions(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output = []

        # Act
        for point in battery_signal:
            try:
                self.fc.update(point, point, point, point)
            except Exception as ex:
                print(ex)
            output.append(self.fc.value)

        # Assert
        self.assertEqual(len(battery_signal), len(output))
示例#10
0
    def test_with_battery_signal(self):
        # Arrange
        battery_signal = BatterySeries.create()
        output1 = []
        output2 = []

        # Act
        for point in battery_signal:
            self.ht.update(point)
            output1.append(self.ht.value_in_phase)
            output2.append(self.ht.value_quad)

        # Assert
        self.assertEqual(len(battery_signal), len(output1))
        self.assertEqual(len(battery_signal), len(output2))