Administrator
2023-10-11 b36028a64436abbc5e9ef06cfaa2d92555799142
交易记录日志优化
2个文件已修改
16 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
output/code_info_output.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -1035,7 +1035,7 @@
        time_space = tool.trade_time_sub(total_data[start_index]["val"]["time"],
                                         total_data[buy_exec_index]["val"]["time"])
        # 守护S撤以外的数据
        if time_space <= constant.L_CANCEL_START_TIME or int(tool.get_now_time_str().replace(":", "")) > int("145000"):
        if time_space <= constant.L_CANCEL_START_TIME or int(tool.get_now_time_str().replace(":", "")) > int("145700"):
            return False, None, ""
        # 下单位临近撤
        can_cancel, cancel_data = False, None
output/code_info_output.py
@@ -364,14 +364,15 @@
                    extra_datas.append(f"M值:{money_desc(data['m_val'])}")
                    extra_datas.append(f"安全笔数:{data['safe_count']}")
                    records_new_data.append((time_, "", "-------------------------", []))
                    records_new_data.append((time_, "下单",
                                             f"【{format_l2_data(total_datas[data['buy_single_index']])}】-【{format_l2_data(total_datas[data['buy_exec_index']])}】",
                                             data))
                                             extra_datas))
                elif type == trade_record_log_util.TYPE_REAL_PLACE_ORDER_POSITION:
                    for i in range(data['index'], 0, -1):
                        if total_datas[i]['val']['num'] * float(total_datas[i]['val']['price']) >= 3000:
                            records_new_data.append(
                                (time_, "实际挂单位", f"【{format_l2_data(total_datas[i])}】", None))
                                (time_, "实际挂单位", f"【{format_l2_data(total_datas[i])}】", []))
                            break
                elif type == trade_record_log_util.TYPE_CANCEL_WATCH_INDEXES:
@@ -394,17 +395,18 @@
                        elif cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_S:
                            records_new_data.append((time_, "S撤囊括", desc, indexes_data))
                elif type == trade_record_log_util.TYPE_FORBIDDEN_BUY:
                    records_new_data.append((time_, "加入黑名单", f"原因:{data['msg']}", None))
                    records_new_data.append((time_, "加入黑名单", f"原因:{data['msg']}", []))
                elif type == trade_record_log_util.TYPE_CANT_PLACE_ORDER:
                    records_new_data.append((time_, "不能下单", f"原因:{data['msg']}", None))
                    records_new_data.append((time_, "不能下单", f"原因:{data['msg']}", []))
                elif type == trade_record_log_util.TYPE_CANCEL:
                    records_new_data.append((time_, "撤单", f"原因:{data['msg']}", None))
                    records_new_data.append((time_, "撤单", f"原因:{data['msg']}", []))
            if records_new_data:
                for d in records_new_data:
                    records_new.append(f"【{d[0]}】" + "{:<10}".format(f'【{d[1]}】') + d[2])
        except Exception as e:
            logging.exception(e)
    records_new.reverse()
    records_new_data.reverse()
    return break_time, records_new, records_new_data