| | |
| | | """ |
| | | L2数据溯源 |
| | | """ |
| | | import tool |
| | | import constant |
| | | from log_module.log import logger_l2_error |
| | | from utils import tool |
| | | |
| | | |
| | | class L2DataSourceUtils(object): |
| | |
| | | for bd in buy_datas: |
| | | # 根据订单号做匹配 |
| | | if bd["val"]["orderNo"] == cancel_data["val"]["orderNo"]: |
| | | return bd |
| | | return bd["index"] |
| | | return None |
| | | |
| | | # 同花顺渠道的L2,根据买撤数据查找买入数据 |
| | |
| | | buy_index = cls.__get_buy_index_cache(code, cancel_data["index"]) |
| | | if buy_index is not None: |
| | | return buy_index |
| | | return cls.__get_buy_index_with_cancel_data_by_ths_l2(code, cancel_data, local_today_num_operate_map) |
| | | if constant.L2_SOURCE_TYPE == constant.L2_SOURCE_TYPE_HUAXIN: |
| | | return cls.__get_buy_index_with_cancel_data_by_huaxin_l2(code, cancel_data, local_today_num_operate_map) |
| | | else: |
| | | return cls.__get_buy_index_with_cancel_data_by_ths_l2(code, cancel_data, local_today_num_operate_map) |
| | | |
| | | # 根据买撤数据(与今日总的数据)计算买入数据 |
| | | @classmethod |
| | |
| | | data = None |
| | | try: |
| | | data = total_data[index] |
| | | except: |
| | | print("") |
| | | except Exception as e: |
| | | logger_l2_error.error(f"未找到买入索引对应的数据:index-{index} total_data长度-{len(total_data) if total_data else 0} 错误原因:{str(e)}") |
| | | val = data["val"] |
| | | # 判断当前买是否已经买撤 |
| | | cancel_datas = local_today_num_operate_map.get( |
| | |
| | | canceled = False |
| | | if cancel_datas: |
| | | for cancel_data in cancel_datas: |
| | | |
| | | buy_index = cls.get_buy_index_with_cancel_data(code, cancel_data, local_today_num_operate_map) |
| | | if buy_index == index: |
| | | canceled = True |