diff --git a/talib/_abstract.pxi b/talib/_abstract.pxi index 1f1eb407e..d8adae014 100644 --- a/talib/_abstract.pxi +++ b/talib/_abstract.pxi @@ -619,6 +619,9 @@ def __get_flags(int flag, dict flags_lookup_dict): TA_FUNC_FLAGS = { 1: 'A period of 1 performs no smoothing', + 2: 'An output is display-shifted', + 4: 'Uses a transcendental math function', + 8: 'Input must be positive', 16777216: 'Output scale same as input', 33554432: 'Function has a streaming API', 67108864: 'Output is over volume', @@ -647,13 +650,15 @@ TA_OUTPUT_FLAGS = { 16: 'Histogram', 32: 'Pattern (Bool)', 64: 'Bull/Bear Pattern (Bearish < 0, Neutral = 0, Bullish > 0)', - 128: 'Strength Pattern ([-200..-100] = Bearish, [-100..0] = Getting Bearish, 0 = Neutral, [0..100] = Getting Bullish, [100-200] = Bullish)', + 128: 'Confirmation Pattern (+/-200 = this bar confirms an earlier pattern)', 256: 'Output can be positive', 512: 'Output can be negative', 1024: 'Output can be zero', 2048: 'Values represent an upper limit', 4096: 'Values represent a lower limit', 8192: 'Output is optional (nullable)', + 16384: 'Output is display-shifted', + 32768: 'Weak Pattern (+/-80 = a weaker form of the pattern)', } def _ta_getFuncInfo(char *function_name): diff --git a/tests/test_abstract.py b/tests/test_abstract.py index e8b281b15..944aabebb 100644 --- a/tests/test_abstract.py +++ b/tests/test_abstract.py @@ -174,6 +174,40 @@ def test_info(): assert expected == abstract.Function('BBANDS').info +_TA_VERSION = tuple(int(p) for p in talib.__ta_version__.split()[0].split(b'.')) + + +@pytest.mark.skipif(_TA_VERSION < (0, 8, 2), + reason='these flags are newer than TA-Lib C 0.8.1') +def test_flags_newer_than_0_8_1(): + pattern = ['Line', + 'Bull/Bear Pattern (Bearish < 0, Neutral = 0, Bullish > 0)', + 'Output can be positive', + 'Output can be negative', + 'Output can be zero'] + assert abstract.Function('CDLENGULFING').output_flags == OrderedDict([ + ('integer', pattern + ['Weak Pattern (+/-80 = a weaker form of the pattern)']), + ]) + assert abstract.Function('CDLHIKKAKE').output_flags == OrderedDict([ + ('integer', ['Line', + 'Bull/Bear Pattern (Bearish < 0, Neutral = 0, Bullish > 0)', + 'Confirmation Pattern (+/-200 = this bar confirms an earlier pattern)', + 'Output can be positive', + 'Output can be negative', + 'Output can be zero']), + ]) + + dpo = abstract.Function('DPO') + assert 'An output is display-shifted' in dpo.function_flags + assert dpo.output_flags == OrderedDict([ + ('real', ['Line', 'Output is display-shifted']), + ]) + + ln_flags = abstract.Function('LN').function_flags + assert 'Uses a transcendental math function' in ln_flags + assert 'Input must be positive' in ln_flags + + def test_input_names(): expected = OrderedDict([('price', 'close')]) assert expected == abstract.Function('MAMA').input_names