Build an AI Stock Screener Bot in 45 Minutes
An automated stock trading bot build that scans the options market with Claude and Unusual Whales flow, then prints a ranked watchlist with confidence scores.
>This covers the screener. Use Claude to Build an AI Trading Bot goes deeper on the real-time flow trader, the Monte Carlo backtest, and the risk module that gates every trade.

Use Claude to Build an AI Trading Bot One Weekend
Turn $500 into $10K in 90 Days with Stocks, Options, and Prediction Markets
Summary:
- Build a Python bot that scans the options market every morning and ranks where smart money is moving.
- Four stages: Pull options flow, Filter the noise, Analyze with Claude, Rank by confidence.
- Output is a top watchlist with direction, a confidence score, and one-paragraph reasoning per pick.
- Copy-paste Claude Code prompt, the real Unusual Whales REST call, and a cron line to run it daily.
The fastest automated stock trading bot build that actually earns its keep is a screener: a script that scans the entire options market before you finish coffee and hands you the five to ten names where institutions are placing aggressive bets. Not a chart-watching toy. A filter that reads order flow you cannot watch by hand.
A friend spent three months building one from scratch. Custom database, manual pipeline, cron jobs that broke every other week. It checked price and volume. I built the version below in an afternoon, it reads live options flow across every optionable stock, and it returned a ranked watchlist in about 12 seconds. He looked at the output and said, “Well, that’s annoying.”
What does the screener actually do?
It runs four stages in order: Pull, Filter, Analyze, Rank. Pull grabs the day’s unusual options flow from Unusual Whales. Filter throws out the noise. Analyze sends each survivor to Claude for a read. Rank sorts by confidence and prints the watchlist.
That is the whole machine. Most “unusual activity” is a market maker hedging or someone rolling a position. The screener exists to find the handful of prints that mean something and explain why.

Here is the kind of output one run produces against a US-equities universe of roughly 3,487 names:
DAILY WATCHLIST (Top 3) · generated in 12.4s
1. 🟢 TICKER1 | BULLISH | Confidence: 84%
Unusual call sweeps across near-term strikes. Dark pool prints
held above VWAP, sector ETF is up. IV still below extreme.
2. 🟢 TICKER2 | BULLISH | Confidence: 78%
$1M+ premium block hit the ask, follow-through buying confirmed.
Correlated sector names green, price holding intraday support.
3. 🔴 TICKER3 | BEARISH | Confidence: 71%
Unusual put volume expanded fast, bearish flow concentration.
Relative weakness vs the market, rising downside hedging.
Each line tells you what Claude saw and why it matters. Not “buy TICKER1.” Which ticker, which signals converged, how confident the read is.
How do you build it without writing Python?
You do not type the bot. You open Claude Code in your project directory and paste this prompt. Claude writes screener/screener.py, runs it once, and shows you the watchlist.
Build me a stock screener bot using Claude + Unusual Whales' REST API.
1. Pull today's unusual options flow: GET
https://api.unusualwhales.com/api/option-trades/flow-alerts
with requests.get() and Authorization: Bearer $UW_API_KEY.
Query params: min_premium=200000, min_volume_oi_ratio=3.0,
is_sweep=true. Use the documented response fields: ticker,
strike, expiry, type, volume, open_interest,
volume_oi_ratio, total_premium, has_sweep, has_floor.
2. For each filtered event, send the event JSON to Claude
(model claude-sonnet-4-6) for multi-signal analysis.
Require 3+ converging signals before assigning 70+ confidence.
3. Rank by confidence, print the top 10, save
screener/watchlist_YYYYMMDD.json.
Do NOT use a vanilla client.messages.create('Using Unusual
Whales MCP, ...') prompt for the data fetch. That does not
invoke MCP through the Messages API and returns hallucinated
JSON. Use the REST endpoint directly. Save as
screener/screener.py and run it once.
That last paragraph is the load-bearing instruction. Skip it and you get the single most common failure in this whole build.
What broke
My first version trusted a prompt that said “Using Unusual Whales MCP, pull today’s flow.” It returned clean, confident, totally fabricated JSON. Real-looking tickers. Plausible premiums. None of it real. The vanilla Messages API has no MCP connection from a saved script, so Claude does what Claude does when asked for data it cannot reach: it makes it up.
The fix is to fetch data the boring way and only use Claude for judgment:
import os, requests
from anthropic import Anthropic
UW_BASE = "https://api.unusualwhales.com/api"
client = Anthropic()
def get_unusual_flow():
key = os.getenv("UW_API_KEY")
if not key:
raise RuntimeError(
"UW_API_KEY not set. The screener needs a paid UW tier "
"(Trial $50/wk). Free Shamu does NOT include API access."
)
resp = requests.get(
f"{UW_BASE}/option-trades/flow-alerts",
headers={"Authorization": f"Bearer {key}"},
params={"min_premium": 200_000,
"min_volume_oi_ratio": 3.0, "is_sweep": True},
timeout=30,
)
if resp.status_code == 403:
print("UW 403: Trial $50/wk is the minimum tier with API.")
return []
resp.raise_for_status()
return [i for i in resp.json().get("data", [])
if i.get("has_sweep") or i.get("has_floor")]
The second symptom of the same bug: if your watchlist comes back full of tickers with no real volume or company names you cannot find, the UW MCP is not connected. Run claude mcp list and confirm unusualwhales is registered. Hallucinated tickers are the tell.
How does Claude score each event?
It reasons across the flow event plus what it knows about the ticker, then returns a confidence score. The prompt forces calibration with one instruction: require three or more converging signals before assigning 70 or above.
def analyze_signal(event):
msg = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=800,
messages=[{"role": "user", "content": f"""
Unusual options flow event: {event}
Reason across: options flow aggressiveness, dark-pool context,
implied volatility, sector, catalyst window. Be honest when a
dimension is unknown rather than guessing.
Return JSON: ticker, direction (BULLISH/BEARISH),
confidence (0-100, require 3+ converging signals for 70+),
reasoning (one paragraph)."""}],
)
return msg.content[0].text # parse JSON; strip ``` fences if wrapped
Without the three-signal rule, a big call sweep alone feels exciting and Claude scores it 85. Forcing convergence is what keeps the 84% in that watchlist meaningful instead of theatrical.
What does a screener run cost?
Cents. Each run is one Unusual Whales pull plus one Claude call per filtered event, usually 15 to 25 of them on a normal day. Here is the current Claude API pricing, scraped live from Anthropic’s pricing docs:
| Model | Input ($/MTok) | Output ($/MTok) |
|---|---|---|
| Claude Opus 4.7 | $5 | $25 |
| Claude Sonnet 4.6 | $3 | $15 |
Source: Anthropic Claude API pricing. The screener uses Sonnet 4.6. At those rates, a full run lands around $0.10 to $0.30 depending on how chatty the analysis is. Keep the min_premium floor at $200K. Drop it and you get 100+ events, and cost scales linearly with noise.
How do you run it every morning automatically?
You schedule it with cron for 9:35 AM Eastern, five minutes after the open so the first chaotic prints have settled. You do not want to babysit this:
35 9 * * 1-5 cd ~/ai-trading-bot && source venv/bin/activate && python screener/screener.py >> screener/log.txt 2>&1
Want only the high-conviction names? Add one line after the sort so anything under 65 drops off the list:
results = [r for r in results if r.get("confidence", 0) >= 65]
What should you actually do?
- If you are non-technical → paste the prompt, let Claude Code write and run
screener.py, and judge the output by whether it prints a watchlist. You do not need to read every line. - If the watchlist is full of unknown tickers → your UW MCP or API key is wrong. Hallucinated tickers always mean the data layer is not connected. Fix that before anything else.
- If you get 80+ events per run → your filters are too loose and your bill is climbing. Raise
min_premiumto $500K, not the poll frequency. - If a name looks great at 84% → still ask whether there is a catalyst you can name and whether the risk fits your sizing rules. The screener is a filter, not a thinker.
bottom_line
- A screener is the right first bot. It produces a real, useful artifact in under an hour and risks zero dollars.
- The whole edge is in the filter and the three-signal rule. Loose filters give you an expensive noise machine.
- Never trust a prompt that claims to fetch data Claude cannot reach. Fetch with REST, judge with Claude, and verify the tickers are real.
Frequently Asked Questions
Do I need to know Python to build this screener bot?+
No. You paste the prompt into Claude Code and it writes screener.py for you. You read the output and run it. You need to read code, not write it.
How much does one screener run cost in API spend?+
Roughly $0.10 to $0.30 per run on Claude Sonnet 4.6, depending on how many events pass the filter. One Unusual Whales pull plus 15-25 analysis calls.
Is Unusual Whales free for the API?+
No. The free Shamu web tier does not include API access. The Trial tier is $50/week and is the cheapest tier that gets you the flow-alerts endpoint.