This is a Python script that uses web scraping to fetch stock prices from MarketWatch and sends the latest updates via Telegram.
- Python 3.7+
requests
modulebeautifulsoup4
modulepython-telegram-bot
module
- Clone this repository:
git clone https://github.com/mrbhanukab/mrstock.git
- Install the required modules:
pip install -r requirements.txt
-
Create a new Telegram bot and obtain its API token. Refer to the official Telegram Bot documentation for instructions.
-
Replace the
TOKEN
variable in themain.py
file with your own Telegram bot API token. -
Run the script:
python main.py
To get your Telegram chat ID, you can use the Telegram User Info Bot:
- Add the Telegram User Info Bot (@userinfobot) to your Telegram contacts.
- Start a chat with the bot and send any message.
- The bot will reply with your chat ID, which you can use in the
chat_id
variable in the Python script.
Note that you should replace the chat_id
variable in the send_message()
function in the main.py
script with your own chat ID obtained from the Telegram User Info Bot.