我正在尝试使用yahoo_fin的get_quote_table获取实时价格,之前的收盘价和当日价格范围。它一直在处理某些时间出现的这些错误,但是到目前为止,我的程序仍然可以运行。今天,我一直在不断遇到这些错误。
File "bot.py", line 120, in start
price_opens[i] = get_quote_table(all_tickers[i])["Previous Close"]
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\site-packages\yahoo_fin\stock_info.py", line 202, in get_quote_table
quote_price = pd.DataFrame(["Quote Price", get_live_price(ticker)]).transpose()
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\site-packages\yahoo_fin\stock_info.py", line 425, in get_live_price
df = get_data(ticker, end_date = pd.Timestamp.today() + pd.DateOffset(10))
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\site-packages\yahoo_fin\stock_info.py", line 78, in get_data
raise AssertionError(resp.json())
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\NAME\AppData\Local\Programs\Python\Python36\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
我也在Heroku上运行了该bot,并且发生了同样的问题。 是什么导致此问题?请帮忙。
编辑:此错误是随机发生的。有时候,某个股票行情指示器会失败,而另一次它将行得通。但是,今天,它忙得不可开交,每次我的机器人启动时都在发生。