| | |
| | | def format_l2_data(item): |
| | | return f"{item['val']['time']}#{item['val']['num']}手#{round(item['val']['num'] * float(item['val']['price']) * 100 / 10000, 1)}万" |
| | | |
| | | def load_cancel_watch_index(latest_cancel_watch_index_dict_): |
| | | for k in latest_cancel_watch_index_dict_: |
| | | records_new_data.append(latest_cancel_watch_index_dict_[k]) |
| | | latest_cancel_watch_index_dict_.clear() |
| | | |
| | | # 获取炸板信息 |
| | | limit_up_info = code_price_manager.Buy1PriceManager().get_limit_up_info(code) |
| | | break_time = limit_up_info[1] |
| | |
| | | index = 0 |
| | | if records: |
| | | try: |
| | | |
| | | latest_cancel_watch_index_dict = {} |
| | | for record in records: |
| | | time_ = record[0] |
| | | type = record[1] |
| | |
| | | indexes_data.append(format_l2_data(total_datas[index])) |
| | | desc = f"【{format_l2_data(total_datas[indexes[0]])}】-【{format_l2_data(total_datas[indexes[-1]])}】" |
| | | if cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_L_DOWN: |
| | | records_new_data.append((time_, "L撤后囊括", desc, indexes_data)) |
| | | latest_cancel_watch_index_dict[cancel_type] = (time_, "L撤后囊括", desc, indexes_data) |
| | | elif cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_L_UP: |
| | | records_new_data.append((time_, "L撤前囊括", desc, indexes_data)) |
| | | latest_cancel_watch_index_dict[cancel_type] = (time_, "L撤前囊括", desc, indexes_data) |
| | | elif cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_H: |
| | | records_new_data.append((time_, "H撤囊括", desc, indexes_data)) |
| | | latest_cancel_watch_index_dict[cancel_type] = (time_, "H撤囊括", desc, indexes_data) |
| | | elif cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_D: |
| | | records_new_data.append((time_, "D撤囊括", desc, indexes_data)) |
| | | latest_cancel_watch_index_dict[cancel_type] = (time_, "D撤囊括", desc, indexes_data) |
| | | elif cancel_type == trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_S: |
| | | records_new_data.append((time_, "S撤囊括", desc, indexes_data)) |
| | | latest_cancel_watch_index_dict[cancel_type] = (time_, "S撤囊括", desc, indexes_data) |
| | | elif type == trade_record_log_util.TYPE_FORBIDDEN_BUY: |
| | | 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']}", [])) |
| | | elif type == trade_record_log_util.TYPE_CANCEL: |
| | | load_cancel_watch_index(latest_cancel_watch_index_dict) |
| | | records_new_data.append((time_, "撤单", f"原因:{data['msg']}", [])) |
| | | load_cancel_watch_index(latest_cancel_watch_index_dict) |
| | | records_new_data.sort(key=lambda x: x[0]) |
| | | if records_new_data: |
| | | for d in records_new_data: |
| | | records_new.append(f"【{d[0]}】" + "{:<10}".format(f'【{d[1]}】') + d[2]) |
| | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | code = '603131' |
| | | code = '603399' |
| | | l2_data_util.load_l2_data(code) |
| | | __load_trade_record(code, l2_data_util.local_today_datas.get(code)) |