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

Fix: Restore dev branch regression with Ticker.history() #2211

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

dhruvan2006
Copy link
Contributor

Fix regression introduced by #2192 that broke the functionality of the dev branch while implementing custom periods.

Ticker.history() and download() methods were broken.

@ValueRaider
Copy link
Collaborator

ValueRaider commented Jan 8, 2025

Can you give an example regression scenario?

@dhruvan2006
Copy link
Contributor Author

On dev branch:

import yfinance as yf

hist = yf.Ticker("AAPL").history()
print(hist)

Traceback (most recent call last):
File "C:\Users\dhruv\yfinance\test.py", line 3, in
hist = yf.Ticker("AAPL").history()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dhruv\yfinance\yfinance\utils.py", line 103, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dhruv\yfinance\yfinance\base.py", line 81, in history
return self._lazy_load_price_history().history(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dhruv\yfinance\yfinance\utils.py", line 103, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dhruv\yfinance\yfinance\scrapers\history.py", line 109, in history
end = utils._parse_user_dt(end, self.tz)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dhruv\yfinance\yfinance\utils.py", line 427, in _parse_user_dt
dt = int(dt.timestamp())
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'timestamp'

@ValueRaider
Copy link
Collaborator

Thanks.

@R5dan FYI your PR #2192 was broken, and didn't handle custom period strings.

@ValueRaider ValueRaider merged commit 20b3b43 into ranaroussi:dev Jan 11, 2025
2 checks passed
@R5dan
Copy link
Contributor

R5dan commented Jan 11, 2025

Sorry, should have done more testing. Probably happened when moving functionality from Ticker.history to utils.

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 this pull request may close these issues.

3 participants