Yahoo finance is not working

  • Thread starter Thread starter sale
  • Start date Start date
Joined
7/10/21
Messages
2
Points
11
Hi,
I get the following error when i use yahoo finance in python, see below. Is yahoo finance site down. What should i do to get yahoo finance to work.
I get the error when i run the following code in python
stock = input("Enter the stock symbol (enter 'quit' to stop): ") #Query user for stock ticker


while stock != "quit": #Runs this loop until user enters 'quit' (can do many stocks in a row)
df = pdr.get_data_yahoo(stock, start, now)
close=df["Adj Close"][-1]


thanks for help

C:\Saleem\Undervisning\Programmering\PythonProjects\Python-demos>python demo.py
Enter the stock symbol (enter 'quit' to stop): qqq
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\mosa0003\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\mosa0003\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\mosa0003\AppData\Roaming\Python\Python39\site-packages\multitasking\__init__.py", line 102, in _run_via_pool
return callee(*args, **kwargs)
File "C:\Users\mosa0003\AppData\Roaming\Python\Python39\site-packages\yfinance\multi.py", line 167, in _download_one_threaded
data = _download_one(ticker, start, end, auto_adjust, back_adjust,
File "C:\Users\mosa0003\AppData\Roaming\Python\Python39\site-packages\yfinance\multi.py", line 179, in _download_one
return Ticker(ticker).history(period=period, interval=interval,
File "C:\Users\mosa0003\AppData\Roaming\Python\Python39\site-packages\yfinance\base.py", line 157, in history
data = data.json()
File "C:\Users\mosa0003\AppData\Roaming\Python\Python39\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\mosa0003\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\mosa0003\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 
stock = input("Enter the stock symbol (enter 'quit' to stop): ") #Query user for stock ticker


while stock != "quit": #Runs this loop until user enters 'quit' (can do many stocks in a row)
df = pdr.get_data_yahoo(stock, start, now)
close=df["Adj Close"][-1]
This will result in an infinite loop, as the input is only occurring one time, prior to the loop.
 
This will result in an infinite loop, as the input is only occurring one time, prior to the loop.
Hi again,
I forgot to send the correct code.
the correct code is

stock = input("Enter the stock symbol (enter 'quit' to stop): ") #Query user for stock ticker
while stock != "quit": #Runs this loop until user enters 'quit' (can do many stocks in a row)
df = pdr.get_data_yahoo(stock, start, now)
close=df["Adj Close"][-1]
stock = input("Enter the stock symbol (enter 'quit' to stop): ")

But i never get beyond the line
df = pdr.get_data_yahoo(stock, start, now)
and get error as described in my first mejl.
what is going wrong?
thanks
 
Back
Top Bottom