| | |
| | | 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)) |
| | | |
| | | 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): |
| | |
| | | |
| | | from trade import bidding_money_manager, trade_manager, l2_trade_util |
| | | from trade.l2_trade_util import BlackListCodeManager |
| | | import concurrent.futures |
| | | |
| | | |
| | | class DataServer(BaseHTTPRequestHandler): |
| | |
| | | __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): |
| | | # 统计目前为止的代码涨停数量(分涨停原因) |
| | |
| | | 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_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}") |