Administrator
2024-03-20 bf7ff7f4140065b5c693444131aea0c299c9c31b
L2数据接口修改
3个文件已修改
13 ■■■■■ 已修改文件
l2/huaxin/huaxin_delegate_postion_manager.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/data_server.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/data_export_util.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/huaxin/huaxin_delegate_postion_manager.py
@@ -179,6 +179,7 @@
    else:
        return None, order_info
# 因为L2数据慢的问题而重新计算
def recompute_for_slow_time(code, order_info, real_place_index):
    try:
@@ -212,7 +213,7 @@
                        # 下单时间不一致
                        need_update = True
                    if not need_update and real_place_index_data["val"]["num"] != volume//100:
                    if not need_update and real_place_index_data["val"]["num"] != volume // 100:
                        # 下单量不一致
                        need_update = True
@@ -230,6 +231,7 @@
                            # 已经撤单
                            need_update = True
                    if need_update:
                        async_log_util.info(logger_debug, f"下单位矫正# {code}需要更新真实下单位置: 当前真实下单位-{real_place_index} order_info-{order_info}")
                        # 需要更新真实下单位置
                        # 在时间内找引子单
                        shadow_order_indexes = []
@@ -246,6 +248,7 @@
                            if abs(shadow_price - float(val["price"])) >= 0.01:
                                continue
                            shadow_order_indexes.append(i)
                        async_log_util.info(logger_debug, f"下单位矫正# {code}获取到影子单索引:{shadow_order_indexes}")
                        # 获取引子单前最近且符合真实下单位置特征的数据
                        findexes_info = []
@@ -258,7 +261,7 @@
                                    continue
                                if not L2DataUtil.is_limit_up_price_buy(val):
                                    continue
                                if volume//100 != val["num"]:
                                if volume // 100 != val["num"]:
                                    continue
                                left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(
                                    code,
@@ -270,6 +273,7 @@
                                    continue
                                findexes_info.append((index, i))
                                break
                        async_log_util.info(logger_debug, f"下单位矫正# {code}真实下单位计算结果:{findexes_info}")
                        if findexes_info:
                            findexes_info.sort(key=lambda x: x[0] - x[1])
                            # 获取成功
third_data/data_server.py
@@ -344,7 +344,8 @@
                # 获取L2的数据
                ps_dict = dict([(k, v[0]) for k, v in parse_qs(url.query).items()])
                code = ps_dict['code']
                datas = data_export_util.get_l2_datas(code, l2_data_util.local_today_datas.get(code))
                date = ps_dict.get('date')
                datas = data_export_util.get_l2_datas(code, l2_data_util.local_today_datas.get(code), date = date)
                code_name = gpcode_manager.get_code_name(code)
                response_data = json.dumps({"code": 0, "data": {"code": code, "code_name": code_name, "data": datas}})
            except Exception as e:
utils/data_export_util.py
@@ -283,6 +283,6 @@
if __name__ == "__main__":
    try:
        export_l2_excel("002036")
        export_l2_excel("600822", date="2024-03-12")
    except Exception as e:
        logging.exception(e)