Administrator
6 天以前 abd510d66074ac640555c241b6343a53cca8f070
l2_data_util.py
@@ -28,30 +28,44 @@
# 是否为大单
def is_big_money(val):
def is_big_money(val, is_ge=False):
    """
    判断是否为大单
    @param val: l2数据
    @param is_ge: 是否为创业板
    @return:
    """
    price = float(val["price"])
    money = price * val["num"]
    if price > 3.0:
        if money >= 30000:
    money = round(price * val["num"], 2)
    if is_ge:
        if money >= 29900 or val["num"] >= 2999:
            return True
        else:
            return False
    else:
        max_money = price * 10000
        if money >= max_money * 0.95:
            return True
        if price > 3.0:
            if money >= 29900 or val["num"] >= 7999:
                return True
            else:
                return False
        else:
            return False
            max_money = price * 10000
            if money >= max_money * 0.95:
                return True
            else:
                return False
# 获取大资金的金额
def get_big_money_val(limit_up_price):
    if limit_up_price > 3.0:
        return 300 * 10000
def get_big_money_val(limit_up_price, is_ge=False):
    if is_ge:
        return min(299 * 10000, round(limit_up_price * 2900 * 100))
    else:
        max_money = limit_up_price * 10000
        return max_money * 0.95
        if limit_up_price > 3.0:
            return min(299 * 10000, round(limit_up_price * 7999 * 100))
        else:
            max_money = limit_up_price * 10000 * 100
            return int(max_money * 0.95)
# if int(val["num"]) >= constant.BIG_MONEY_NUM:
#     return True
@@ -179,13 +193,13 @@
        if abs(get_time_as_seconds(time_str) - get_time_as_seconds(time_)) > 3:
            continue
        if same_time_nums[time_] > 20:
            RedisUtils.setex(l2_data_manager._redisManager.getRedis(), "big_data-{}-{}".format(code, int(round(time.time() * 1000))), tool.get_expire(),
            RedisUtils.setex(l2_data_manager._redisManager.getRedis(),
                             "big_data-{}-{}".format(code, int(round(time.time() * 1000))), tool.get_expire(),
                             d1)
            break
# 保存l2最新数据的大小
# TODO 测试数据
# @async_call
def save_l2_latest_data_number(code, num):
    RedisUtils.setex(l2_data_manager._redisManager.getRedis(), "l2_latest_data_num-{}".format(code), 3, num)
@@ -193,13 +207,13 @@
# 获取最新数据条数
def get_l2_latest_data_number(code):
    num =RedisUtils.get(l2_data_manager._redisManager.getRedis(), "l2_latest_data_num-{}".format(code))
    num = RedisUtils.get(l2_data_manager._redisManager.getRedis(), "l2_latest_data_num-{}".format(code))
    if num is not None:
        return int(num)
    return None
# l2数据拼接工具 TODO 暂时还未启用
# l2数据拼接工具  暂时还未启用
class L2DataConcatUtil:
    # 初始化