Skip to content

Commit dfd6bf4

Browse files
Noah Stoffmanbashtage
authored andcommitted
Fix Yahoo! price data
Adds back support for downloading price data from Yahoo!
1 parent 1763dbd commit dfd6bf4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

docs/source/whatsnew/v0.7.0.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ Bug Fixes
5454
- Handle Morningstar index volume data properly (:issue:`486`).
5555
- Added support for optionally passing a custom base_url to the EnigmaReader (:issue:`499`).
5656
- Fixed Morningstar 'retry' incrementation (:issue:`513`)
57-
- Updated Google Daily Price API to functional url (:issue:`502`)
57+
- Updated Google Daily Price API to functional url (:issue:`502`)
58+
- Fix Yahoo! price data (:issue:`498`)

pandas_datareader/yahoo/daily.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ def _read_one_data(self, url, params):
125125
ptrn = r'root\.App\.main = (.*?);\n}\(this\)\);'
126126
jsn = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
127127
df = DataFrame(
128-
jsn['context']['dispatcher']['stores']
129-
['HistoricalPriceStore']['prices']
130-
)
128+
jsn['context']['dispatcher']['stores']
129+
['HistoricalPriceStore']['prices']
130+
)
131131
df['date'] = to_datetime(df['date'], unit='s').dt.date
132132
df = df.dropna(subset=['close'])
133133
df = df[['date', 'high', 'low', 'open', 'close',
134134
'volume', 'adjclose']]
135135

136136
if self.ret_index:
137-
df['Ret_Index'] = _calc_return_index(df['adjclose'])
137+
df['Ret_Index'] = _calc_return_index(df['Adj Close'])
138138
if self.adjust_price:
139139
df = _adjust_prices(df)
140140
return df.sort_index().dropna(how='all')

0 commit comments

Comments
 (0)