非交易日不拉数据; 钉钉消息通知到消息通知群; 定时配置使用环境变量
This commit is contained in:
@@ -8,6 +8,7 @@ import schedule
|
||||
import time
|
||||
import traceback
|
||||
from dingtalk import DingTalkBot
|
||||
import os
|
||||
|
||||
|
||||
def get_latest_index_kline_date():
|
||||
@@ -63,8 +64,13 @@ def get_latest_index_kline_date():
|
||||
|
||||
|
||||
def main():
|
||||
webhook = "https://oapi.dingtalk.com/robot/send?access_token=fb70c1561d8beba94b4f11568f4bb15e3ae07ccbdc8ac19676434a9d1cd17546" # 填写你的webhook
|
||||
secret = "SEC1ae7cd2f1a6f9da3611af37da3e7d954c1e8533fc073c6c8cc5e5af3b6e5926b" # 填写你的加签token(如果有),否则留空
|
||||
if datetime.today().weekday() >= 5:
|
||||
logger.info(f"非交易日")
|
||||
return
|
||||
webhook = (
|
||||
"https://oapi.dingtalk.com/robot/send?access_token=21de667159edadd33172c6ec414a2addf9c6359189350ffd36819d2a20e8a0f4",
|
||||
) # 填写你的webhook
|
||||
secret = "SEC43a0fa0b29717f98637a119b92a0bd5f7b2b6da671bdd2bd1279ed8323454d5e"
|
||||
dingtalk = DingTalkBot(webhook, secret)
|
||||
try:
|
||||
db_config = DatabaseConfig()
|
||||
@@ -96,7 +102,8 @@ def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger.info(datetime.now())
|
||||
schedule.every().day.at("16:00").do(main)
|
||||
PULL_SCHEDULE: str = os.getenv("PULL_SCHEDULE", "16:00")
|
||||
schedule.every().day.at(PULL_SCHEDULE).do(main)
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user