mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-09-09 11:28:26 +08:00
BUG BBANDS default length reflecting talib default
This commit is contained in:
@@ -9,7 +9,7 @@ def bbands(close, length=None, std=None, mamode=None, offset=None, **kwargs):
|
||||
"""Indicator: Bollinger Bands (BBANDS)"""
|
||||
# Validate arguments
|
||||
close = verify_series(close)
|
||||
length = int(length) if length and length > 0 else 20
|
||||
length = int(length) if length and length > 0 else 5
|
||||
min_periods = int(kwargs['min_periods']) if 'min_periods' in kwargs and kwargs['min_periods'] is not None else length
|
||||
std = float(std) if std and std > 0 else 2.
|
||||
mamode = mamode.lower() if mamode else 'sma'
|
||||
|
||||
@@ -6,7 +6,7 @@ long_description = "An easy to use Python 3 Pandas Extension with 95+ 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.49b",
|
||||
version ="0.1.50b",
|
||||
description =long_description,
|
||||
long_description =long_description,
|
||||
author ="Kevin Johnson",
|
||||
|
||||
@@ -62,11 +62,11 @@ class TestVolatility(TestCase):
|
||||
def test_bbands(self):
|
||||
result = pandas_ta.bbands(self.close)
|
||||
self.assertIsInstance(result, DataFrame)
|
||||
self.assertEqual(result.name, 'BBANDS_20')
|
||||
self.assertEqual(result.name, 'BBANDS_5')
|
||||
|
||||
try:
|
||||
expected = tal.BBANDS(self.close)
|
||||
expecteddf = DataFrame({'BBL_20': expected[0], 'BBM_20': expected[1], 'BBU_20': expected[2]})
|
||||
expecteddf = DataFrame({'BBL_5': expected[0], 'BBM_5': expected[1], 'BBU_5': expected[2]})
|
||||
pdt.assert_frame_equal(result, expecteddf)
|
||||
except AssertionError as ae:
|
||||
try:
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestVolatilityExtension(TestCase):
|
||||
def test_bbands_ext(self):
|
||||
self.data.ta.bbands(append=True)
|
||||
self.assertIsInstance(self.data, DataFrame)
|
||||
self.assertEqual(list(self.data.columns[-3:]), ['BBL_20', 'BBM_20', 'BBU_20'])
|
||||
self.assertEqual(list(self.data.columns[-3:]), ['BBL_5', 'BBM_5', 'BBU_5'])
|
||||
|
||||
def test_donchian_ext(self):
|
||||
self.data.ta.donchian(append=True)
|
||||
|
||||
Reference in New Issue
Block a user