| | |
| | | try: |
| | | use_time = (time.time() - msg['time']) * 1000 |
| | | decoded_data, decoded_use_time = L2SharedMemoryDataUtil.get_data(shared_memory) |
| | | print(f"获取到逐笔委托数据: 通信耗时:{use_time}ms 解码耗时:{decoded_use_time}s") |
| | | print(f"获取到逐笔委托数据: 数据长度:{len(decoded_data)} 通信耗时:{use_time}ms 解码耗时:{decoded_use_time}s") |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |
| | |
| | | try: |
| | | use_time = (time.time() - msg['time']) * 1000 |
| | | decoded_data, decoded_use_time = L2SharedMemoryDataUtil.get_data(shared_memory) |
| | | print(f"获取到逐笔成交数据: 通信耗时:{use_time}ms 解码耗时:{decoded_use_time}s") |
| | | print(f"获取到逐笔成交数据: 数据长度:{len(decoded_data)} 通信耗时:{use_time}ms 解码耗时:{decoded_use_time}s") |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |
| | |
| | | socket.connect(delegate_ipc_addr) |
| | | while True: |
| | | try: |
| | | print("发送委托数据") |
| | | datas = [('000990', 7.52, 400, 93000030, 2012, 380422, 380421, 375477, '1') * 100] |
| | | L2SharedMemoryDataUtil.set_data(datas, shared_memory) |
| | | socket.send_json({'data': [], "time": time.time()}) |
| | |
| | | deal_ipc_addr=f"ipc://deal_{i}.ipc", |
| | | delegate_data_shared_memory=delegate_data_array, |
| | | deal_data_shared_memory=deal_data_array) |
| | | if constant.is_windows() or True: |
| | | if constant.is_windows(): |
| | | param.delegate_ipc_addr = f"tcp://127.0.0.1:{15000 + i}" |
| | | param.deal_ipc_addr = f"tcp://127.0.0.1:{16000 + i}" |
| | | params.append(param) |