| | |
| | | import lev2mdapi |
| | | from huaxin_client.command_manager import L2ActionCallback |
| | | from log_module import log |
| | | from log_module.log import logger_local_huaxin_l2_subscript, logger_system |
| | | from log_module.log import logger_local_huaxin_l2_subscript, logger_system, logger_local_huaxin_l2_transaction, \ |
| | | logger_local_huaxin_g_cancel |
| | | |
| | | Front_Address = "tcp://10.0.1.101:6900" |
| | | Multicast_Address = "udp://224.224.2.19:7889" |
| | |
| | | min_volume, limit_up_price = self.codes_volume_and_price_dict.get(code) |
| | | # 输出逐笔成交数据 |
| | | if pTransaction['ExecType'] == b"2": |
| | | transaction_big_order_no = l2_data_manager.get_latest_transaction_order_no(code) |
| | | if transaction_big_order_no == pTransaction['BuyNo']: |
| | | transaction_big_order_nos = l2_data_manager.get_latest_transaction_order_nos(code) |
| | | if transaction_big_order_nos and pTransaction['BuyNo'] in transaction_big_order_nos: |
| | | # 正在成交的订单撤单了 |
| | | l2_data_manager.trading_order_canceled(code, pTransaction['BuyNo']) |
| | | logger_local_huaxin_g_cancel.info(f"G撤撤单:{code} - {pTransaction['BuyNo']}") |
| | | if min_volume is None: |
| | | # 默认筛选50w |
| | | if pTransaction['TradePrice'] * pTransaction['Volume'] < 500000: |
| | |
| | | self.special_code_volume_for_order_dict.pop(code) |
| | | if not can_listen: |
| | | |
| | | transaction_big_order_no = l2_data_manager.get_latest_transaction_order_no(code) |
| | | if transaction_big_order_no == pOrderDetail['OrderNO'] and pOrderDetail['OrderStatus'] == b'D': |
| | | # 正在成交的订单撤单了 |
| | | l2_data_manager.trading_order_canceled(code,pOrderDetail['OrderNO']) |
| | | if pOrderDetail['OrderStatus'] == b'D': |
| | | transaction_big_order_nos = l2_data_manager.get_latest_transaction_order_nos(code) |
| | | if transaction_big_order_nos and pOrderDetail['OrderNO'] in transaction_big_order_nos: |
| | | # 正在成交的订单撤单了 |
| | | l2_data_manager.trading_order_canceled(code, pOrderDetail['OrderNO']) |
| | | logger_local_huaxin_g_cancel.info(f"G撤撤单:{code} - {pOrderDetail['OrderNO']}") |
| | | |
| | | min_volume, limit_up_price = self.codes_volume_and_price_dict.get(code) |
| | | if min_volume is None: |
| | |
| | | # 买入订单号的字典 |
| | | buy_order_nos_dict = {} |
| | | # 最近的大单成交单号 |
| | | latest_big_order_transaction_order_dict = {} |
| | | latest_big_order_transaction_orders_dict = {} |
| | | |
| | | |
| | | # 获取最近的大单成交订单号 |
| | | def get_latest_transaction_order_no(code): |
| | | return latest_big_order_transaction_order_dict.get(code) |
| | | def get_latest_transaction_order_nos(code): |
| | | return latest_big_order_transaction_orders_dict.get(code) |
| | | |
| | | |
| | | # 正在成交的订单撤单了 |
| | |
| | | code = data['SecurityID'] |
| | | if code in buy_order_nos_dict: |
| | | if data['BuyNo'] in buy_order_nos_dict[code]: |
| | | latest_big_order_transaction_order_dict[code] = data['BuyNo'] |
| | | if code not in latest_big_order_transaction_orders_dict: |
| | | latest_big_order_transaction_orders_dict[code] = set() |
| | | latest_big_order_transaction_orders_dict[code].add(data['BuyNo']) |
| | | tmep_transaction_queue_dict[code].put((data['SecurityID'], data['TradePrice'], data['TradeVolume'], |
| | | data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], |
| | | data['SellNo'], data['ExecType'])) |
| | |
| | | if udatas: |
| | | start_time = time.time() |
| | | upload_data(code, "l2_order", udatas) |
| | | use_time = int((time.time() - start_time)*1000) |
| | | use_time = int((time.time() - start_time) * 1000) |
| | | if use_time > 20: |
| | | logger_local_huaxin_l2_upload.info(f"{code}-上传代码耗时:{use_time}ms") |
| | | |
| | |
| | | filter=lambda record: record["extra"].get("name") == "local_huaxin_l1_show_info", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_local_huaxin_path("l2", "g_cancel"), |
| | | filter=lambda record: record["extra"].get("name") == "local_huaxin_g_cancel", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | |
| | | |
| | | def get_path(self, dir_name, log_name): |
| | | path_str = "{}/logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name, log_name) + ".{time:YYYY-MM-DD}.log" |
| | | # print(path_str) |
| | |
| | | logger_local_huaxin_contact_debug = __mylogger.get_logger("local_huaxin_debug") |
| | | logger_local_huaxin_trade_debug = __mylogger.get_logger("local_huaxin_trade_debug") |
| | | logger_local_huaxin_l1 = __mylogger.get_logger("local_huaxin_l1_show_info") |
| | | logger_local_huaxin_g_cancel = __mylogger.get_logger("local_huaxin_g_cancel") |
| | | |
| | | |
| | | def close_print(): |