def test_imbalance_dollar_bars_add_features(self):
        """
        Tests the additional features functionality with dollar imbalance bars.
        """

        # Arrange
        exp_num_ticks_init = 1000
        num_prev_bars = 3
        high_over_low = BarFeature(
            name='high_over_low',
            function=lambda df: df['Price'].max() / df['Price'].min())
        low_over_high = BarFeature(
            name='low_over_high',
            function=lambda df: df['Price'].min() / df['Price'].max())

        # Act
        bars = ds.get_dollar_imbalance_bars(
            self.path,
            exp_num_ticks_init=exp_num_ticks_init,
            num_prev_bars=num_prev_bars,
            batch_size=1000,
            verbose=False,
            additional_features=[high_over_low, low_over_high])

        # Assert
        self.assertTrue(
            np.all(bars['high_over_low'] == bars['high'] / bars['low']))
        self.assertTrue(
            np.all(bars['low_over_high'] == bars['low'] / bars['high']))
    def test_dollar_bars_add_features(self):
        """
        Tests the additional features functionality with dollar bars.
        """

        # Arrange
        threshold = 100000
        high_over_low = BarFeature(
                        name='high_over_low',
                        function=lambda df: df['Price'].max() / df['Price'].min()
                        )
        low_over_high = BarFeature(
                        name='low_over_high',
                        function=lambda df: df['Price'].min() / df['Price'].max()
                        )

        # Act
        bars = ds.get_dollar_bars(self.path, threshold=threshold, batch_size=1000, verbose=False,
                                  additional_features=[high_over_low, low_over_high])

        # Assert
        self.assertTrue(np.all(bars['high_over_low'] == bars['high'] / bars['low']))
        self.assertTrue(np.all(bars['low_over_high'] == bars['low'] / bars['high']))