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

Converting to UNIX timestamp (not sure that's the solution) #1

Open
kramerdanny opened this issue Apr 27, 2022 · 0 comments
Open

Converting to UNIX timestamp (not sure that's the solution) #1

kramerdanny opened this issue Apr 27, 2022 · 0 comments

Comments

@kramerdanny
Copy link

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

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

1 participant