BUG cci now correlated with talib, fixed default value

This commit is contained in:
Kevin Johnson
2020-05-21 13:30:57 -07:00
parent 1e192820b2
commit 1cfe48545c
5 changed files with 7 additions and 7 deletions
+1
View File
@@ -45,6 +45,7 @@ All the indicators return a named Series or a DataFrame in uppercase underscore
- __Aroon & Aroon Oscillator__ (aroon)
* Fixed indicator and included oscillator in returned dataframe
- __Bollinger Bands__ (bbands)
- __Commodity Channel Index__ (cci)
- __Chande Momentum Oscillator__ (cmo)
## What is a Pandas DataFrame Extension?
+3 -4
View File
@@ -10,9 +10,8 @@ def cci(high, low, close, length=None, c=None, offset=None, **kwargs):
high = verify_series(high)
low = verify_series(low)
close = verify_series(close)
length = int(length) if length and length > 0 else 20
length = int(length) if length and length > 0 else 14
c = float(c) if c and c > 0 else 0.015
min_periods = int(kwargs['min_periods']) if 'min_periods' in kwargs and kwargs['min_periods'] is not None else length
offset = get_offset(offset)
# Calculate Result
@@ -52,7 +51,7 @@ Sources:
Calculation:
Default Inputs:
length=20, c=0.015
length=14, c=0.015
SMA = Simple Moving Average
MAD = Mean Absolute Deviation
tp = typical_price = hlc3 = (high + low + close) / 3
@@ -64,7 +63,7 @@ Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
length (int): It's period. Default: 20
length (int): It's period. Default: 14
c (float): Scaling Constant. Default: 0.015
offset (int): How many periods to offset the result. Default: 0
+1 -1
View File
@@ -6,7 +6,7 @@ long_description = "An easy to use Python 3 Pandas Extension with 100+ 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.52b",
version ="0.1.53b",
description =long_description,
long_description =long_description,
author ="Kevin Johnson",
+1 -1
View File
@@ -107,7 +107,7 @@ class TestMomentum(TestCase):
def test_cci(self):
result = pandas_ta.cci(self.high, self.low, self.close)
self.assertIsInstance(result, Series)
self.assertEqual(result.name, 'CCI_20_0.015')
self.assertEqual(result.name, 'CCI_14_0.015')
try:
expected = tal.CCI(self.high, self.low, self.close)
+1 -1
View File
@@ -51,7 +51,7 @@ class TestMomentumExtension(TestCase):
def test_cci_ext(self):
self.data.ta.cci(append=True)
self.assertIsInstance(self.data, DataFrame)
self.assertEqual(self.data.columns[-1], 'CCI_20_0.015')
self.assertEqual(self.data.columns[-1], 'CCI_14_0.015')
def test_cg_ext(self):
self.data.ta.cg(append=True)