Skip to content

Commit

Permalink
Fixed bug introduced in 0.1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
ranaroussi committed Jul 11, 2022
1 parent 5d942d9 commit ec62797
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions yfinance/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion yfinance/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.1.73"
version = "0.1.74"

0 comments on commit ec62797

Please sign in to comment.