[英]Pandas DataReader is no longer working with the Yahoo Finance API?
我想這個問題是最近才出現的。 在我的普通PC上,我有一個較舊的pandas_datareader
版本,該版本可以正常工作,但是在我的實例上,我必須安裝較新的版本,但它不起作用。 它具有以下錯誤-
Yahoo Daily has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement. Pull Requests to re-enable these data connectors are welcome.
我可以以某種方式安裝早期版本嗎? 如何使用以下代碼解決此問題?
import pandas_datareader as web
import datetime
co = web.DataReader("AAPL", "yahoo", datetime.date.today() - datetime.timedelta(days=10), datetime.date.today())
print co.head()
我編寫了此程序包以從新的API https://query1.finance.yahoo.com讀取
from datetime import datetime
import py_yahoo_prices.price_fetcher as pf
st_dt = datetime(2017, 6, 1)
comp_codes = ["IMM.L", "AAPL", "TSLA", ....]
# get the raw prices from yahoo, auto retries on a 401 error
raw_prices = pf.multi_price_fetch(code=comp_codes, start_date=st_dt)
只需轉到pandas_datareader的PyPi,下載tar.gz文件( wget <url to tar.gz file for 0.5.0>
),然后鍵入pip install blahblah.tar.gz
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.