Administrator
2024-05-27 26f288e11e1c890d0711db498d77fe60eaa8a8e6
bug修复
4个文件已修改
51 ■■■■ 已修改文件
code_attribute/code_volumn_manager.py 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/code_volumn_manager.py
@@ -7,6 +7,7 @@
# yesterday 昨天的量
import json
from code_attribute import gpcode_manager
from db.redis_manager_delegate import RedisUtils
from log_module import async_log_util
from utils import global_util, tool
@@ -20,7 +21,7 @@
# 设置历史量
def set_histry_volumn(code, max60, yesterday, max60_day, max60_day_count):
    redis = __redis_manager.getRedis()
    global_util.max60_volumn[code] = (max60, max60_day,max60_day_count)
    global_util.max60_volumn[code] = (max60, max60_day, max60_day_count)
    global_util.yesterday_volumn[code] = yesterday
    try:
        RedisUtils.setex_async(0, "volumn_max60-{}".format(code), tool.get_expire(),
@@ -153,5 +154,28 @@
        RedisUtils.realse(redis)
__reference_volume_as_money_y_dict = {}
def get_reference_volume_as_money_y(code):
    """
    返回参考量今日对应的金额(单位为亿)
    @param code:
    @return:
    """
    if code in __reference_volume_as_money_y_dict:
        return __reference_volume_as_money_y_dict.get(code)
    max60, yesterday = get_histry_volumn(code)
    if max60:
        num = max60[0]
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        if limit_up_price:
            money_y = round((num * float(limit_up_price)) / 1e8, 1)
            __reference_volume_as_money_y_dict[code] = money_y
            return money_y
    # 默认为5亿
    return 5
if __name__ == "__main__":
    print(get_volume_rate("000059"))
l2/cancel_buy_strategy.py
@@ -271,16 +271,13 @@
        """
        max60, yesterday = code_volumn_manager.get_histry_volumn(code)
        if max60:
            num = max60[0]
            limit_up_price = gpcode_manager.get_limit_up_price(code)
            if limit_up_price:
                money_y = round((num * float(limit_up_price)) / 1e8, 1)
                money = int(200 * money_y + 280)
                if tool.trade_time_sub(place_order_time_str, "10:00:00") <= 0:
                    # 10点前下单打7折
                    money = int(money * 0.7)
                count = int(money_y * 10) // 10 + 3
                return money, count
            money_y = code_volumn_manager.get_reference_volume_as_money_y(code)
            money = int(200 * money_y + 280)
            if tool.trade_time_sub(place_order_time_str, "10:00:00") <= 0:
                # 10点前下单打7折
                money = int(money * 0.7)
            count = int(money_y * 10) // 10 + 3
            return money, count
        # 默认值
        return 300, 3
l2/l2_data_manager_new.py
@@ -2315,6 +2315,12 @@
                    elif code.find("60") == 0:
                        # 上证安全笔数为3
                        safe_count = 3
            if code.find("00") == 0:
                money_y = code_volumn_manager.get_reference_volume_as_money_y(code)
                # 大于8亿的安全笔数必须有8笔
                if money_y >= 8:
                    safe_count = 8
            if buy_count < safe_count:
                not_buy_msg = f"【{i}】安全笔数不足,{buy_count}/{safe_count}"
                continue
trade/huaxin/huaxin_trade_server.py
@@ -1582,7 +1582,7 @@
                                can_buy_result = CodePlateKeyBuyManager.can_buy(code)
                                if can_buy_result:
                                    if can_buy_result[0]:
                                        fdata['block'] = ",".join([f"{x[0]}-({x[1]+1},{x[2]})" for x in can_buy_result[0]])
                                        fdata['block'] = ",".join([f"{x[0]}-{x[1]+1},({x[2]}&{x[3]-x[2]})" for x in can_buy_result[0]])
                                    else:
                                        if can_buy_result[1]:
                                            if limit_up_data: