-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi,
Please help with the following:
This is my code, so far.
ticker = input("Enter TICKER SYMBOL :")
for index,value in enumerate(ticker):
df = pdr.get_data_yahoo(value, '2021-07-01', '2022-12-31')
df.drop(['Open','High','Low','Close','Volume'],axis=1,inplace=True)
df = df.iloc[1:]
ticker_min = df['Adj Close'].min(axis=0)
ticker_max = df['Adj Close'].max(axis=0)
delta = ticker_min - ticker_max
min_index = df.idxmin()
# print('index =',type(df.index))
max_index = df.idxmax()
print('deltaPrice =',round(delta,2))
if delta < 0.0:
cond = True
print('cond is TRUE')
else:
cond = False
print('cond is FALSE')
My goal is: to be able to subtract the max_index from the min_index => deltaDates = max_inde - min_index
and then use the if statement like:
IF deltaDates > 0:
cond = True
print('cond is TRUE')
else:
cond = False
print('cond is FALSE')
Since I'm getting an error message, I thought maybe I can use UNIX time but I don't know how to convert it.
Your help is very much appreciated.
Daniel Kramer