tapy icon indicating copy to clipboard operation
tapy copied to clipboard

Alligator indicator does not work

Open ErnestPython opened this issue 3 years ago • 0 comments

Below is my code: Other indicators are working except the alligator indicator. The error message is at the bottom. Thanks

import yfinance as yf import vectorbt as vbt import pandas as pd import datetime as dt from tapy import Indicators df = yf.download('AAPL',dt.datetime.today()-dt.timedelta(3650),dt.datetime.today()) print(df)

i= Indicators(df) i.atr(period=14, column_name='atr') i.bears_power(period=13, column_name='bears_power') i.alligator(period_jaws=13, period_teeth=8, period_lips=5, shift_jaws=8, shift_teeth=5, shift_lips=3, column_name_jaws='alligator_jaw', column_name_teeth='alligator_teeth', column_name_lips='alligator_lips')

df = i.df

print(df)

I have following error:


TypeError Traceback (most recent call last) in 10 i.atr(period=14, column_name='atr') 11 i.bears_power(period=13, column_name='bears_power') ---> 12 i.alligator(period_jaws=13, period_teeth=8, period_lips=5, shift_jaws=8, shift_teeth=5, shift_lips=3, column_name_jaws='alligator_jaw', column_name_teeth='alligator_teeth', column_name_lips='alligator_lips') 13 # i.sma() 14 df = i.df

1 frames /usr/local/lib/python3.7/dist-packages/tapy/utils.py in calculate_smma(df, period, column_name, apply_to) 33 df_tmp.at[period, column_name] = first_val 34 for index, row in df_tmp.iterrows(): ---> 35 if index > period: 36 smma_val = (df_tmp.at[index - 1, column_name] * 37 (period - 1) + row[apply_to]) / period

TypeError: '>' not supported between instances of 'Timestamp' and 'int'

ErnestPython avatar Sep 25 '22 16:09 ErnestPython