So far I've been running code to pull fundamental data and the code has been like:
fundamentals.balance_sheet.total_capitalization,
)
.filter(
fundamentals.operation_ratios.roa > 0.10
)
.filter(
fundamentals.operation_ratios.roe > 0.20
)
.filter(
fundamentals.operation_ratios.net_margin > 0.20
)
.filter(
fundamentals.balance_sheet.total_capitalization < 200000000
)
.order_by(
fundamentals.valuation.market_cap.desc()
)
.limit(context.limit)
)
...but that, I assume, just pulls data for the most recent quarter. What kind of code must I use to pull historical fundamental data to, for example, find companies whose current EPS is up over 25% compared to one quarter ago? Or companies whose sales that are up by a certain percentage in this most recent quarter over the same quarter last year?