1 Star 0 Fork 12

rizheng213/stock_robot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update.py 1013 Bytes
一键复制 编辑 原始数据 按行查看 历史
邹吉华 提交于 2023-04-12 16:27 . 1.6
import threading
from runtime import StockRuntime
from data_center import DataCenter
import datetime
def thread_Timer(data_center):
runtime = StockRuntime()
now_time = datetime.date.today()
all_stock = data_center.query_all_stock(now_time.strftime('%Y-%m-%d'))
#all_stock = bs.get_all_stock('2022-06-27')
predict = data_center.get_predict_date()
update_stock = []
for i in range(len(all_stock)):
item = all_stock[i]
if item in predict.keys() :
predict_time = predict[item]
if predict_time < now_time :
update_stock.append(item)
else:
update_stock.append(item)
if runtime.update(update_stock):
timer = threading.Timer(72000, thread_Timer,data_center)
else:
timer = threading.Timer(600, thread_Timer,data_center)
timer.start()
if __name__ == "__main__":
data_center = DataCenter()
timer = threading.Timer(1, thread_Timer,data_center)
timer.start()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/rizheng213/stock_robot.git
git@gitee.com:rizheng213/stock_robot.git
rizheng213
stock_robot
stock_robot
master

搜索帮助