diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aaca14e21..93d00f5d2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,10 @@ Change Log =========== +0.1.74 +------ +- Fixed bug introduced in 0.1.73 (sorry :/) + 0.1.73 ------ - Merged several PR that fixed misc issues diff --git a/yfinance/base.py b/yfinance/base.py index c8ae38767..a7819f604 100644 --- a/yfinance/base.py +++ b/yfinance/base.py @@ -153,10 +153,10 @@ def history(self, period="1mo", interval="1d", elif isinstance(end, _datetime.datetime): end = int(_time.mktime(end.timetuple())) else: - end = int(_time.mktime(_time.strptime(str(end), '%Y-%m-%d'))) + end = int(_time.mktime(_time.strptime(str(end), '%Y-%m-%d'))) if start is None: - if interval=="1m": - start = end - 604800 # Subtract 7 days + if interval == "1m": + start = end - 604800 # Subtract 7 days else: start = -631159200 elif isinstance(start, _datetime.datetime): @@ -187,7 +187,6 @@ def history(self, period="1mo", interval="1d", url = "{}/v8/finance/chart/{}".format(self._base_url, self.ticker) session = self.session or _requests - data = None try: @@ -293,7 +292,7 @@ def history(self, period="1mo", interval="1d", dividends, splits = utils.parse_actions(data["chart"]["result"][0], tz) # Yahoo bug fix - it often appends latest price even if after end date - if quotes.shape[0] > 0: + if end and not quotes.empty: endDt = _pd.to_datetime(_datetime.datetime.fromtimestamp(end)) if quotes.index[quotes.shape[0]-1] > endDt: quotes = quotes.iloc[0:quotes.shape[0]-1] diff --git a/yfinance/version.py b/yfinance/version.py index ec24a1ff6..07f88b965 100644 --- a/yfinance/version.py +++ b/yfinance/version.py @@ -1 +1 @@ -version = "0.1.73" +version = "0.1.74"