Stock Checker & emailer v20

AUGUST 2025 - newer, easier way to setup

CHANGED TO FINNHUB AS THE FREE STOCK LOOKUP SITE SINCE IT HAS LESS RESTRICTIONS - NO THROTTLING & 60 CALLS PER MINUTE.

1) you need to sign up for a free API key. fill in name & email.

         https://finnhub.io

2) add your new api key to your hide.py file

sendEmail = "SendingGmailHere@gmail.com"
sendAppPssd = "AppPasswordGoesHere"
recEmail = "ReceivingGmailHere@gmail.com"
finnhub_api_key = "PutYourAPI_KeyHere"

3) open a terminal shell. navigate to where your new v20 script is located. activate your virtual environment

cd to the directory where your python script lives

:: CREATE THE VENV

$ python3 -m venv env

:: ACTIVATE THE VENV

$ source env/bin/activate

=========================================

UPDATE 04/2024 <————— COOL!!!

>> RUN PYTHON SCRIPTS AUTOMATICALLY DAILY AT CERTAIN TIME <<

SEE INSTRUCTIONS BELOW

FOLLOW INSTRUCTIONS BELOW TO CREATE THE APP PASSWORD NEEDED TO SEND GMAILS VIA PYTHON SCRIPT

========

Really cool & useful python script I wrote that checks your stock portfolio & sends an email of your daily gain/loss. Just run the script daily & check your email

  • Need to have a Gmail Account as the sender email.

  • 2023 Google’s new security settings require you to set 2-Step Verification.

    • Settings/Security/2-Step Verification/App Passwords - Other -> create new 16 character App Password

  • Edit hide.py with new App Password credentials.

  • Edit stocks.csv with stock tickers & number of share. Keep the same “AAPL” (capital letters & quotations) format to tickers. DO NOT HAVE A BLANK SPACE AT THE BOTTOM. NO RETURN AFTER LAST STOCK ENTRY!

    • update the path from StockCheck_v06.py to your current script (StockCheck_v20.py)

    • stockCheckerEmailer_v20.py, hide.py & stocks.csv need to be in the same directory.

    • DO NOT RENAME SCRIPTS OR CSV FILE! main script imports ‘hide.py’ & ‘stocks.csv’

Create this AppleScript(change the path to your path !!)& put it in the script directory so it shows up on the top shelf.

Just click on this button & it will run (use this in place of the Nuitka standalone app workflow shown in the video).

NOTE : Need to enclose path in backslashes if there are spaces in the path.

ALSO NEED TO CREATE A VIRTUAL ENV FOR THIS SCRIPT & ACTIVATE IT AS ABOVE.

For step-by-step instructions on how to create & activate the venv - see PERSONAL/GAMES/JELLYBEAN calculator movie

2025-YOU NO LONGER NEED TO CREATE A STANDALONE APP IN NUITKA.

No longer need to create a Standalone app via Nuitka. You can just link to the Python script via AppleScript.


RUN PYTHON/APPLE SCRIPTS AUTOMATICALLY DAILY

Here is a really cool way to automatically execute a Python script daily at a specific time. this example executes my StockCheckEmail script to email me my portfolio gain/loss 2 hours after the markets open so i can see how things are going & if i need to log in & handle anything.

==========AUTOMATOR==========

  • Create / New / Application

  • Add “Run AppleScript”

  • Copy/Paste your Apple Script you made above : StockCheck_app.scpt

==========CALENDAR==========

  • Create / New Event

  • Starts : For just the setup process - set the time for 2 minutes from now. that way you can “Allow” Permissions now & then it will go off automatically from then on without needing intervention.

  • Alert : Custom / Open File / Other - Navigate to your Application (you just created above)

  • Repeat / Custom / Check ON the days you want this to execute

  • Save & wait for it to execute in 2 minutes.

  • A popup window should appear asking for your permission to perform the actions in the app.

  • click “ALLOW”

  • >> NOW SET THE TIME & DAYS TO WHEN YOU ACTUALLY WANT THIS SCRIPT TO EXECUTE