Skip to content

Commit

Permalink
add calendar events
Browse files Browse the repository at this point in the history
add calendar events
return is dict
test passed
  • Loading branch information
ghofi-dev committed Dec 14, 2023
1 parent 089af3a commit 6e5885f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions tests/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,6 @@ def test_recommendations_history(self): # alias for upgrades_downgrades

def test_calendar(self):
data = self.ticker.calendar
print(self.ticker.ticker)
print(data)
self.assertIsInstance(data, dict, "data has wrong type")
self.assertTrue(len(data) > 0, "data is empty")
self.assertIn("Earnings Date", data.keys(), "data missing expected key")
Expand Down
2 changes: 1 addition & 1 deletion yfinance/scrapers/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def _fetch_calendar(self):
# secFilings return too old data, so not requesting it for now
result = self._fetch(self.proxy, modules=['calendarEvents'])
try:
self._calendar = {}
self._calendar = dict()
_events = result["quoteSummary"]["result"][0]["calendarEvents"]
if 'dividendDate' in _events:
self._calendar['Dividend Date'] = datetime.datetime.fromtimestamp(_events['dividendDate']).date()
Expand Down

0 comments on commit 6e5885f

Please sign in to comment.