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

Ticket data from different timezone are not aligned (bug introduced with #1085) #1275

Closed
DE0CH opened this issue Jan 4, 2023 · 6 comments · Fixed by #1283
Closed

Ticket data from different timezone are not aligned (bug introduced with #1085) #1275

DE0CH opened this issue Jan 4, 2023 · 6 comments · Fixed by #1283

Comments

@DE0CH
Copy link
Contributor

DE0CH commented Jan 4, 2023

I am trying to find correlations between tickets in differnet timezone (one in the New York Stock exchange and the other in the London Stock Exchange). Due to changes to the timezone logic, the data in each row of yfinance.download are no longer the data of the Tickets at the same time. Using ignore_tz=False fixes this problem. This problem didn't exist with version 0.1.77 and previous. So I think by default ignore_tz should be set to False as that behaviour is consistent with the previous minor versions.

@ValueRaider
Copy link
Collaborator

But ignore_tz=True is default behaviour. Sounds like you copy-pasted from README without reading - post your code please.

@DE0CH
Copy link
Contributor Author

DE0CH commented Jan 6, 2023

I wrote my code with version 0.1.75. I upgraded my packages the other day and found out my data analysis was completely off. Using ignore_tz=False brought back the old behaviour. See below for a minimal example

import yfinance as yf

tickets = yf.download(tickers=f"^FTSE ^DJI", period='7d', interval='1m', ignore_tz=True)
for index, row in tickets.iterrows():
    a = row['Close']['^FTSE']
    b = row['Close']['^DJI']
    # a and b are not data at the same time 

tickets = yf.download(tickers=f"^FTSE ^DJI", period='7d', interval='1m', ignore_tz=False)
for index, row in tickets.iterrows():
    a = row['Close']['^FTSE']
    b = row['Close']['^DJI']
    # a and b are data at the same time

@ValueRaider
Copy link
Collaborator

I understand now, behaviour has changed since old version. Do you mind submitting a PR?

@DE0CH
Copy link
Contributor Author

DE0CH commented Jan 7, 2023

Sure. Is the PR just changing the default value to ignore_tz=False?

@ValueRaider
Copy link
Collaborator

ValueRaider commented Jan 7, 2023

Yes. I know it's trivial but I want community to be more involved in code.

Edit: update doc & README too, says default = True

@DE0CH
Copy link
Contributor Author

DE0CH commented Jan 7, 2023

I didn't see doc, so I just updated README.

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

Successfully merging a pull request may close this issue.

2 participants