It seems that all the data in net_assets of Balance_sheet is NONE in fundamental data
.filter(fundamentals.balance_sheet.net_assets == None) I did one this shelter and every stock can meet this filter requirement
That's weird. Can anybody solve this problem? Really appreciate.
fundamental_df = get_fundamentals(
query(
# put your query in here by typing "fundamentals."
fundamentals.valuation_ratios.pe_ratio,
fundamentals.asset_classification.morningstar_sector_code,
fundamentals.income_statement.ebit,
fundamentals.balance_sheet.net_assets,
)
.filter(fundamentals.valuation.market_cap != None)
.filter(fundamentals.valuation.shares_outstanding != None)
.filter(fundamentals.balance_sheet.net_assets == None)
.filter(((fundamentals.valuation.market_cap*1.0) / (fundamentals.valuation.shares_outstanding*1.0)) > 1.0)
# .filter(((fundamentals.income_statement.ebit*1.0 )/ (fundamentals.balance_sheet.net_assets*1.0))>0)
# Filter where PE ratio is less than 14
.filter(fundamentals.valuation_ratios.pe_ratio < 14)
# Filter where PB ratio is less than 2
.filter(fundamentals.valuation_ratios.pb_ratio < 2)
.order_by(fundamentals.valuation.market_cap.desc())
.limit(num_stocks)
)