SQL
The q parameter on /scan and the qfield on /webhooks both accept a SQL WHERE clause. Identifiers are flag names (booleans) or column names (numerics, strings, dates) from the schema.
Shape
You write the part you would put after WHERE. No SELECT, no FROM, no ORDER BY, no semicolon. The query is implicitly evaluated against a single row of the ticker table at a time.
above_sma_50 AND day_change_pct > 5 AND market_cap < 2000000000 AND NOT earnings_this_weekWhat we don’t accept
Valid SQL features we explicitly reject. Avoids surprises when an otherwise-correct WHERE clause returns a 400.
- No subqueries or joins. The query filters a single row of the ticker table.
- No string functions (LIKE, ILIKE). Use IN with a finite set instead.
- No date arithmetic beyond what flags already expose (e.g. `earnings_this_week`).
- No CASE expressions or computed columns.
Examples
Patterns that show up often. Copy, modify, ship.
Bullish breakouts on volume
Stocks breaking out today on at least 2× their normal volume.
breakout AND volume_unusual_2xSmall-cap gappers, avoiding earnings noise
Small caps gapping up 3% on heavy volume, with no earnings announcement this week.
gap_up_3pct AND volume_unusual_2x AND market_cap < 2000000000 AND NOT earnings_this_weekOversold tech with healthy fundamentals
Oversold technology names that are still profitable.
rsi_oversold AND sector = 'Technology' AND pe_ratio BETWEEN 5 AND 30New 52-week highs with momentum
Stocks making fresh 52-week highs with strong upward momentum.
at_52w_high AND momentum_strong_upCrypto breakouts
Cryptocurrencies breaking above their 20-day high.
breaking_above_20d_highMega-cap consolidation
Mega-cap stocks coiling for a move — tight Bollinger bands, low volatility.
market_cap > 200000000000 AND atr_percent < 1.5Sector rotation candidates
Healthcare and energy names crossing above their 50-day average.
sector IN ('Healthcare', 'Energy') AND above_sma_50 AND NOT in_downtrendURL encoding
When sending the query as a URL parameter, encode it. Most HTTP clients do this automatically.
Spaces become %20, > becomes %3E, single quotes become %27. When in doubt, send the query in a JSON body via POST /v1/scan — no encoding needed.
# Equivalent to GET /v1/scan?q=above_sma_50%20AND%20day_change_pct%20%3E%205
curl -X POST https://api.tickerbot.io/v1/scan \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "above_sma_50 AND day_change_pct > 5"}'