| | |
| | | """ |
| | | GUI管理 |
| | | """ |
| | | import math |
| | | |
| | | import psutil |
| | | |
| | | import constant |
| | | from code_attribute import gpcode_manager |
| | | from log_module import log |
| | | from log_module.log import logger_l2_trade, logger_system |
| | |
| | | from task import task_manager |
| | | from third_data import hx_qc_value_util |
| | | from third_data.code_plate_key_manager import KPLPlateForbiddenManager |
| | | from utils import shared_memery_util |
| | | |
| | | logger_system.info("程序启动Pre:{}", os.getpid()) |
| | | |
| | | import huaxin_client.trade_client |
| | | import huaxin_client.l2_client |
| | | import huaxin_client.l1_client |
| | | from huaxin_client import l2_market_client |
| | | from huaxin_client import l2_market_client, l2_client_v2 |
| | | |
| | | from servers import server_util, huaxin_trade_server, server |
| | | |
| | |
| | | if __name__ == '__main__1': |
| | | huaxin_client.l2_client.test() |
| | | |
| | | |
| | | def __create_l2_subscript(): |
| | | channel_list = [] |
| | | for i in range(constant.HUAXIN_L2_MAX_CODES_COUNT): |
| | | # 创建委托/成交的共享数组和ZMQ通信通道 |
| | | delegate_ipc_addr = f"ipc://order_{i}.ipc", |
| | | deal_ipc_addr = f"ipc://deal_{i}.ipc", |
| | | delegate = [0, shared_memery_util.create_array(), delegate_ipc_addr] |
| | | delegate[0] = shared_memery_util.get_number(delegate[1]) |
| | | deal = [0, shared_memery_util.create_array(), deal_ipc_addr] |
| | | deal[0] = shared_memery_util.get_number(deal[1]) |
| | | channel_list.append((delegate, deal)) |
| | | |
| | | # L2进程数量 |
| | | l2_process_count = 8 |
| | | |
| | | base_channel_count = len(channel_list) // l2_process_count |
| | | left_count = len(channel_list) % l2_process_count |
| | | index = 0 |
| | | # ======分组====== |
| | | # 记录每个分组的数量 |
| | | channel_count_list = [] |
| | | for i in range(l2_process_count): |
| | | channel_count = base_channel_count + (1 if i < left_count else 0) |
| | | channel_count_list.append(channel_count) |
| | | # 该进程下的通道 |
| | | channels = channel_list[index:index + channel_count] |
| | | index += channel_count |
| | | # 订阅信号队列, 数据回调队列(回调频次小的数据通过这种回调) |
| | | sub_single_queue, data_callback_queue = multiprocessing.Queue(), multiprocessing.Queue() |
| | | l2_process = multiprocessing.Process(target=l2_client_v2.run, |
| | | args=(sub_single_queue, data_callback_queue, channels,)) |
| | | l2_process.start() |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | # 可绑定16-31之间的核 |
| | | try: |