20250408修改

This commit is contained in:
2025-04-09 17:18:30 +08:00
parent f925dff46b
commit aaf2224484
146 changed files with 157794 additions and 5718 deletions

View File

@@ -0,0 +1,43 @@
from datetime import datetime, timedelta
# 加入邮件通知
import smtplib
from email.mime.text import MIMEText # 导入 MIMEText 类发送纯文本邮件
from email.mime.multipart import MIMEMultipart # 导入 MIMEMultipart 类发送带有附件的邮件
from email.mime.application import MIMEApplication # 导入 MIMEApplication 类发送二进制附件
## 配置邮件信息
receivers = ["*****@qq.com"] # 设置邮件接收人地址
subject = "订单流策略交易信号" # 设置邮件主题
#text = " " # 设置邮件正文
# file_path = "test.txt" # 设置邮件附件文件路径
## 配置邮件服务器信息
smtp_server = "smtp.qq.com" # 设置发送邮件的 SMTP 服务器地址
smtp_port = 465 # 设置发送邮件的 SMTP 服务器端口号,一般为 25 端口 465
sender = "***@qq.com" # 设置发送邮件的邮箱地址
username = "***@@qq.com" # 设置发送邮件的邮箱用户名
password = "osjyjmbqrzxtbjbf" #zrmpcgttataabhjh设置发送邮件的邮箱密码或授权码
def send_mail(text):
msg = MIMEMultipart()
msg["From"] = sender
msg["To"] = ";".join(receivers)
msg["Subject"] = subject
msg.attach(MIMEText(text, "plain", "utf-8"))
smtp = smtplib.SMTP_SSL(smtp_server, smtp_port)
# smtp = smtplib.SMTP_SSL(smtp_server)
smtp.login(username, password)
smtp.sendmail(sender, receivers, msg.as_string())
smtp.quit()
# 获取当前时间
now = datetime.now()
# 判断当前时间是否为15:30:00
if now.strftime('%H:%M:%S') == '15:30:00':
print("当前时间是15:30:00。")
send_mail("当前时间是21:45:00")
else:
print("当前时间不是15:30:00。")
send_mail("当前时间不是是21:45:00")