| | |
| | | # 如果是涨停买撤信号需要看数据位置是否比开始处理时间早 |
| | | if L2DataUtil.is_limit_up_price_buy_cancel(data["val"]): |
| | | # 获取买入信号 |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], buyno_map) |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], |
| | | buyno_map) |
| | | if buy_index is not None and buy_index < begin_pos: |
| | | continue |
| | | |
| | |
| | | def set_real_place_order_index(cls, code, index, order_begin_pos: OrderBeginPosInfo, last_data): |
| | | trade_record_log_util.add_real_place_order_position_log(code, index, order_begin_pos.buy_single_index) |
| | | total_datas = local_today_datas.get(code) |
| | | use_time = tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(total_datas[index]["val"]) , L2DataUtil.get_time_with_ms( |
| | | total_datas[order_begin_pos.buy_exec_index]["val"])) |
| | | trade_record_log_util.add_place_order_use_time(code, f"执行位时间:{L2DataUtil.get_time_with_ms(total_datas[order_begin_pos.buy_exec_index]['val'])} 耗时:{use_time}") |
| | | use_time = tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(total_datas[index]["val"]), |
| | | L2DataUtil.get_time_with_ms( |
| | | total_datas[order_begin_pos.buy_exec_index]["val"])) |
| | | trade_record_log_util.add_place_order_use_time(code, |
| | | f"执行位时间:{L2DataUtil.get_time_with_ms(total_datas[order_begin_pos.buy_exec_index]['val'])} 耗时:{use_time}") |
| | | l2_log.debug(code, "设置真实下单位:{}", index) |
| | | cancel_buy_strategy.set_real_place_position(code, index, order_begin_pos.buy_single_index, is_default=False) |
| | | # 获取真实下单位置之后需要判断F撤 |
| | |
| | | total_datas = local_today_datas[code] |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | bigger_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code)) |
| | | min_num = int(bigger_money / limit_up_price / 100) |
| | | bigger_money_num, current_min_num, total_min_num = int(bigger_money / limit_up_price / 100), int( |
| | | bigger_money / limit_up_price / 100), int(5000 / limit_up_price) |
| | | |
| | | refer_sell_data = L2MarketSellManager().get_refer_sell_data(code, radical_data[3]) |
| | | # 参考总卖额 |
| | |
| | | is_almost_open_limit_up= |
| | | radical_data[5]) |
| | | # 缺乏的大单金额 |
| | | lack_money = big_order_deal_enough_result[3] |
| | | current_lack_money = int(big_order_deal_enough_result[5]) |
| | | total_lack_money = int(big_order_deal_enough_result[6]) |
| | | # 如果有大单成交就不需要看大单 |
| | | if constant.CAN_RADICAL_BUY_NEED_BIG_ORDER_EVERYTIME: |
| | | # 每次下单都需要大单 |
| | |
| | | # 60s以上就不下单了 |
| | | return False, None, "距离上次统计大单时间过去60s", set() |
| | | |
| | | if lack_money == 0: |
| | | if not tool.is_sh_code(code): |
| | | # 非上证的票看50w |
| | | min_num = int(5000 / limit_up_price) |
| | | if max(current_lack_money, total_lack_money) <= 0: |
| | | # 已经不缺少大单了 |
| | | # if not tool.is_sh_code(code): |
| | | # 非上证的票看50w |
| | | current_min_num = int(5000 / limit_up_price) |
| | | # 如果累计大单成交足够,只需看50w |
| | | # if big_order_deal_enough_result[4]: |
| | | # min_num = int(5000 / limit_up_price) |
| | |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] < min_num: |
| | | continue |
| | | # 撤单不算 |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, i, |
| | | total_datas, |
| | |
| | | # 判断是否为大单 |
| | | order_money = dealing_active_order_info[2] + round(val["price"], 2) * val["num"] * 100 |
| | | if order_money >= bigger_money: |
| | | lack_money -= order_money |
| | | watch_indexes.add(i) |
| | | if lack_money < 0: |
| | | if val["num"] >= bigger_money_num: |
| | | watch_indexes.add(i) |
| | | if val["num"] >= current_min_num: |
| | | current_lack_money -= order_money |
| | | if val["num"] >= total_min_num: |
| | | total_lack_money -= order_money |
| | | if max(current_lack_money, total_lack_money) < 0: |
| | | single_index = i |
| | | break |
| | | |
| | | if int(val["orderNo"]) <= radical_data[1]: |
| | | # 主动买单后的数据不算 |
| | | continue |
| | | watch_indexes.add(i) |
| | | lack_money -= round(val["price"], 2) * val["num"] * 100 |
| | | if lack_money < 0: |
| | | |
| | | if val["num"] >= bigger_money_num: |
| | | watch_indexes.add(i) |
| | | |
| | | if val["num"] >= current_min_num: |
| | | current_lack_money -= round(val["price"], 2) * val["num"] * 100 |
| | | |
| | | if val["num"] >= total_min_num: |
| | | total_lack_money -= round(val["price"], 2) * val["num"] * 100 |
| | | |
| | | if max(current_lack_money, total_lack_money) < 0: |
| | | single_index = i |
| | | break |
| | | if single_index is not None: |
| | | return True, single_index, f"有大单,大单情况:{big_order_deal_enough_result[1]}", watch_indexes |
| | | return False, None, f"大单不足:{trade_index}-{end_index} 缺少的大单-{lack_money} 大单情况:{big_order_deal_enough_result[1]}", watch_indexes |
| | | return False, None, f"大单不足:{trade_index}-{end_index} 缺少的大单-{max(current_lack_money, total_lack_money)} 大单情况:{big_order_deal_enough_result[1]}", watch_indexes |
| | | |
| | | radical_data = RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict.get(code) |
| | | record_codes = radical_buy_data_manager.BlockPlaceOrderRecordManager().get_codes() |
| | |
| | | f"{code}获取到买入执行点(快速买入):{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num} 统计纯买单数:{buy_count}") |
| | | elif L2DataUtil.is_limit_up_price_buy_cancel(_val): |
| | | # 判断买入位置是否在买入信号之前 |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], buy_no_map) |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], |
| | | buy_no_map) |
| | | if buy_index is not None: |
| | | # 找到买撤数据的买入点 |
| | | if buy_index >= buy_single_index: |
| | |
| | | f"{code}获取到买入执行点(积极下单):{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num} 统计纯买单数:{buy_count}") |
| | | elif L2DataUtil.is_limit_up_price_buy_cancel(_val): |
| | | # 判断买入位置是否在买入信号之前 |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], buyno_map) |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], |
| | | buyno_map) |
| | | if buy_index is not None: |
| | | |
| | | # 找到买撤数据的买入点 |