Administrator
2024-11-05 07aecbafd7397b0aaa5d18edc697b64e8c62d454
排1优化
2个文件已修改
52 ■■■■ 已修改文件
servers/huaxin_trade_server.py 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py
@@ -368,15 +368,14 @@
        for d in datas:
            if gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(d[0]):
                # 09:19:50 到 09:20:00判断是否要撤单
                if int("091950") <= tool.get_now_time_as_int() < int("092000"):
                if int("091950") <= int(d[9].replace(":", "")) < int("092000"):
                    async_log_util.info(logger_debug, f"排1撤单:{d}")
                    if d[8]*d[5] < 1e8:
                    if d[8] * d[5] < 1e8:
                        code = d[0]
                        current_delegates = DelegateRecordManager().list_current_delegates(code)
                        if current_delegates:
                            for c in current_delegates:
                                huaxin_trade_api.cancel_order(1, code, c["orderSysID"])
    # 获取L1现价
    @classmethod
@@ -943,11 +942,34 @@
                pass
def __subscript_fixed_codes_l2():
    """
    订阅固定代码的L2数据
    @return:
    """
    codes = gpcode_manager.BuyOpenLimitUpCodeManager().get_codes()
    add_datas = []
    for code in codes:
        limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
        if not limit_up_price:
            init_data_util.re_set_price_pre(code)
            limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
        min_volume = int(round(50 * 10000 / limit_up_price))
        # 传递笼子价
        add_datas.append(
            # (代码, 最小量, 涨停价,影子订单价格,买量, 特殊价格)
            (code, min_volume, limit_up_price, round(tool.get_shadow_price(limit_up_price), 2),
             tool.get_buy_volume(limit_up_price),
             [tool.get_buy_volume_by_money(limit_up_price, x) for x in constant.AVAILABLE_BUY_MONEYS]))
    huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.push(add_datas, 0)
# 做一些初始化的操作
def __init():
    def run_pending():
        schedule.every().day.at("15:10:00").do(zyltgb_util.update_all_zylt_volumes)
        schedule.every().day.at("01:25:01").do(__test_pre_place_order)
        schedule.every().day.at("01:02:00").do(__test_pre_place_order)
        schedule.every().day.at("09:10:00").do(__subscript_fixed_codes_l2)
        schedule.every().day.at("08:00:01").do(history_k_data_manager.update_history_k_bars)
        schedule.every().day.at("08:30:01").do(history_k_data_manager.update_history_k_bars)
        schedule.every().day.at("09:00:01").do(history_k_data_manager.update_history_k_bars)
third_data/code_plate_key_manager.py
@@ -1601,17 +1601,17 @@
                    msges.append(f"【{b}】:{result[1]}")
            fmsges.append("板块回封判断##" + ",".join(msges))
        # 如果能扫入就需要获取代码在板块中的身位
        if can_buy_blocks:
            excude_codes = set()
            if kpl_data_constant.open_limit_up_code_dict_for_radical_buy:
                excude_codes |= kpl_data_constant.open_limit_up_code_dict_for_radical_buy.keys()
            # 剔除开1的代码
            for b in keys_:
                history_index, history_before_codes_info = cls.__get_history_index(code, b, yesterday_limit_up_codes,
                                                                                   excude_codes)
                if history_index >= 4:
                    return set(), f"在【{b}】中身位({history_index + 1})靠后"
        # 如果能扫入就需要获取代码在板块中的身位,此规则暂时不生效
        # if can_buy_blocks:
        #     excude_codes = set()
        #     if kpl_data_constant.open_limit_up_code_dict_for_radical_buy:
        #         excude_codes |= kpl_data_constant.open_limit_up_code_dict_for_radical_buy.keys()
        #     # 剔除开1的代码
        #     for b in keys_:
        #         history_index, history_before_codes_info = cls.__get_history_index(code, b, yesterday_limit_up_codes,
        #                                                                            excude_codes)
        #         if history_index >= 4:
        #             return set(), f"在【{b}】中身位({history_index + 1})靠后"
        return can_buy_blocks, " **** ".join(fmsges)