3

I get the following error when using yahoo finance. I'm not sure what's causing this error it worked an hour ago without issue.

Exception in thread Thread-8: Traceback (most recent call last): File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/site-packages/multitasking/__init__.py", line 102, in _run_via_pool return callee(*args, **kwargs) File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/site-packages/yfinance/multi.py", line 167, in _download_one_threaded data = _download_one(ticker, start, end, auto_adjust, back_adjust, File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/site-packages/yfinance/multi.py", line 179, in _download_one return Ticker(ticker).history(period=period, interval=interval, File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/site-packages/yfinance/base.py", line 157, in history data = data.json() File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/chandlergreff/opt/anaconda3/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 

Please find my code below

# yahoo finance parameters stock_symbol = 'JPM' length = 1 # yahoo date period now = dt.datetime.now() max_d = dt.datetime.now().strftime('%Y-%m-%d') min_d = now.replace(year=now.year-length).strftime('%Y-%m-%d') # yahoo data download data = yf.download(stock_symbol, min_d, max_d) 

1 Answer 1

6

I upgraded yfinance and the code worked.

Here is the code I am/was running: data1 = yf.download(tickers = 'SPY', start=startdate, end=enddate) # equity indices

Here is my upgrade code run from Anaconda, environments, base(root) command line: pip install yfinance --upgrade --no-cache-dir

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.