From ec3de310787e587ce7962d99bef8b16653aefe52 Mon Sep 17 00:00:00 2001 From: sebadmin Date: Wed, 25 Nov 2026 06:42:28 -0500 Subject: [PATCH] added v3 --- GetDailyv3.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 GetDailyv3.py diff --git a/GetDailyv3.py b/GetDailyv3.py new file mode 100644 index 0000000..c4d67af --- /dev/null +++ b/GetDailyv3.py @@ -0,0 +1,69 @@ +#Get stock symbols in a file +#Get daily quote at end of day +#Send email, see Jupyter thing on other laptop for sending email + + +import yfinance as yf +import smtplib, ssl, sys, os, configparser +from email.mime.text import MIMEText +from email.mime.application import MIMEApplication +from email.mime.multipart import MIMEMultipart +from smtplib import SMTP + + +config = configparser.ConfigParser() +config.read("/home/sebadmin/scripts/Stocks/testenvv3.txt") +emailp = config.get("config","mp") + + + +#Yfinance tests +#https://pypi.org/project/yfinance/ + + +data2 = yf.download("CRSR VTI VOO DIS UI TSLA TTWO GME INTC", period="1d") +#print(data2.tail(1)) +#data2.head() +Dayclose = data2["Close"].round(decimals=2) +Dayopen = data2["Open"].round(decimals=2) + + +recipients = ["seb@trudel.xyz"] +emaillist = [elem.strip().split(',') for elem in recipients] +msg = MIMEMultipart() +msg["Subject"] = "Daily Stock report" +msg["From"] = "noreply@toastty.com" + + +html = """\ + + Close + + {0} + + +""".format(Dayclose.to_html()) + +html2 = """\ + + Open + + {0} + + +""".format(Dayopen.to_html()) + +part1 = MIMEText(html, "html") +part2 = MIMEText(html2, "html") +msg.attach(part1) + +context = ssl.create_default_context() +Email_Port = 587 # If you are not using a gmail account, you will need to look up the port for your specific email host +with smtplib.SMTP("mail.smtp2go.com", Email_Port) as server: + server.starttls(context=context) + server.login("toasttycomsmtp2gouser", emailp) # This statement is of the form: server.login(, "Your email password") +# server.sendmail("strudel@pirolian.com", "sebastien.trudel@pirolian.com", Body_of_Email) # This statement is of the form: server.sendmail(, , Body_of_Email) + server.sendmail(msg["From"], emaillist, msg.as_string()) # This statement is of the form: server.sendmail(, , Body_of_Email) + + +