fix bug where mkt_cap or div_yield would show error if not found in yfinance info

This commit is contained in:
Jamie
2021-04-13 13:23:11 -04:00
parent a7ed6d1f19
commit 940fa9465b

View File

@@ -138,6 +138,8 @@ def property_weighting(
return
for stock in list_of_stocks:
stock_prop = yf.Ticker(stock).info[property_type]
if stock_prop is None:
stock_prop = 0
prop[stock] = stock_prop
prop_sum += stock_prop
for k, v in prop.items():