What is the best way to query fundamentals for a specific symbol?
I am interested in fundamentals for a set of symbols ['BRK.A', 'GLD', 'SPY']
Below I try filter based on fundamentals.company_reference.primary_symbol a few different ways below but they all return empty.
I am try to get things like PE ratio, ROE, Price-to-Book Ratio, Dividend yield, etc for some index funds or blue chips
fundamental_df = get_fundamentals(
query(
# put your query in here by typing "fundamentals."
fundamentals.company_reference.primary_symbol,
fundamentals.valuation_ratios.pe_ratio,
fundamentals.valuation_ratios.pb_ratio,
fundamentals.operation_ratios.roe,
fundamentals.valuation.market_cap,
fundamentals.asset_classification.morningstar_sector_code,
fundamentals.asset_classification.growth_grade,
fundamentals.asset_classification.profitability_grade,
)
.filter(fundamentals.company_reference.primary_symbol == 'SPY')
.filter(fundamentals.company_reference.primary_symbol.in_(['BRK.A', 'GLD', 'SPY']))
)
x=[(stock.symbol,fundamental_df[stock]['growth_grade'], fundamental_df[stock]['profitability_grade']) for stock in fundamental_df]
print 'Benchmarks: Len=%d, %s'%(len(x),x)
Non of the above work.
Any suggestions?
Sarvi