| | |
| | | L_CANCEL_MIN_WATCH_COUNT = 10 |
| | | # 撤单比例 |
| | | L_CANCEL_RATE = 0.6 |
| | | # L上撤单比例 |
| | | L_CANCEL_RATE_UP = 0.7 |
| | | # 大金额 |
| | | L_CANCEL_BIG_MONEY = 100 |
| | | # 小金额 |
| | |
| | | # print("逐笔成交", item) |
| | | l2_data_manager.add_transaction_detail(item) |
| | | |
| | | # logger_local_huaxin_l2_transaction.info( |
| | | # "OnRtnTransaction SecurityID[%s] TradePrice[%.2f] TradeVolume[%d] TradeTime[%d] MainSeq[%d] SubSeq[%d] BuyNo[%d] SellNo[%d] ExecType[%s]" % ( |
| | | # pTransaction['SecurityID'], |
| | | # pTransaction['TradePrice'], |
| | | # pTransaction['TradeVolume'], |
| | | # pTransaction['TradeTime'], |
| | | # pTransaction['MainSeq'], |
| | | # pTransaction['SubSeq'], |
| | | # pTransaction['BuyNo'], |
| | | # pTransaction['SellNo'], |
| | | # pTransaction['ExecType'], |
| | | # )) |
| | | |
| | | def OnRtnOrderDetail(self, pOrderDetail): |
| | | can_listen = False |
| | | code = str(pOrderDetail['SecurityID']) |
| | |
| | | pipe_strategy = None |
| | | |
| | | |
| | | def run(queue_trade_w_l2_r:multiprocessing.Queue, _pipe_strategy, _l2_data_callback: l2_data_transform_protocol.L2DataCallBack) -> None: |
| | | def run(queue_trade_w_l2_r: multiprocessing.Queue, _pipe_strategy, |
| | | _l2_data_callback: l2_data_transform_protocol.L2DataCallBack) -> None: |
| | | logger_system.info("L2进程ID:{}", os.getpid()) |
| | | logger_system.info(f"l2_client 线程ID:{tool.get_thread_id()}") |
| | | try: |
| | |
| | | |
| | | # 获取撤单比例 |
| | | @classmethod |
| | | def get_cancel_rate(cls, code): |
| | | def get_cancel_rate(cls, code,is_up=False): |
| | | base_rate = constant.L_CANCEL_RATE |
| | | if is_up: |
| | | base_rate = constant.L_CANCEL_RATE_UP |
| | | |
| | | try: |
| | | block_rate = 0 |
| | | if code in cls.__block_limit_up_count_dict: |
| | |
| | | return |
| | | total_datas = local_today_datas.get(code) |
| | | MIN_MONEY = 99 * 100 |
| | | MAX_COUNT = 10 |
| | | MAX_COUNT = 15 |
| | | watch_indexes = set() |
| | | total_num = 0 |
| | | # thresh_hold_money = l2_trade_factor.L2PlaceOrderParamsManager.get_base_m_val(code) |
| | |
| | | canceled_indexes.append(canceled_data["index"]) |
| | | canceled_count += total_data[wi]["re"] |
| | | rate = round(canceled_count / total_count, 3) |
| | | thresh_cancel_rate = LCancelRateManager.get_cancel_rate(code) |
| | | thresh_cancel_rate = LCancelRateManager.get_cancel_rate(code,is_up=True) |
| | | l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},成交位临近已撤单比例:{rate}/{thresh_cancel_rate}") |
| | | if rate >= thresh_cancel_rate: |
| | | canceled_indexes.sort() |
| | |
| | | async_log_util.info(logger_trade, f"{code} trade_huaxin.order_volume 开始") |
| | | try: |
| | | price = round(float(price), 2) |
| | | # todo 测试买5价下单 |
| | | price = price - 0.05 |
| | | if code.find("00") != 0 and code.find("60") != 0: |
| | | raise Exception("只支持00开头与60开头的代码下单") |
| | | # 保存下单信息 |