Administrator
2024-05-28 517f6c8ce6c68bfcd652ceeb7b79f79408dfec76
注释NB撤/bug修改/手动拉黑前撤单/
5个文件已修改
49 ■■■■ 已修改文件
l2/l2_transaction_data_processor.py 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/l2_trade_test.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_result_manager.py 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_transaction_data_processor.py
@@ -150,13 +150,13 @@
                    cancel_result = FCancelBigNumComputer().need_cancel_for_deal_fast(code, buy_progress_index)
                    if cancel_result[0]:
                        L2TradeDataProcessor.cancel_buy(code, f"F撤:{cancel_result[1]}")
                    if not cancel_result[0]:
                        try:
                            cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
                            if cancel_result[0]:
                                L2TradeDataProcessor.cancel_buy(code, f"大市值无大单撤:{cancel_result[1]}")
                        except:
                            pass
                    # if not cancel_result[0]:
                    #     try:
                    #         cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
                    #         if cancel_result[0]:
                    #             L2TradeDataProcessor.cancel_buy(code, f"大市值无大单撤:{cancel_result[1]}")
                    #     except:
                    #         pass
                    if not cancel_result[0] and buy_progress_index_changed:
                        try:
test/l2_trade_test.py
@@ -235,7 +235,7 @@
    # @unittest.skip("跳过此单元测试")
    def test_block(self):
        code = "002055"
        code = "001376"
        # KPLCodeJXBlockManager().load_jx_blocks(code, 23.52,23.62,
        #                                        kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reasons())
        #
@@ -254,6 +254,13 @@
                                                     latest_current_limit_up_records,
                                                     block_info.get_before_blocks_dict(),
                                                     kpl_data_manager.KPLLimitUpDataRecordManager.get_current_limit_up_reason_codes_dict())
        can_buy_result = CodePlateKeyBuyManager.can_buy(code)
        print(can_buy_result)
        if can_buy_result:
            if can_buy_result[0]:
                blocks = ",".join([f"{x[0]}-{x[1] + 1}({x[2]}&{x[3] - x[2]})" for x in can_buy_result[0]])
                print(blocks)
        # l2.l2_data_manager_new.L2TradeDataProcessor.can_buy_first(code, None)
    @unittest.skip("跳过此单元测试")
third_data/code_plate_key_manager.py
@@ -699,7 +699,7 @@
        block_codes_records = set()
        if limit_up_record_datas:
            for k in limit_up_record_datas:
                if code_limit_up_reasons_dict.get(k[3]) == block:
                if block in code_limit_up_reasons_dict.get(k[3]):
                    block_codes_records.add(k[3])
        if not block_codes:
@@ -759,7 +759,7 @@
        if current_shsz_rank < len(current_open_limit_up_codes) + max_rank:
            return True, False, f"【{block}】前排代码:{current_shsz_rank}", is_strong_block, is_active_buy, current_shsz_rank, len(
                block_codes),len(block_codes_records)
                block_codes), len(block_codes_records)
        else:
            return False, False, f"【{block}】前排代码:{front_current_shsz_rank_codes} 超过{len(current_open_limit_up_codes) + max_rank}个", is_strong_block, is_active_buy, current_shsz_rank, len(
                block_codes), len(block_codes_records)
@@ -814,7 +814,8 @@
                current_limit_up_block_codes_dict,
                high_level_code_blocks=high_level_general_code_blocks,
                high_level_block_codes=high_level_general_block_codes)
            fresults.append((block, can_buy, unique, msg, is_strong, is_active_buy, current_rank, block_limit_up_count, block_limit_up_record_count))
            fresults.append((block, can_buy, unique, msg, is_strong, is_active_buy, current_rank, block_limit_up_count,
                             block_limit_up_record_count))
        return fresults, keys
    # 是否可以下单
@@ -823,7 +824,7 @@
    @classmethod
    def can_buy(cls, code):
        if constant.TEST:
            return [("测试", 0, 1)], True, cls.BLOCK_TYPE_NONE, [], set(), ["化工"]
            return [("测试", 0, 1, 1)], True, cls.BLOCK_TYPE_NONE, [], set(), ["化工"]
        # if True:
        #     # 测试
        #     return True, "不判断板块身位"
trade/huaxin/huaxin_trade_server.py
@@ -875,6 +875,11 @@
                    fresult = {"code": 0, "data": datas}
            elif code_list_type == outside_api_command_manager.CODE_LIST_BLACK:
                if operate == outside_api_command_manager.OPERRATE_SET:
                    # 先手动撤单
                    try:
                        l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code,"手动拉黑")
                    except Exception as e:
                        logger_debug.exception(e)
                    l2_trade_util.forbidden_trade(code, msg="手动加入 trade_server")
                    WantBuyCodesManager().remove_code(code)
                    name = gpcode_manager.get_code_name(code)
@@ -1582,7 +1587,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]}&{x[3]-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:
@@ -1603,8 +1608,13 @@
                                                                                                     real_place_order_index,
                                                                                                     9)
                                    fdata['trade_queue'] = trade_queue
                                # 自由流通股本
                                zyltgb = global_util.zyltgb_map.get(code)
                                if zyltgb is not None:
                                    fdata['zyltgb'] = output_util.money_desc(zyltgb)
                            except:
                                pass
                            fdatas.append(fdata)
                        except Exception as e:
                            logger_debug.exception(e)
trade/trade_result_manager.py
@@ -6,7 +6,7 @@
from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer
from code_attribute.gpcode_manager import MustBuyCodesManager
from l2 import l2_data_manager, place_order_single_data_manager
from l2.cancel_buy_strategy import  FCancelBigNumComputer, \
from l2.cancel_buy_strategy import FCancelBigNumComputer, \
    NewGCancelBigNumComputer, JCancelBigNumComputer, NBCancelBigNumComputer
from l2.l2_data_manager import OrderBeginPosInfo
from l2.l2_data_util import local_today_datas, L2DataUtil
@@ -129,6 +129,9 @@
    if from_real_cancel:
        __latest_cancel_l2_data_dict[code] = total_datas[-1]
    # 撤单成功需要移除红名单
    MustBuyCodesManager().remove_code(code)
# 根据撤单时间判断是否可以下单
def can_place_order_for_cancel_time(code, buy_exec_data):