Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported operant Timestamp and NoneType #15

Open
zyxelenator opened this issue Jul 15, 2020 · 3 comments
Open

unsupported operant Timestamp and NoneType #15

zyxelenator opened this issue Jul 15, 2020 · 3 comments

Comments

@zyxelenator
Copy link

After buy scan:
Traceback (most recent call last):
File "main.py", line 271, in
scan_stocks()
File "main.py", line 259, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "main.py", line 166, in golden_cross
if(direction == "above" and not five_year_check(stockTicker)):
File "main.py", line 138, in five_year_check
if ((pd.Timestamp("now") - pd.to_datetime(list_date)) < pd.Timedelta("5 Y")):
TypeError: unsupported operand type(s) for -: 'Timestamp' and 'NoneType'

@Jroc561
Copy link

Jroc561 commented Aug 5, 2020

I never had this error until one of the stocks on my watchlist triggered it, I then tried a couple things and couldnt get a fix for it. So I ended up removing the five year check in total.

@razo559
Copy link

razo559 commented Apr 21, 2021

I never had this error until one of the stocks on my watchlist triggered it, I then tried a couple things and couldnt get a fix for it. So I ended up removing the five year check in total.

How do you remove the 5 year check?

@Jeraz
Copy link

Jeraz commented Dec 2, 2023

I had to change pd.Timedelta("5 Y") to pd.Timedelta(365*5, unit='D') to make it work with the new Panda library. Not sure if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants