Administrator
2023-09-18 33b3466031a725b52d4c9ee682c079d6509e07bc
bug修复
3个文件已修改
13 ■■■■ 已修改文件
huaxin_client/command_manager.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/data_server.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/command_manager.py
@@ -129,17 +129,14 @@
                try:
                    val = pipe_strategy.recv()
                    if val:
                        if type(val) == bytes:
                            val = val.decode("utf-8")
                        val = json.loads(val)
                        _type = val["type"]
                        cls.process_command_thread_pool.submit(lambda: cls.process_command(_type, None, val))
                except Exception as e:
                    logger_local_huaxin_trade_debug.exception(e)
                    async_log_util.exception(logger_local_huaxin_trade_debug, e)
                    logging.exception(e)
        except Exception as e:
            logger_local_huaxin_trade_debug.exception(e)
            async_log_util.exception(logger_local_huaxin_trade_debug, e)
    # 维护连接数的稳定
    def run(self, blocking=True):
third_data/data_server.py
@@ -25,6 +25,7 @@
from trade import bidding_money_manager, trade_manager, l2_trade_util
from trade.l2_trade_util import BlackListCodeManager
import concurrent.futures
class DataServer(BaseHTTPRequestHandler):
@@ -42,6 +43,7 @@
    __jingxuan_cache_dict = {}
    __industry_cache_dict = {}
    __latest_limit_up_codes_set = set()
    __data_process_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10)
    def __get_limit_up_list(self):
        # 统计目前为止的代码涨停数量(分涨停原因)
@@ -539,7 +541,7 @@
                self.__kplDataManager.save_data(type_, result_list)
        elif type_ == KPLDataType.LIMIT_UP.value:
            result_list = kpl_util.parseDaBanData(data["data"], kpl_util.DABAN_TYPE_LIMIT_UP)
            threading.Thread(target=lambda: do_limit_up(result_list), daemon=True).start()
            self.__data_process_thread_pool.submit(lambda: do_limit_up(result_list))
        elif type_ == KPLDataType.OPEN_LIMIT_UP.value:
            result_list = kpl_util.parseDaBanData(data["data"], kpl_util.DABAN_TYPE_OPEN_LIMIT_UP)
            if result_list:
trade/huaxin/huaxin_trade_api.py
@@ -256,7 +256,7 @@
            trade_cmd_callback(TradeRequest(_type, root_data, request_id))
        else:
            start_time = time.time()
            pipe_trade.send_bytes(json.dumps(root_data).encode("utf-8"))
            pipe_trade.send(json.dumps(root_data).encode("utf-8"))
            use_time = int((time.time() - start_time)*1000)
            if use_time > 10:
                async_log_util.info(hx_logger_trade_loop, f"发送耗时:request_id-{request_id} 耗时时间:{use_time}")