Member-only story

Get Email Alerts When Stock Price Hits Target Using Python

The Scraper Guy
3 min readSep 9, 2024

--

Easily get price updates straight to your email when a stock hits a certain price in Python.

Introduction

If you are a busy person like me, you do not have all day to check the stock market. Instead using this tutorial you will be able to setup a portfolio of stocks and price targets and once they hit this price target you will be sent an email to alert you of this.

Firstly, you should consider the stocks and price targets, the most common of which is to buy stocks on the dip i.e. when they are in the red or if they rise above a certain price.

Email Setup

For this tutorial I am going to be using a gmail account to send the emails in Python. We first have to tweak some settings to allow us to send emails via gmail.

Sign into your gmail account in a browser and navigate to Security settings and ensure 2 step authentication is enabled. If its not set it up, otherwise we are good to continue.

Then navigate to app passwords and create a new app password, the name does not matter that much. Copy the generated password. If you have any issues with this checkout this video

https://www.youtube.com/watch?v=g_j6ILT-X0k

Lets head over to the python portion of this tutorial.

Code

Lets import some libraries.

import email
from…

--

--

The Scraper Guy
The Scraper Guy

Written by The Scraper Guy

Teaching You How to Scrape Using Python LinkTree - https://linktr.ee/scrapingguy

Responses (1)