| | |
| | | real_order_index = real_order_index_info[0] |
| | | # 统计未撤订单的数量与金额 |
| | | total_datas = local_today_datas.get(code) |
| | | |
| | | # 是否是下单5分钟内 |
| | | if tool.trade_time_sub(tool.get_now_time_str(), total_datas[real_order_index]['val']['time']) > 30: |
| | | return False, "下单超过30s" |
| | | |
| | | total_left_count = 0 |
| | | total_left_num = 0 |
| | | # 成交位到真实下单位剩余的未成交的单 |
| | | for i in range(trade_index + 1, real_order_index_info[0]): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | |
| | | return True, f"剩余笔数({total_left_count})/金额({round(total_left_num * float(limit_up_price) * 100)})不足,成交进度:{trade_index},真实下单位置:{real_order_index}" |
| | | return False, "不满足撤单条件" |
| | | |
| | | # 下单3s内如果成交达到了上板那一刻总卖额的1.5倍就自动撤单 |
| | | def need_cancel_for_deal_fast_with_total_sell(self, code, trade_index, order_position: OrderBeginPosInfo): |
| | | try: |
| | | total_datas = local_today_datas.get(code) |
| | | if tool.trade_time_sub(total_datas[-1]['val']['time'], |
| | | total_datas[order_position.buy_single_index]['val']['time']) > 3: |
| | | return False, "已经超过生效时间" |
| | | # 计算已经成交的数量 |
| | | total_deal_num = 0 |
| | | for i in range(order_position.buy_single_index, trade_index ): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] * float(val["price"]) < 5000: |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, |
| | | i, |
| | | total_datas, |
| | | local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_deal_num += val["num"] * left_count |
| | | dealing_info = HuaXinTransactionDataManager.get_dealing_order_info(code) |
| | | if dealing_info: |
| | | if str(total_datas[trade_index]["val"]["orderNo"]) == str(dealing_info[0]): |
| | | total_deal_num += (total_datas[trade_index]["val"]["num"] - dealing_info[1] // 100) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | deal_money = int(total_deal_num * float(limit_up_price) *100) |
| | | if deal_money >= order_position.sell_info[1] * 2: |
| | | return True, f"成交金额:{deal_money}/{order_position.sell_info[1] * 2}" |
| | | return False, "成交金额不满足" |
| | | except Exception as e: |
| | | l2_log.f_cancel_debug(code, "计算出错:{}",str(e)) |
| | | return False, "计算出错" |
| | | |
| | | |
| | | |
| | | # ---------------------------------G撤------------------------------- |
| | | class GCancelBigNumComputer: |
| | |
| | | (compute_start_index - continue_count - 1) if new_add else compute_start_index, 0), continue_count, |
| | | compute_end_index) |
| | | order_begin_pos.mode = OrderBeginPosInfo.MODE_NORMAL |
| | | # 获取最新的买信息 |
| | | sell_info = cls.__L2MarketSellManager.get_current_total_sell_data(code) |
| | | order_begin_pos.sell_info = sell_info |
| | | # 如果买入信号与上次的买入信号一样就不能算新的信号 |
| | | if cls.__last_buy_single_dict.get(code) == _index: |
| | | has_single = None |
| | |
| | | order_begin_pos.num = 0 |
| | | order_begin_pos.count = 0 |
| | | order_begin_pos.buy_single_index = buy_single_index |
| | | if order_begin_pos.sell_info: |
| | | if order_begin_pos.sell_info and order_begin_pos.mode == OrderBeginPosInfo.MODE_FAST: |
| | | # k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code) |
| | | # if k_format and (k_format[1][0] or k_format[3][0]): |
| | | # # 股价新高或者逼近前高 |
| | |
| | | # 已经下单的需要统计F撤 |
| | | try: |
| | | for d in datas: |
| | | if FCancelBigNumComputer().need_cancel(d)[0] and not DCancelBigNumComputer().has_auto_cancel_rules(code): |
| | | if FCancelBigNumComputer().need_cancel(d)[ |
| | | 0] and not DCancelBigNumComputer().has_auto_cancel_rules(code): |
| | | L2TradeDataProcessor.cancel_buy(code, f"F撤撤单:{d}") |
| | | order_begin_pos = None |
| | | break |
| | |
| | | if order_begin_pos and order_begin_pos.buy_exec_index and order_begin_pos.buy_exec_index > -1: |
| | | HourCancelBigNumComputer().set_transaction_index(code, order_begin_pos.buy_single_index, |
| | | buy_progress_index) |
| | | cresult = FCancelBigNumComputer().need_cancel_for_deal_fast(code,buy_progress_index) |
| | | # cresult = FCancelBigNumComputer().need_cancel_for_deal_fast(code, buy_progress_index) |
| | | # if cresult[0] and not DCancelBigNumComputer().has_auto_cancel_rules(code): |
| | | # L2TradeDataProcessor.cancel_buy(code, f"下单30s内排单不足:{cresult[1]}") |
| | | |
| | | cresult = FCancelBigNumComputer().need_cancel_for_deal_fast_with_total_sell(code, buy_progress_index, order_begin_pos) |
| | | if cresult[0] and not DCancelBigNumComputer().has_auto_cancel_rules(code): |
| | | L2TradeDataProcessor.cancel_buy(code, f"下单30s内排单不足:{cresult[1]}") |
| | | L2TradeDataProcessor.cancel_buy(code, f"3s内成交太多:{cresult[1]}") |
| | | |
| | | # ---------------------------------判断板块是否跟上来了------------------------------- |
| | | try: |
| | | pass |
| | |
| | | |
| | | def get_limit_up(): |
| | | while True: |
| | | if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")) or True: |
| | | if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")): |
| | | try: |
| | | results = kpl_api.getLimitUpInfoNew() |
| | | result = json.loads(results) |