diff --git a/README.md b/README.md index df57606..d06f4ed 100644 --- a/README.md +++ b/README.md @@ -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? diff --git a/pandas_ta/momentum/cci.py b/pandas_ta/momentum/cci.py index adf0f67..1244032 100644 --- a/pandas_ta/momentum/cci.py +++ b/pandas_ta/momentum/cci.py @@ -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 diff --git a/setup.py b/setup.py index 79613d6..e04213b 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_indicator_momentum.py b/tests/test_indicator_momentum.py index 9206d3a..5e40564 100644 --- a/tests/test_indicator_momentum.py +++ b/tests/test_indicator_momentum.py @@ -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) diff --git a/tests/test_indicator_momentum_ext.py b/tests/test_indicator_momentum_ext.py index 9c6ef44..1eaa045 100644 --- a/tests/test_indicator_momentum_ext.py +++ b/tests/test_indicator_momentum_ext.py @@ -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)