Administrator
2024-03-27 b8e738e18f8aefc6dfb2737c01c2b2037862b079
取消S后撤/更改委托列表接口
5个文件已修改
79 ■■■■ 已修改文件
huaxin_client/l2_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_manager.py 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py
@@ -220,7 +220,7 @@
                        self.l2_transaction_codes.discard(code)
                        break
                    self.l2_transaction_codes.add(code)
                    time.sleep(0.002)
                    time.sleep(0.001)
            except:
                pass
            finally:
l2/cancel_buy_strategy.py
@@ -256,13 +256,14 @@
            need_cancel, cancel_msg = self.__need_cancel_for_up(code, big_sell_order_info, total_datas)
            if need_cancel:
                return need_cancel, cancel_msg
            if self.__latest_process_sell_order_no.get(code) != big_sell_order_info[1][-1][0]:
                # 不处理重复的卖单
                # 获取最新的成交时间
                latest_trade_time = l2_huaxin_util.convert_time(big_sell_order_info[1][-1][4][0])
                if tool.trade_time_sub(latest_trade_time,
                                       total_datas[order_begin_pos.buy_single_index]['val']['time']) >= 180:
                    self.__compute_down_cancel_watch_index(code, big_sell_order_info, total_datas)
            # S后撤取消
            # if self.__latest_process_sell_order_no.get(code) != big_sell_order_info[1][-1][0]:
            #     # 不处理重复的卖单
            #     # 获取最新的成交时间
            #     latest_trade_time = l2_huaxin_util.convert_time(big_sell_order_info[1][-1][4][0])
            #     if tool.trade_time_sub(latest_trade_time,
            #                            total_datas[order_begin_pos.buy_single_index]['val']['time']) >= 180:
            #         self.__compute_down_cancel_watch_index(code, big_sell_order_info, total_datas)
            return False, "不满足撤单条件"
        finally:
            self.__latest_process_sell_order_no[code] = big_sell_order_info[1][-1][0]
@@ -705,9 +706,6 @@
    # 获取撤单比例,返回(撤单比例,是否必买)
    @classmethod
    def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False):
        # 下单15s内撤单比例为设置为29% -- 暂时不生效
        # if not is_up and tool.trade_time_sub(tool.get_now_time_str(), buy_exec_time) <= 15:
        #     return 0.29, False
        try:
            must_buy_cancel_rate = cls.__MustBuyCodesManager.get_cancel_rate_cache(code)
            if must_buy_cancel_rate is not None:
@@ -1198,6 +1196,9 @@
        self.__last_trade_progress_dict[code] = index
        self.__compute_total_l_down_not_deal_num(code)
        if total_datas is None:
            return
        if not self.__is_l_down_can_cancel(code, buy_single_index):
            # L后已经不能守护
            HourCancelBigNumComputer().start_compute_watch_indexes(code, buy_single_index)
l2/l2_data_manager_new.py
@@ -600,8 +600,8 @@
        if not cancel_data:
            cancel_data, cancel_msg = l_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index)
        # 暂时取消S撤
        if not cancel_data:
            cancel_data, cancel_msg = s_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index)
        # if not cancel_data:
        #     cancel_data, cancel_msg = s_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index)
        if not cancel_data:
            cancel_data, cancel_msg = h_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index)
        if cancel_data and not DCancelBigNumComputer().has_auto_cancel_rules(code):
third_data/kpl_data_manager.py
@@ -417,16 +417,22 @@
    def get_limit_up():
        while True:
            if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")) or True:
                try:
            try:
                if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")):
                    results = kpl_api.getLimitUpInfoNew()
                    result = json.loads(results)
                    start_time = time.time()
                    __upload_data("limit_up", result)
                except Exception as e:
            except Exception as e:
                try:
                    logging.exception(e)
                    logger_debug.exception(e)
            time.sleep(3)
                except:
                    pass
            except:
                pass
            finally:
                time.sleep(3)
    def get_bidding_money():
        # 竞价数据上传
trade/huaxin/huaxin_trade_server.py
@@ -1523,6 +1523,41 @@
                                limit_up_price) * 100 < 1500 * 10000) and (
                                                         real_place_order_after_count <= 10 or real_place_order_after_num * float(
                                                     limit_up_price) * 100 < 1500 * 10000)
                            # 统计真实下单位是否距离大单位置过近
                            is_near_big_order = False
                            try:
                                count = 0
                                for i in range(place_order_index-1, -1, -1):
                                    data = total_datas[i]
                                    val = data["val"]
                                    if not L2DataUtil.is_limit_up_price_buy(val):
                                        continue
                                    money = val["num"]*float(val["price"])
                                    if money <50*100:
                                        continue
                                    left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(
                                        code,
                                        i,
                                        total_datas,
                                        l2_data_util.local_today_canceled_buyno_map.get(
                                            code))
                                    if left_count <= 0:
                                        continue
                                    if money >= 299*100:
                                        if count < 1:
                                            is_near_big_order = True
                                    else:
                                        count+=1
                                        if count >= 1:
                                            break
                            except:
                                pass
                            fdata = {"code_info": (code, code_name), "total_num": total_nums,
                                     "finish_num": deal_or_cancel_num,
                                     "buy1_money": output_util.money_desc(buy1_money),
@@ -1542,7 +1577,8 @@
                                     "pay_attention": need_pay_attention,
                                     "trade_progress_percent": round(
                                         total_left_num * float(limit_up_price) * 100 * 100 / buy1_money, 2),  # 成交进度比例
                                     "limit_up_price": float(gpcode_manager.get_limit_up_price(code))
                                     "limit_up_price": float(gpcode_manager.get_limit_up_price(code)),
                                     "is_near_big_order":is_near_big_order
                                     }
                            fdatas.append(fdata)
                        except Exception as e: