mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-09-11 12:30:30 +08:00
BUG ad indicator name type differentiaion
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user