-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
previous_close not working on some stock symbols #1381
Comments
Interesting ticker. Yahoo normally calculates "previous close" as before last trading day, but Yahoo only has trading data for today. What do you think the previous close should be? |
Previous close is wrong for majority of data. For example: Data on historical data are not the same as data on summary tab. |
I just wanted to pull the previous closing info. |
OK I got solutions:
Fall back to accessing
That previous close is in post-market, and Yahoo wasn't returning in a |
Can close? @ValueRaider |
Not yet, want confirmation is fixed. A fix is available is PIP pre-release and |
|
not working stock icon
`import yfinance as yf
ticker = yf.Ticker('SOKE.IS').fast_info
previous_close = ticker['previous_close']
print(previous_close)`
working stock icon
`import yfinance as yf
ticker = yf.Ticker('MAVI.IS').fast_info
previous_close = ticker['previous_close']
print(previous_close)`
traceback:
Traceback (most recent call last): File "D:\Python\PyCharm\yfinancetesting\main.py", line 4, in <module> previous_close = ticker['previous_close'] ~~~~~~^^^^^^^^^^^^^^^^^^ File "D:\Python\PyCharm\yfinancetesting\venv\Lib\site-packages\yfinance\base.py", line 110, in __getitem__ return getattr(self, k) ^^^^^^^^^^^^^^^^ File "D:\Python\PyCharm\yfinancetesting\venv\Lib\site-packages\yfinance\base.py", line 247, in previous_close self._prev_close = float(prices["Close"].iloc[-2]) ~~~~~~~~~~~~~~~~~~~~^^^^ File "D:\Python\PyCharm\yfinancetesting\venv\Lib\site-packages\pandas\core\indexing.py", line 1073, in __getitem__ return self._getitem_axis(maybe_callable, axis=axis) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\PyCharm\yfinancetesting\venv\Lib\site-packages\pandas\core\indexing.py", line 1625, in _getitem_axis self._validate_integer(key, axis) File "D:\Python\PyCharm\yfinancetesting\venv\Lib\site-packages\pandas\core\indexing.py", line 1557, in _validate_integer raise IndexError("single positional indexer is out-of-bounds") IndexError: single positional indexer is out-of-bounds
yfinance
version = 0.2.9The text was updated successfully, but these errors were encountered: