diff --git a/pandas_ta/volume/ad.py b/pandas_ta/volume/ad.py index 148f98e..ddacc55 100644 --- a/pandas_ta/volume/ad.py +++ b/pandas_ta/volume/ad.py @@ -32,7 +32,7 @@ def ad(high, low, close, volume, open_=None, offset=None, **kwargs): ad.fillna(method=kwargs['fill_method'], inplace=True) # Name and Categorize it - ad.name = f"AD" + ad.name = "AD" if open_ is None else "ADo" ad.category = 'volume' return ad diff --git a/setup.py b/setup.py index 5e024ce..63dbb36 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ long_description = "An easy to use Python 3 Pandas Extension with 80+ Technical setup( name ="pandas_ta", packages =['pandas_ta', 'pandas_ta.momentum', 'pandas_ta.overlap', 'pandas_ta.performance', 'pandas_ta.statistics', 'pandas_ta.trend', 'pandas_ta.volatility', 'pandas_ta.volume'], - version ="0.1.36b", + version ="0.1.37b", description =long_description, long_description =long_description, author ="Kevin Johnson", diff --git a/tests/test_indicator_volume.py b/tests/test_indicator_volume.py index 27b12ca..f22aad4 100644 --- a/tests/test_indicator_volume.py +++ b/tests/test_indicator_volume.py @@ -49,6 +49,21 @@ class TestVolume(TestCase): except Exception as ex: error_analysis(result, CORRELATION, ex) + def test_ad_open(self): + result = pandas_ta.ad(self.high, self.low, self.close, self.volume_, self.open) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'ADo') + + try: + expected = tal.AD(self.high, self.low, self.close, self.volume_) + pdt.assert_series_equal(result, expected, check_names=False) + except AssertionError as ae: + try: + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) + self.assertGreater(corr, CORRELATION_THRESHOLD) + except Exception as ex: + error_analysis(result, CORRELATION, ex) + def test_adosc(self): result = pandas_ta.adosc(self.high, self.low, self.close, self.volume_) self.assertIsInstance(result, Series) diff --git a/tests/test_indicator_volume_ext.py b/tests/test_indicator_volume_ext.py index bc26ab1..da7efac 100644 --- a/tests/test_indicator_volume_ext.py +++ b/tests/test_indicator_volume_ext.py @@ -10,10 +10,12 @@ class TestVolumeExtension(TestCase): @classmethod def setUpClass(cls): cls.data = sample_data + cls.open = cls.data['open'] @classmethod def tearDownClass(cls): del cls.data + del cls.open def setUp(self): pass @@ -25,6 +27,11 @@ class TestVolumeExtension(TestCase): self.assertIsInstance(self.data, DataFrame) self.assertEqual(self.data.columns[-1], 'AD') + def test_ad_open_ext(self): + self.data.ta.ad(open_=self.open, append=True) + self.assertIsInstance(self.data, DataFrame) + self.assertEqual(self.data.columns[-1], 'ADo') + def test_adosc_ext(self): self.data.ta.adosc(append=True) self.assertIsInstance(self.data, DataFrame)