As you’ve heard on the pod­cast, I’ve been using Chat­G­PT to write scripts to auto­mate a lot of my work. One of the scripts that I thought might help our club mem­bers is the one I use to auto­mate sen­ti­ment checks. It has saved me a ton of time when I’m doing the check­list.

I record­ed the below video that explains how it works and how you can mod­i­fy it for your own pur­pos­es.

It will require some mod­i­fi­ca­tions to the script, which might be scary if you’re not a coder, but trust me, you can use GPT to help you. It will require a GPT sub­scrip­tion (so you get access to the lat­est mod­el, GPT4-Tur­bo, cur­rent­ly $20 USD / month, and far bet­ter than the ear­li­er mod­els) but just can­cel it after the first month if you don’t feel you have future use for it. That said, I’m using GPT all day, every day, so I think it’s a bar­gain.

Steps To Fol­low

  1. Watch the video.
  2. Down­load my script.
  3. Set up the two Google Sheets you’ll need. One is to store the stock codes you want to check, the oth­er is the Bret­ta­la­tor.
  4. Make sure you cre­ate the nec­es­sary per­mis­sions on each sheet so the python script can access them. Ask GPT how to go about that.
  5. If you want to cre­ate the IFTTT noti­fi­ca­tions so you get updates on the sta­tus of the script, set up an IFTTT account and ask GPT how to mod­i­fy the noti­fi­ca­tion sec­tion of my script to work in your com­put­ing / mobile device envi­ron­ment.
  6. If you don’t already have python installed on your com­put­er, ask GPT for help installing it. It’s free.
  7. Get GPT to walk you through the script mod­i­fi­ca­tion process and then ask it for help to test it on your com­put­er.
  8. If the script fails, and it prob­a­bly will at first, just post the error mes­sage into GPT and ask it to help you debug. I had to go through that loop a few times before I got it to run suc­cess­ful­ly. Have patience. It’s worth it in the end.

If you have any prob­lems, let me know. And also let me know if it works for you.

Here’s GPT’s list of steps that was cre­at­ed in the video. If this is all gob­bledy­gook to you, just ask GPT to break down each step in to sim­pler lan­guage.

  1. Python Envi­ron­ment: Ensure you have Python installed on your com­put­er. This script looks like it’s writ­ten in Python, so you’ll need the Python inter­preter to run it.
  2. Install Required Libraries:
    • You’ll need to install the gspread, oauth2client, googleapiclient, and requests libraries if they’re not already installed. You can do this using pip, Python’s pack­age man­ag­er, with the com­mand: pip install gspread oauth2client google-api-python-client requests.
  3. Google Sheets API Access:
    • You’ll need to set up access to the Google Sheets API. This involves cre­at­ing a project in the Google Devel­op­ers Con­sole, enabling the Sheets API for that project, and cre­at­ing ser­vice account cre­den­tials.
    • Down­load the JSON key file for your ser­vice account and replace the path in the script (/Users/cameron/Library/CloudStorage/Dropbox-Personal/Scripts/motherlode-gmail-api-fcee55f8d825.json) with the path to your down­loaded key file.
  4. IFTTT Web­hook:
    • If you want to use the IFTTT noti­fi­ca­tion fea­ture, set up an IFTTT account and cre­ate a web­hook applet. Get your web­hook URL and replace the exist­ing URL in the send_ifttt_notification func­tion with your URL.
  5. Google Sheets URLs:
    • Replace the URLs in the client.open_by_url() calls with the URLs of the Google Sheets doc­u­ments you want to inter­act with. Make sure your ser­vice account has edit access to these sheets.
  6. Update File Paths:
    • The script writes debug infor­ma­tion to a file (/Users/cameron/Library/CloudStorage/Dropbox-Personal/Scripts/debug_output_ASX.txt). Change this file path to a loca­tion on your com­put­er where you want to save the debug infor­ma­tion.
  7. Review and Under­stand the Code:
    • Before run­ning the script, make sure you under­stand what each part of the script does, espe­cial­ly the parts that write to or mod­i­fy your Google Sheets. You might need to adjust indices or column/row num­bers based on the struc­ture of your sheets.
  8. Run the Script:
    • Once every­thing is set up, you can run the script. If you’re doing this from the com­mand line, nav­i­gate to the direc­to­ry con­tain­ing the script and run python script_name.py, replac­ing script_name.py with the name of your Python script file.

Remem­ber, it’s cru­cial to under­stand what the script does before run­ning it, as it has the capa­bil­i­ty to mod­i­fy data in your Google Sheets and send noti­fi­ca­tions via IFTTT.

Secret Link