pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
2.03k stars 300 forks source link

Yahoo changed their returned field values breaking ffn.get() for Yahoo #34

Closed bengebre closed 3 years ago

bengebre commented 6 years ago

pandas-datareader 0.7.0 (released today) fixes the latest Yahoo data breakage, but Yahoo is now using new field values which breaks ffn.get(). For instance, 'Adj Close' changed to 'adjclose'. I replaced the two references to 'Adj Close' with 'adjclose' in data.py and now ffn.get() returns data, but the dataframe is only number indexed rather than date indexed. It's my first day with ffn so I'm not sure what typical behavior is, but I was just comparing my results to the examples and saw this discrepancy.

bengebre commented 6 years ago

Followup: I read an Issue regarding pandas-datareader's 0.7.0 stable release fixing the Yahoo problems, but I was actually using the development version pulled straight from github. Apologies on the confusion. The issue may be exactly the same when 0.7.0 is released, but it's probably smart to wait to see what the stable version looks like. It should be within the next week according to this:

https://github.com/pydata/pandas-datareader/issues/495

rubik commented 6 years ago

I have temporarily fixed this with the following code:

import pandas_datareader as pdr
import fix_yahoo_finance as yf
pdr.data.get_data_yahoo = lambda *a, **kw: yf.download(*a, **kw, progress=False)
import ffn

You will need the fix_yahoo_finance package.

JordanPlatts commented 6 years ago

Do you want to submit a pull request?

JordanPlatts commented 6 years ago

The pull request doesn't work with python 2.7.

I don't really want to merge it because some people use 2.7 and this seems like a temporary fix till they release pandas_datareader 0.7.0.

rubik commented 6 years ago

Ah I forgot about Python 2.7. That's very reasonable.