| | |
| | | fdatas.append((time_str, type, data_json["data"])) |
| | | return fdatas |
| | | |
| | | def load_cancel_buy_reasons(code, date=tool.get_now_date_str()): |
| | | """ |
| | | 获取撤单原因 |
| | | @param code: |
| | | @param date: |
| | | @return: {真实下单位置:撤单原因} |
| | | """ |
| | | fdatas = load_trade_recod(code, date) |
| | | cancel_reason_dict={} |
| | | for data in fdatas: |
| | | if data[1] != "cancel": |
| | | continue |
| | | msg = data[2].get("msg") |
| | | real_place_order_index = data[2].get("real_place_order_index") |
| | | if real_place_order_index not in cancel_reason_dict: |
| | | cancel_reason_dict[real_place_order_index] = msg |
| | | return cancel_reason_dict |
| | | |
| | | |
| | | # 加载l2订单成交数据 |
| | | def load_huaxin_deal_record(code, date=tool.get_now_date_str()): |
| | |
| | | return break_time, records_new, records_new_data |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | # 返回内容[(类型,buy_single_index,indexes)] |
| | | def load_trade_record_cancel_watch_indexes(code, cancel_type=None, date=tool.get_now_date_str()): |
| | | fresults = [] |
| | |
| | | if market_sitation == MarketSituationManager.SITUATION_GOOD: |
| | | return 31, 100, 40, 100, 40, 80, 100 |
| | | # return 5.9, 41, 8.9, 25, 8.9, 19, 80 |
| | | return 5.9, 200, 8.9, 25, 8.9, 19, 200 |
| | | return 5.9, 200, 8.9, 25, 8.9, 19, 10000 |
| | | |
| | | |
| | | # 获取量比的等级获取量 |
| | |
| | | trade_indexs = [] |
| | | real_position_indexes = [] |
| | | deal_list = [] |
| | | cancel_reasons = {} |
| | | else: |
| | | process_indexs = log_export.get_l2_process_position(code, date) |
| | | trade_indexs = log_export.get_l2_trade_position(code, date) |
| | | real_position_indexes = log_export.get_real_place_order_positions(code, date) |
| | | deal_list = log_export.load_huaxin_deal_record(code, date) |
| | | cancel_reasons = log_export.load_cancel_buy_reasons(code, date) |
| | | deal_list_dict = {} |
| | | for d in deal_list: |
| | | deal_list_dict[str(d[0])] = d |
| | |
| | | if not active_sell_set: |
| | | active_sell_set = set() |
| | | fdatas = export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos, |
| | | active_sell_set) |
| | | active_sell_set, cancel_reasons) |
| | | return fdatas |
| | | |
| | | |
| | |
| | | |
| | | |
| | | def export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos, |
| | | active_sell_nos): |
| | | active_sell_nos, cancel_reasons): |
| | | def find_process_index(index): |
| | | for i in range(0, len(process_indexs)): |
| | | if process_indexs[i][0] <= index <= process_indexs[i][1]: |
| | |
| | | if trade_indexs[i][1] == index: |
| | | return trade_indexs[i] |
| | | return None |
| | | |
| | | # 数据预处理 |
| | | num_operate_map = {} |
| | | l2.l2_data_util.load_num_operate_map(num_operate_map, code, datas) |
| | |
| | | elif trade_info[0] == 2: |
| | | # font.colour_index = 10 |
| | | cancel_order_info = trade_info[2] |
| | | if not cancel_order_info: |
| | | if data["index"] in cancel_reasons: |
| | | cancel_order_info = cancel_reasons[data["index"]] |
| | | |
| | | format_data.append(cancel_order_info) |
| | | format_data.append(data["val"].get("orderNo")) |
| | | fdatas.append((style_int, trade_info, format_data)) |