Create a Telegram Bot to get current stock prices using Python

The Scraper Guy
3 min readJan 3, 2025

Easy method to create a telegram bot to get current price of any stock ticker

Introduction

Today we will create a telegram bot that will fetch the current price of any ticker entered by the user. This is an straightforward tutorial meant to ease you into telegram bot development.

Bot Setup

To begin make sure you have a telegram account. Search for “@botfather” on telegram.

Start a conversation with this account and type /newbot to start the setup for the bot. Go through all of the steps and make sure to take note of your token!

Code Walkthrough

Now to the code. Firstly pip install the telegram API wrapper library we will use.

pip install pyTelegramBotAPI

Install yfinance if you have not already.

pip install yfinance

Now import yfinance, pandas and telebot.

import telebot
import yfinance as yf
import pandas as pd

--

--

The Scraper Guy
The Scraper Guy

No responses yet