diff --git a/pandas_datareader/yahoo/daily.py b/pandas_datareader/yahoo/daily.py index e1578b09..26120642 100644 --- a/pandas_datareader/yahoo/daily.py +++ b/pandas_datareader/yahoo/daily.py @@ -3,6 +3,7 @@ import json import re import time +import datetime from pandas import DataFrame, isnull, notnull, to_datetime @@ -127,7 +128,8 @@ def url(self): def _get_params(self, symbol): # This needed because yahoo returns data shifted by 4 hours ago. four_hours_in_seconds = 14400 - unix_start = int(time.mktime(self.start.timetuple())) + unix_zero = datetime.datetime(1970, 1, 1, 8) + unix_start = int((self.start - unix_zero).total_seconds()) unix_start += four_hours_in_seconds day_end = self.end.replace(hour=23, minute=59, second=59) unix_end = int(time.mktime(day_end.timetuple())) diff --git a/pandas_datareader/yahoo/fx.py b/pandas_datareader/yahoo/fx.py index 81a0f0ec..69e15f1c 100644 --- a/pandas_datareader/yahoo/fx.py +++ b/pandas_datareader/yahoo/fx.py @@ -1,5 +1,6 @@ import json import time +import datetime import warnings from pandas import DataFrame, Series, concat, to_datetime @@ -39,7 +40,8 @@ class YahooFXReader(YahooDailyReader): """ def _get_params(self, symbol): - unix_start = int(time.mktime(self.start.timetuple())) + unix_zero = datetime.datetime(1970, 1, 1, 8) + unix_start = int((self.start - unix_zero).total_seconds()) day_end = self.end.replace(hour=23, minute=59, second=59) unix_end = int(time.mktime(day_end.timetuple()))