Skip to content

Commit df98a72

Browse files
duch94bashtage
authored andcommitted
fixed issue when yahoo test failes because of time offset issues (#543)
* fixed issue when yahoo test failes because of time offset issues * updated whatsnew file for v0.7.0 * fixed lines length * PEP8 E127 fix
1 parent feee4d7 commit df98a72

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

docs/source/whatsnew/v0.7.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ Bug Fixes
6969
- Added back support for Yahoo! price, dividends, and splits data for stocks
7070
and currency pairs (:issue:`487`).
7171
- Add `is_list_like` to compatibility layer to avoid failure on pandas >= 0.23 (:issue:`520`)
72+
- Fixed Yahoo! time offset (:issue:`487`).
7273
- Fix Yahoo! quote reader (:issue: `540`)

pandas_datareader/yahoo/daily.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,17 @@ def get_actions(self):
9797
def url(self):
9898
return 'https://finance.yahoo.com/quote/{}/history'
9999

100+
# Test test_get_data_interval() crashed because of this issue, probably
101+
# whole yahoo part of package wasn't
102+
# working properly
100103
def _get_params(self, symbol):
104+
# This needed because yahoo returns data shifted by 4 hours ago.
105+
four_hours_in_seconds = 14400
101106
unix_start = int(time.mktime(self.start.timetuple()))
107+
unix_start += four_hours_in_seconds
102108
day_end = self.end.replace(hour=23, minute=59, second=59)
103109
unix_end = int(time.mktime(day_end.timetuple()))
110+
unix_end += four_hours_in_seconds
104111

105112
params = {
106113
'period1': unix_start,

0 commit comments

Comments
 (0)