How to build a Telegram stock market bot
By the Botable team
A Telegram stock bot quotes tickers on demand, tracks a watchlist, and alerts on price moves. Unlike crypto it has to respect market hours and delayed data. Describe your tickers and thresholds and Botable builds it.
What is a stock market bot?
A Telegram stock bot looks like a crypto bot and differs in three ways that decide whether it is useful or misleading. Markets close, so a quote at 9pm is yesterday's close and must be labelled as such rather than presented as live. Most free market data is delayed by around fifteen minutes, and a bot that does not say so is quietly wrong at exactly the moments people care. And corporate actions — splits, dividends — break naive percentage calculations, so a stored cost basis needs adjusting or a portfolio silently reports a fictional loss the morning after a split. Beyond that the shape is familiar: a watchlist per user, threshold alerts checked on a schedule, and a portfolio with quantities and cost basis. Alerts should be suppressed outside market hours, or every user is woken by a stale quote crossing a line that had already been crossed.
What commands does it have?
| Command | What it does |
|---|---|
/quote AAPL | Price, change and whether the market is open |
/watch TSLA | Adds a ticker to the watchlist |
/portfolio | Holdings, cost basis and total value |
/alert NVDA 900 | Alerts when the price crosses a level |
/earnings | Upcoming earnings dates for watched tickers |
What do you need before you start?
- A Telegram bot token from @BotFather
- A market data source, and knowledge of whether it is real-time or delayed
- Which exchanges and timezones matter to you
How do you build it?
How should the bot handle market hours?
Label every quote with the state: live, delayed, or previous close. Ask for alerts to be suppressed while the market is shut, because a threshold crossed by a stale price fires repeatedly overnight and teaches people to mute the bot.
Is free market data good enough?
For watchlists and daily checks, yes. For anything time-sensitive, no — free tiers are typically delayed around fifteen minutes. The important part is that the bot says which it is on every quote rather than letting the number imply it is live.
What breaks a portfolio calculation?
Splits and dividends. A cost basis stored before a split produces a nonsense percentage after it. Ask for corporate-action handling if you track a portfolio over months; without it the numbers drift from reality silently rather than visibly.
How do you avoid alert spam around a threshold?
Fire once per crossing, not on every check while the price sits near the line, and require the price to move back through the level before the alert can fire again. Say this explicitly; naive threshold checks are the classic cause.
A prompt you can use as-is
Paste this into Botable and adjust the details. It is specific on purpose — a vague description produces a vague bot.
Build a stock market bot. /quote <ticker> returns price, day change and a clear label of live, 15-minute delayed or previous close, with the market state. /watch and /unwatch manage a per-user watchlist, /list shows it in one message. /alert <ticker> <price> fires once when the price crosses that level and re-arms only after it crosses back. Suppress alerts outside market hours for the relevant exchange. /portfolio tracks quantity and cost basis and reports total value and gain, adjusting cost basis for stock splits. /earnings lists upcoming earnings dates for watched tickers.
Who is this bot for?
- Investors who want quotes without opening a brokerage app
- Investing groups sharing a watchlist in one chat
- Anyone tracking a handful of positions rather than trading actively
What goes wrong with this kind of bot?
- Presenting delayed data without labelling it is the failure that actually costs people money
- Alerts that re-fire while the price hovers at the threshold will be muted within a day
- Ignoring splits makes long-held portfolio percentages quietly wrong
Questions about stock market bots
Can it cover non-US markets?
If your data source does. Say which exchanges matter when you describe it, because market hours, holidays and ticker formats all differ per exchange and each needs handling.
Should it give trading signals?
Be careful. Automated buy and sell recommendations move a bot from information into regulated advice in many jurisdictions. Alerts on price levels the user set themselves are a different thing from a recommendation.