I am wanting to make a bot that trades the day’s biggest market movers (largest percent increase or decrease from the previous day). I read in this post that there is a use case where the user could query this data:
First, the investor could set up a daily query to check the 10 biggest daily losers out of a list of 500 stocks. Next, the system can retrieve the peers and industry tags for each of those losers and check their performance. Subsequently, part of the system can scan the news for the day and determine whether any major news occurred, potentially by keyword matching.
However, looking through the documentation, I don’t see which endpoint you could hit to achieve this screen. Hitting /v2/assets returns over 10,000 assets, but there is no percent change field on the objects returned. To me, it seems that one would have to loop through each asset on this list and manually generate a list of market movers. I would greatly appreciate if somebody could let me know if this is, in fact, the only way to achieve this, or if there is a simpler way. That is, if there is an endpoint for querying by percent change.
I’ve begun working with Polygon’s API. The gainers/losers endpoints are actually what I’m using now. I hadn’t previously realized that Alpaca users got access to premium Polygon features. One issue is that this Polygon gainers/losers screen doesn’t return a lot of stocks. Many of them aren’t shortable. There is no way to query Polygon (as far as I know) for stocks that are tradable/shrotable through Alpaca. I’m needing to do a check on each individual security for tradability/shortability after receiving the list from Polygon.
What I do is use the Snapshot all Tickers API call. This gives me all stocks in the market (not just the limited gainers / losers polygon gives you).
Then I use the Alpaca /v2/assets API. To get a list of stocks that are easy to borrow. Then only look at the stocks that return via the Snapshot API that are easy to borrow.
I know that I don’t have to use Polygon or Alpaca, but I was hoping that they would have this functionality built in so that I wouldn’t have to filter for shortability/tradability on Alpaca. I’m currently using @spicer 's suggestion of getting all tickers and sorting on the front end. Its working well!
My point was that you can incorporate stock data from sources other than Alpaca while still using Alpaca for trade. Sorry if I stated the obvious.
For me, getting gainers through Yahoo works best (though they do fail on many other fronts as well) – without needing to filter irrelevant stocks etc. – but I get it that all is working fine for you now.
All good, thanks for the suggestion! I checked out Yahoo, but it seems that it isn’t very well maintained. That is, I couldn’t find a good documentation page for it, so it was a lot of guesswork.