From 1a0be577a89727ef6b80245b6b53c8ddf43ca7d9 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 07 六月 2024 00:37:26 +0800
Subject: [PATCH] 可购买创业板

---
 code_attribute/code_data_util.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/code_attribute/code_data_util.py b/code_attribute/code_data_util.py
index aeb5b98..9d510fd 100644
--- a/code_attribute/code_data_util.py
+++ b/code_attribute/code_data_util.py
@@ -11,6 +11,7 @@
 from db.redis_manager_delegate import RedisUtils
 from utils import tool
 
+__db = 0
 _redisManager = redis_manager.RedisManager(0)
 
 
@@ -20,8 +21,8 @@
         print('杩涘叆璋冭瘯')
     # 鏄ㄦ棩鏀剁洏浠�
     price_close = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
-    max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("1.1"))
-    min_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("0.9"))
+    max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal(tool.get_limit_up_rate(code)))
+    min_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal(tool.get_limit_down_rate(code)))
     if min_price <= decimal.Decimal(str(price)) <= max_price:
         return True
     return False
@@ -29,6 +30,8 @@
 
 # 鑷敱娴侀�氳偂鏈伐鍏风被
 class ZYLTGBUtil:
+    __db = 0
+
     @classmethod
     def save(cls, code, val, unit):
         RedisUtils.setex(_redisManager.getRedis(), "zyltgb-{}".format(code), tool.get_expire(),
@@ -36,6 +39,12 @@
                              float(val) * 10000))
 
     @classmethod
+    def save_async(cls, code, val, unit):
+        RedisUtils.setex_async(cls.__db, "zyltgb-{}".format(code), tool.get_expire(),
+                               round(float(val) * 100000000) if int(unit) == 0 else round(
+                                   float(val) * 10000))
+
+    @classmethod
     def get(cls, code):
         val = RedisUtils.get(_redisManager.getRedis(), "zyltgb-{}".format(code))
         if val is not None:

--
Gitblit v1.8.0