Administrator
2025-02-14 bb1f07248d7a7aafcd172ce3f78b91d0caf82d8f
bug修改
3个文件已修改
78 ■■■■ 已修改文件
huaxin_client/l2_data_manager.py 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_limitup_sell_data_manager.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log_export.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py
@@ -68,23 +68,21 @@
            if item[2] >= filter_condition[0][0]:
                return item
            # 1手的买单满足价格
            if item[2] == 100 and abs(filter_condition[0][2] - item[1]) < 0.001:
                return item
            # if item[2] == 100 and abs(filter_condition[0][2] - item[1]) < 0.001:
            #     return item
            # 买量
            if item[2] == filter_condition[0][3]:
                return item
            # 卖大于2w且是涨停卖
            # if item[3] != '1' and item[2] > filter_condition[0][4] and item[1] == filter_condition[0][1]:
            #     return item
            # 所有的涨停卖
            if item[1] == filter_condition[0][1]:
                if item[3] != '1':
                    # 涨停卖
            if item[3] != '1':
                # 卖与卖撤
                if abs(item[1] - filter_condition[0][1]) < 0.001:
                    # 涨停价
                    return item
                elif item[2] in filter_condition[0][5]:
                    # 涨停满足特殊的手数
            else:
                if item[2] in filter_condition[0][5]:
                    # 特殊手数
                    return item
            return None
        return item
l2/l2_limitup_sell_data_manager.py
@@ -129,31 +129,42 @@
if __name__ == "__main__":
    # 测试涨停总卖吃掉的情况
    code = "000887"
    datas = log_export.load_huaxin_l2_sell_deal(code).get(code)
    code = "000503"
    datas = log_export.load_huaxin_l2_sell_deal_list(code).get(code)
    print(datas)
    deal_datas = []
    deal_order_no = set()
    deal_order_nos = set()
    for i in range(len(datas)):
        if 102245 <= int(datas[i][0].replace(":", "")) <= 102318:
        if 102839 <= int(datas[i][0].replace(":", "")) <= 102845:
            deal_datas.append(datas[i])
    total_deal_volume = sum([x[1] for x in deal_datas])
    for x in deal_datas:
        for xx in x[1]:
            deal_order_nos.add(xx[7])
    total_deal_volume = sum([sum([xx[2] for xx in x[1]]) for x in deal_datas])
    print("涨停卖成交量", total_deal_volume)
    datas = log_export.load_huaxin_l2_sell_delegate(code).get(code)
    fdatas = []
    for x in datas:
        if int("102245") < int(x[0].replace(":", "")) < int("102318"):
            if x[2][0]>=21531404:
                fdatas.append(x)
        # if int("101821") < int(x[0].replace(":", "")) < int("102841"):
        if 20770358 >= x[2][0] >= 18860519:
            fdatas.append(x)
    delegate_order_nos = set()
    total_delegate = 0
    for x in fdatas:
        if x[1] == '卖':
            total_delegate += x[2][2]
            delegate_order_nos.add(x[2][0])
        elif x[1] == '卖撤':
            total_delegate -= x[2][2]
            delegate_order_nos.discard(x[2][0])
    print(fdatas)
    for d in fdatas:
        print(d)
    print("总成交", total_deal_volume, total_deal_volume * 17.28)
    print("总委托", total_delegate, total_delegate * 17.28)
    print("委托剩余", total_delegate-total_deal_volume, (total_delegate-total_deal_volume) * 17.28)
    print("委托剩余", total_delegate - total_deal_volume, (total_delegate - total_deal_volume) * 17.28)
    not_deal_order_nos = delegate_order_nos - deal_order_nos
    for x in not_deal_order_nos:
        print("未成交:", x)
log_module/log_export.py
@@ -578,6 +578,8 @@
                    data = line.split(" - ")[1].strip()
                    if data.startswith("["):
                        data = data[data.find("]") + 1:].strip()
                    if data.find("有涨停主动卖:") < 0:
                        continue
                    data = data.split("有涨停主动卖:")[1]
                    code_ = data[:6]
                    if code and code != code_:
@@ -590,6 +592,33 @@
    return fdatas
@cache_log
def load_huaxin_l2_sell_deal_list(code=None, date=tool.get_now_date_str()):
    path = f"{constant.get_path_prefix()}/logs/huaxin/l2/sell_l2_deal.{date}.log"
    fdatas = {}
    if os.path.exists(path):
        with open(path, 'r', encoding="utf-8") as f:
            lines = f.readlines()
            for line in lines:
                if line:
                    time_str = __get_async_log_time(line)
                    data = line.split(" - ")[1].strip()
                    if data.startswith("["):
                        data = data[data.find("]") + 1:].strip()
                    if data.find("涨停主动买成交:") <0:
                        continue
                    data = data.split("涨停主动买成交:")[1]
                    data = eval(data)
                    code_ = data[0][0]
                    if code and code != code_:
                        continue
                    if code_ not in fdatas:
                        fdatas[code_] = []
                    fdatas[code_].append((time_str, data))
    return fdatas
@cache_log
def load_huaxin_l2_sell_delegate(code=None, date=tool.get_now_date_str()):
    path = f"{constant.get_path_prefix()}/logs/huaxin/l2/sell_l2_delegate.{date}.log"