How to get a daily price summary on Telegram with Python (yfinance)
Checking a watchlist every evening is a chore. A tiny script can do it for you and send one tidy message to your phone. This guide uses yfinance for prices and the Telegram Bot API to deliver them. It is for personal tracking and learning, not trading advice.
What you need
- A Telegram account and a bot token from @BotFather (send
/newbot). - Python on a computer or server that stays on.
- yfinance, free and open source (Apache-2.0).
Step by step
- Create the bot and find your chat ID. Open your bot, send
/start(bots cannot message you first), then read your chat ID from thegetUpdatesresponse of the Telegram Bot API. - Install the libraries:
pip install yfinance requests. - Download recent prices. yfinance can fetch several tickers at once, for example
yf.download(['MSFT', 'AAPL'], period='5d'). Take the last row of theClosecolumn and compare it with the previous one to get the daily change. - Build one message with a line per ticker, such as the symbol, the close and the change in %.
- Send it with a POST request to the
sendMessagemethod of the Telegram Bot API, passingchat_idandtext. - Schedule it with cron (or your task scheduler) once a day, after your markets close.
Ideas to extend it
- Only message when a move is bigger than a limit you choose (see our price-drop alert guide).
- Add a weekly summary on Fridays.
- Alert yourself if the script itself fails, as in the failed-backup guide.
Other ways to do it
If you want a full bot that answers commands such as "/prices", look at python-telegram-bot. If you prefer an official data service with a free plan, Tiingo offers a REST API for end-of-day prices (check the official website for current limits).
Good to know
yfinance is not an official Yahoo API and can stop working when Yahoo changes something. Its documentation says it is intended for research and educational purposes and that the Yahoo Finance API is for personal use only, so read Yahoo's terms. Prices can be delayed, so do not use this for fast decisions. Keep your bot token private.
See more ideas
Browse the use cases or try the live demo. Custom bots are coming soon: tell me when it opens.
Before you start
What does yfinance cost and what licence does it use?
Free (open source). Licence: Apache-2.0. Prices change, so check the official website before you decide.
What should I know before using yfinance?
Not affiliated with or endorsed by Yahoo. Its own documentation says the tool is intended for research and educational purposes and that the Yahoo Finance API is for personal use only: read their terms. Since it is not an official API, it can stop working whenever Yahoo changes something.
What does Tiingo cost and what licence does it use?
Starter free; Power $30/mo or $300/yr for individuals ($50/mo or $499/yr for internal commercial use). Licence: Commercial API. Prices change, so check the official website before you decide.
What should I know before using Tiingo?
Fundamental history is 5 years on free (15+ on Power); fundamental data through the API is a separate add-on: contact Tiingo. Commercial use costs more than personal use.
Tools in this guide
- yfinance: Python library to download prices and history from Yahoo Finance; widely used for research and learning.
- Tiingo: Affordable financial data API with 30+ years of end-of-day prices on 110,000+ securities, fundamentals, crypto and news.
Compare your options
- Twelve Data vs EODHD vs Tiingo: which market data API to start with?
- yfinance vs OpenBB vs Alpha Vantage: where to get market data for research
Want a bot like this when custom bots open? Get notified · more bot ideas
Coming soon: custom bots
We are preparing a service to code, backtest and automate trading and statistics bots to your own rules. It is not available yet: follow our Telegram channel to know when it opens.