From 045a5aa6434da6e83c3d850b17e7e58cd7b55ef5 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 15 五月 2023 15:46:32 +0800 Subject: [PATCH] 开盘啦板块影响交易逻辑 --- code_data_util.py | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/code_data_util.py b/code_data_util.py index 2821c4a..2e64bd9 100644 --- a/code_data_util.py +++ b/code_data_util.py @@ -7,8 +7,7 @@ import time import gpcode_manager -import mysql_data -import redis_manager +from db import mysql_data, redis_manager import tool _redisManager = redis_manager.RedisManager(0) @@ -16,6 +15,8 @@ # 浠g爜瀵瑰簲鐨勪环鏍兼槸鍚︽纭� def is_same_code_with_price(code, price): + if code == '600066': + print('杩涘叆璋冭瘯') # 鏄ㄦ棩鏀剁洏浠� price_close = gpcode_manager.get_price_pre(code) max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("1.1")) @@ -24,12 +25,13 @@ return True return False + # 鑷敱娴侀�氳偂鏈伐鍏风被 class ZYLTGBUtil: @classmethod def save(cls, code, val, unit): redis = _redisManager.getRedis() - redis.setex("zyltgb-{}".format(code), 60 * 60 * 24 * 10, + redis.setex("zyltgb-{}".format(code), tool.get_expire(), round(float(val) * 100000000) if int(unit) == 0 else round( float(val) * 10000)) @@ -61,3 +63,10 @@ mysqldb.execute( "update ths_zylt set zyltgb='{}',zyltgb_unit={},update_time={} where _id='{}'".format( data["zyltgb"], data["zyltgb_unit"], round(time.time() * 1000), data["code"])) + + +if __name__ == "__main__": + redis = _redisManager.getRedis() + keys = redis.keys("zyltgb-*") + for key in keys: + redis.delete(key) -- Gitblit v1.8.0