Skip to content

Commit f5a864d

Browse files
authored
Use the difference between the unix_zero and start to prevent the bug occurrence of OverflowError: mktime argument out of range.
1 parent 03a2cfb commit f5a864d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas_datareader/yahoo/daily.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,9 @@ def url(self):
127127
def _get_params(self, symbol):
128128
# This needed because yahoo returns data shifted by 4 hours ago.
129129
four_hours_in_seconds = 14400
130+
# Use the difference between the unix_zero and start to prevent the bug occurrence of `OverflowError: mktime argument out of range`.
130131
unix_zero = datetime.datetime(1970, 1, 1, 8)
131-
if self.start < unix_zero:
132-
unix_start = int((self.start - unix_zero).total_seconds())
133-
else:
134-
unix_start = int(time.mktime(self.start.timetuple()))
132+
unix_start = int((self.start - unix_zero).total_seconds())
135133
unix_start += four_hours_in_seconds
136134
day_end = self.end.replace(hour=23, minute=59, second=59)
137135
unix_end = int(time.mktime(day_end.timetuple()))

0 commit comments

Comments
 (0)