Scanning for stocks efficiently

I’m building a stock scanner/screener, and think I’ve got it figured out, but feel like there should be a more efficient way. For example, let’s say I want to find all stocks between $2 and $10.

  • Use REST.list_assets() to retrieve a giant object with all stocks
  • Loop through the object and retrieve a day bar with REST.get_barset() for yesterday’s closing price
  • If the price is within my parameters, append the symbol as a string to a local list variable.

The thing I don’t get is why should I have to retrieve thousands of asset objects, each with 9 properties that I don’t need, and then loop through them to retrieve yet another giant list of barset objects in order to check if it matches my criteria?

Isn’t there a way for me to provide parameters in the original query so that the filtering happens server side? Something like REST.list_assets(price <10.00) so it only requests a list of assets that are less than $10 in the first place?