Skip to content

Commit f39cd17

Browse files
authored
Merge pull request #734 from hughdavenport/hughdavenport-patch-1
Get price even if open price not available
2 parents f5df1d5 + 3288aab commit f39cd17

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

yfinance/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,15 @@ def cleanup(data):
350350
self._info.update(data[item])
351351
except Exception:
352352
pass
353+
354+
if not isinstance(data.get('summaryDetail'), dict):
355+
# For some reason summaryDetail did not give any results. The price dict usually has most of the same info
356+
self._info.update(data.get('price', {}))
353357

354358
try:
355359
# self._info['regularMarketPrice'] = self._info['regularMarketOpen']
356360
self._info['regularMarketPrice'] = data.get('price', {}).get(
357-
'regularMarketPrice', self._info['regularMarketOpen'])
361+
'regularMarketPrice', self._info.get('regularMarketOpen', None))
358362
except Exception:
359363
pass
360364

0 commit comments

Comments
 (0)