|
@@ -5,6 +5,7 @@ import math
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy import create_engine
|
|
import multiprocessing as mp
|
|
import multiprocessing as mp
|
|
import os
|
|
import os
|
|
|
|
+from apscheduler.schedulers.blocking import BlockingScheduler
|
|
|
|
|
|
|
|
|
|
pd.set_option('display.max_columns', None) # 设置显示最大行
|
|
pd.set_option('display.max_columns', None) # 设置显示最大行
|
|
@@ -72,12 +73,12 @@ if __name__ == '__main__':
|
|
stocks.sort()
|
|
stocks.sort()
|
|
step = math.ceil(len(stocks) / cpu_count)
|
|
step = math.ceil(len(stocks) / cpu_count)
|
|
|
|
|
|
- download_data(stocks)
|
|
|
|
|
|
+ # download_data(stocks)
|
|
|
|
|
|
- # 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],
|
|
|
|
+ timezone="Asia/Shanghai")
|
|
|
|
+ try:
|
|
|
|
+ scheduler.start()
|
|
|
|
+ except (KeyboardInterrupt, SystemExit):
|
|
|
|
+ pass
|