Overview
PolyShock is a Telegram bot that watches the most active Polymarket prediction markets and alerts subscribers when a price jumps or trading volume spikes. Each subscriber can filter signal types, set quiet hours and choose their own thresholds.
I built it solo, starting as a single-user script and reworking it into a multi-user service with a database, an admin panel, an LLM assistant for searching markets and changing settings in plain language, and a Railway deployment.
The challenge
Prediction markets move fast and there are hundreds of them. Watching a few by hand misses the moments that matter, and a naive alert that fires on every tick is noise.
Once several people use the same bot, one global setting stops working: some want every move, some only strong signals, and nobody wants a ping at night.
The goal
Detect real shifts in market activity and deliver them to each person the way they want them.
- 01Poll Polymarket's public API on a schedule and store a snapshot of each active market.
- 02Flag price moves and volume spikes, and rank both together as a strong signal.
- 03Avoid spam with per-market cooldowns and per-user filters.
- 04Run reliably in the cloud with a database and an admin control.
How signals are detected
Every 30 seconds the bot fetches the 100 most active markets and stores a snapshot. A price signal fires when the price has moved by 4% or more compared with five minutes earlier. A volume signal fires when volume is at least twice the recent rolling average. When both happen together the alert is marked a strong signal. Each market has a 15-minute cooldown per signal type.
Commands and personal settings
Subscribers use commands such as /top, /market, /history and /status, and personal settings: /alerts to filter signal types, /quiet for a UTC quiet window, /minvol and /pricefilter for their own thresholds. An inline menu and settings screens cover the same options without typing commands.
LLM assistant and admin tools
A Groq-backed agent can call tools to search markets, read recent alerts and update a user's preferences from a plain-language message, with a per-user rate limit and a cap on tool iterations. Admins get a pause and resume button, subscriber stats and a broadcast command, and error logs are forwarded to an admin chat.
Storage and deployment
Data access moved to SQLModel, with PostgreSQL in production and SQLite locally. The bot runs in polling mode on a laptop and in webhook mode on Railway, packaged with a Dockerfile.
The outcome
PolyShock is a complete multi-user alert bot with a documented command set, a database layer and a deployment path. I have no subscriber numbers to report. It shows a polling pipeline, per-user state and an LLM agent with tool calls working together in one service.


