Administrator
2023-11-07 93fde21f8d713cce62479dac9a1eb74f13bcdc83
bug修复
5个文件已修改
23 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/transaction_progress.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log_export.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/l2_trade_test.py 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -1293,7 +1293,7 @@
            logger_l2_l_cancel.exception(e)
            raise e
        extra_msg = "L后"
        if not can_cancel:
        if not can_cancel and int(tool.get_now_time_str().replace(":", "")) > int("100000"):
            # 成交位临近撤
            try:
                can_cancel, cancel_data = self.__compute_near_by_trade_progress_need_cancel(code, buy_exec_index,
l2/l2_data_manager_new.py
@@ -1088,7 +1088,7 @@
                        thresh_hold_num = m_base_val // (float(gpcode_manager.get_limit_up_price(code)) * 100)
                        # 真实下单位到成交位置的纯买额
                        total_num = 0
                        for i in range(trade_index + 1, order_begin_pos.buy_single_index):
                        for i in range(trade_index + 1, buy_single_index):
                            data = total_datas[i]
                            val = data["val"]
                            if not L2DataUtil.is_limit_up_price_buy(val):
@@ -1391,7 +1391,7 @@
                # 有过闪电下单
                # 总卖的一半作为m值
                threshold_num = int(sell_data[1] / (limit_up_price * 100)) // 2
                threshold_max_num = 0
                threshold_max_num = 1
        if not threshold_num:
            # 目标手数
l2/transaction_progress.py
@@ -189,7 +189,7 @@
    def set_traded_index(self, code, index, total_datas = None):
        last_info = self.latest_buy_progress_index_cache.get(code)
        if not last_info or last_info[0] != index:
            if last_info:
            if last_info and total_datas:
                val = total_datas[last_info[0]]['val']
                rate = round(val["num"] * float(val["price"]) * 100 / (time.time() - last_info[1]))
                # 成交速率
log_module/log_export.py
@@ -415,9 +415,8 @@
if __name__ == '__main__':
    datas = load_l2_market_data()
    for d in datas:
        print(d)
    datas = get_trade_progress("000026")
    print(datas)
    # print(get_h_cancel_compute_info("603912"))
    # logger_l2_h_cancel.info("test")
test/l2_trade_test.py
@@ -87,7 +87,7 @@
    def test_trade(self):
        threading.Thread(target=async_log_util.run_sync, daemon=True).start()
        code = "600203"
        code = "000026"
        clear_trade_data(code)
        l2.l2_data_util.load_l2_data(code)
        total_datas = deepcopy(l2.l2_data_util.local_today_datas[code])
@@ -136,6 +136,7 @@
        # 获取交易进度
        trade_progress_list, buy_queues = log_export.get_trade_progress(code)
        trade_progress_list.reverse()
        # jingxuan_ranks = KPLDataManager().get_from_file(kpl_util.KPLDataType.JINGXUAN_RANK, tool.get_now_date_str())
        # industry_ranks = KPLDataManager().get_from_file(kpl_util.KPLDataType.INDUSTRY_RANK, tool.get_now_date_str())
        # RealTimeKplMarketData().set_top_5_reasons(jingxuan_ranks)
@@ -175,7 +176,7 @@
            print("----------------处理位置", indexs)
            for l2_m in l2_market_datas:
                if l2_m["dataTimeStamp"] < int(total_datas[indexs[0]]["val"]["time"].replace(":", "")):
                if int(str(l2_m["dataTimeStamp"])[:-3]) < int(total_datas[indexs[0]]["val"]["time"].replace(":", "")):
                    time_str = f"{l2_m['dataTimeStamp']}"
                    if time_str.startswith("9"):
                        time_str = "0" + time_str
@@ -185,6 +186,11 @@
                                                                      l2_m["totalAskVolume"] * l2_m["avgAskPrice"])
                    break
            for tp in trade_progress_list:
                if int(tp[1].replace(":", "")) < int(total_datas[indexs[0]]["val"]["time"].replace(":", "")):
                    TradeBuyQueue().set_traded_index(code, tp[0])
                    break
            l2.l2_data_manager_new.L2TradeDataProcessor.process_add_datas(code, total_datas[indexs[0]:indexs[1] + 1], 0,
                                                                          0)