KeyError: 'exchangeTimezoneName' when accessing ticker history
See original GitHub issueCurrent yfinance 0.1.75 raises an exception when running the following:
import yfinance as yf
def _main():
stock_data = yf.download(
"AFN",
start="2018-01-01",
end="2018-12-31",
group_by="ticker",
threads=False
)
print(stock_data)
if __name__ == "__main__":
_main()
stock_data = yf.download(
File "/Users/manoel/opt/anaconda3/envs/Qiskitenv/lib/python3.8/site-packages/yfinance/multi.py", line 120, in download
data = _download_one(ticker, period=period, interval=interval,
File "/Users/manoel/opt/anaconda3/envs/Qiskitenv/lib/python3.8/site-packages/yfinance/multi.py", line 205, in _download_one
return Ticker(ticker).history(period=period, interval=interval,
File "/Users/manoel/opt/anaconda3/envs/Qiskitenv/lib/python3.8/site-packages/yfinance/base.py", line 148, in history
end = utils._parse_user_dt(end, self._get_ticker_tz())
File "/Users/manoel/opt/anaconda3/envs/Qiskitenv/lib/python3.8/site-packages/yfinance/base.py", line 328, in _get_ticker_tz
tkr_tz = self.info["exchangeTimezoneName"]
KeyError: 'exchangeTimezoneName'
Running the same sample against the previous release returns:
[*********************100%***********************] 1 of 1 completed
Open High Low Close Adj Close Volume
Date
2018-01-02 29.799999 29.799999 29.799999 29.799999 29.799999 0
2018-01-03 30.000000 30.000000 30.000000 30.000000 30.000000 0
2018-01-04 30.000000 30.000000 30.000000 30.000000 30.000000 0
2018-01-05 30.200001 30.200001 30.200001 30.200001 30.200001 0
2018-01-08 30.000000 30.000000 30.000000 30.000000 30.000000 0
2018-01-09 30.200001 30.200001 30.200001 30.200001 30.200001 0
2018-01-10 32.799999 32.799999 32.799999 32.799999 32.799999 0
2018-01-11 31.799999 31.799999 31.799999 31.799999 31.799999 0
2018-01-12 30.799999 30.799999 30.799999 30.799999 30.799999 0
2018-01-16 30.200001 30.200001 30.200001 30.200001 30.200001 0
2018-01-17 30.799999 30.799999 30.799999 30.799999 30.799999 0
2018-01-18 30.799999 30.799999 30.799999 30.799999 30.799999 0
2018-01-19 30.799999 30.799999 30.799999 30.799999 30.799999 0
2018-01-22 31.400000 31.400000 31.400000 31.400000 31.400000 0
2018-01-23 32.000000 32.000000 32.000000 32.000000 32.000000 0
2018-01-24 31.600000 31.600000 31.600000 31.600000 31.600000 0
2018-01-25 31.200001 31.200001 31.200001 31.200001 31.200001 0
2018-01-26 32.200001 32.200001 32.200001 32.200001 32.200001 0
2018-01-29 31.799999 31.799999 31.799999 31.799999 31.799999 0
2018-01-30 31.520000 31.520000 31.520000 31.520000 31.520000 0
If I run with threads=True it will raise the exception and hang.
Issue Analytics
- State:
- Created a year ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Python yahoo finance error market_cap=int(data. ...
You can do this import pandas_datareader as web tickers=["AAPL","GOOG","RY","HPQ"] # Get market cap (not really necessary for you) ...
Read more >Financial Data from Yahoo Finance with Python
In this post, we are going to learn about a super easy to use Python package to retrieve financial data from Yahoo Finance....
Read more >beancount.prices
Fetch prices from the internet and output them as Beancount price directives. This script accepts a list of Beancount input filenames, and fetches...
Read more >Yfinance History
I use the Python package yfinance to get the historical stock prices of a stock (in this example ... KeyError: 'exchangeTimezoneName' when accessing...
Read more >KeyError in Python code used to determine a trade signal ...
In the method Distancefunc change this: for ticker in tickers: data = Returns(ticker,begdate,enddate) ... to this: data = Returns(tickers ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s a good point, it should print a nice message. Will fix for next release.
Good point. I’ll push an update to
dev