BUG ad indicator name type differentiaion

This commit is contained in:
Kevin Johnson
2019-08-01 09:28:26 -07:00
parent 939a57cbb8
commit 71e9282d8f
4 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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",
+15
View File
@@ -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)
+7
View File
@@ -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)