我曾尝试从雅虎财经下载市场数据,但一直出错。这是我的密码:
import yfinance as yf
# import data of different asset classes
VT = yf.download("VT",interval="1d", start="2017-01-01", end="2021-01-01") #stocks
BND = yf.download("BND",interval="1d", start="2017-01-01", end="2021-01-01") #bonds
VNQ = yf.download("VNG",interval="1d", start="2017-01-01", end="2021-01-01") #real estate
DBC = yf.download("DBC",interval="1d", start="2017-01-01", end="2021-01-01") #commodities
此错误显示为:
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-3-2a474e2089b7> in <module>
1 #import data of different asset classes
----> 2 VT = yf.download("VT",interval="1d", start="2017-01-01", end="2021-01-01") #stocks
3 BND = yf.download("BND",interval="1d", start="2017-01-01", end="2021-01-01") #bonds
4 VNQ = yf.download("VNG",interval="1d", start="2017-01-01", end="2021-01-01") #real estate
5 DBC = yf.download("DBC",interval="1d", start="2017-01-01", end="2021-01-01") #commodities
~/anaconda3/lib/python3.7/site-packages/yfinance/multi.py in download(tickers, start, end, actions, threads, group_by, auto_adjust, back_adjust, progress, period, interval, prepost, proxy, rounding,**kwargs)
93 rounding=rounding)
94 while len(shared._DFS) < len(tickers):
---> 95 _time.sleep(0.01)
96
97 # download synchronously
KeyboardInterrupt:
暂无答案!
目前还没有任何答案,快来回答吧!