Any efficient way of getting symbols between a price range

def get_symbols(low,high):
assets = api.list_assets()
symbols = [asset.symbol for asset in assets if asset.tradable]
selected=[]
for symbol in symbols:
barset=api.get_barset(symbol,‘day’,limit=1)
bars = barset[symbol]
if bars[0].c >= low and bars[0].c<=high:
selected.append(symbol)
print (symbol,bars[-1].c)
return selected

1 Like

Take a look at the momentum example on github. It has an example of filtering stocks by price and volume.

1 Like

I think i read polygon api wont work in paper trade

Polygon will work even with paper trading keys, so long as you have a funded brokerage account.

@tcj2001, thanks a lot! Do you know if there is a faster way to do this? Because it actually takes quite a lot of time to run your function for all 8317 IEX tickers.

Look into finviz i made a simple login and excel file grabber that imported all to a mysql table