Browse Source

恢复服务器自动下载数据

daniel-ali 2 years ago
parent
commit
9e2e11b25e
1 changed files with 8 additions and 8 deletions
  1. 8 8
      QMT/download_data.py

+ 8 - 8
QMT/download_data.py

@@ -61,12 +61,12 @@ if __name__ == '__main__':
     eng_b = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks?charset=utf8')
     eng_f = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_front?charset=utf8')
 
-    download_data(stocks, eng_b, eng_f)
+    # download_data(stocks, eng_b, eng_f)
 
-    # scheduler = BlockingScheduler()
-    # scheduler.add_job(func=download_data, trigger='cron', hour='15', minute='45', args=[stocks, eng_b, eng_f],
-    #                   timezone="Asia/Shanghai")
-    # try:
-    #     scheduler.start()
-    # except (KeyboardInterrupt, SystemExit):
-    #     pass
+    scheduler = BlockingScheduler()
+    scheduler.add_job(func=download_data, trigger='cron', hour='15', minute='45', args=[stocks, eng_b, eng_f],
+                      timezone="Asia/Shanghai")
+    try:
+        scheduler.start()
+    except (KeyboardInterrupt, SystemExit):
+        pass