Run an End-of-Day Screen
The most common use of the API: once the market closes, run your screen, rank the matches, and save a list you'll act on tomorrow. This guide builds that as one script and schedules it.
You'll need: a token (any plan for the scan; Power User or higher for the relative-strength column), and Python 3.9+ with requests, or Node 18+.
1. Choose the screen
The script runs whatever payload is in screen.json. Keeping the screen in a file, not in the script, lets you change it without touching code. Get it either way:
- Export it from the scanner. Open the scan in the scanr.ai scanner, click Filters → Export filters, then Download JSON, and save the file as
screen.json. This is the easiest way to run a screen you already watch in the app. - Describe it. Send the screen to
/scan/natural, read thereasoningit returns, and savegenerated_payloadasscreen.json:
Either way you generate or export it once. The nightly run then costs one request and no AI credits.
This guide uses a classic trend-following watchlist: stocks above $10 trading at least $20M a day on average, above their 50-day moving average, with the 50-day above the 200-day and relative strength in the top quarter of the market. Written out, screen.json is the following. The three SMA rows are three separate conditions, and all of them must hold.
2. Write the script
The script checks the market is closed (so daily bars are settled), runs the scan, adds each match's relative-strength score, and writes a dated CSV.
The script makes three kinds of request (one scan, one market-status check, and a relative-strength call per page of 500 rows), so it fits comfortably in any plan's limits.
3. Schedule it
Run it on weekdays at 16:30 New York time, which leaves a margin after the 16:00 close. On a market holiday the market is closed all day, so the script runs and returns the previous session's list.
GitHub's scheduler runs in UTC and can start late under load. During winter (EST) 20:30 UTC is 15:30 in New York, before the close, and the script exits without scanning. Use "30 21 * * 1-5" from November to March, or run it hourly after 20:00 UTC and let the market-status check decide.
4. Build on it
- Diff against yesterday. Load the previous CSV and report only new tickers: the stocks that entered the screen today are usually the actionable ones.
- Let scanr.ai do the scheduling. Save the scan instead, and it runs in the background; read what entered it from
POST /api/v2/scan/paginated-scan-events. - Judge the screen. Once it's saved, its performance tells you whether the stocks it picks actually go on to outperform.


