| | |
| | | ret = api.ReqOrderInsert(req_field, self.req_id) |
| | | if ret != 0: |
| | | raise Exception('ReqOrderInsert fail, ret[%d]' % ret) |
| | | # 常态化监听不需要单独设置 |
| | | # if queue_other_w_l2_r is not None: |
| | | # queue_other_w_l2_r.put_nowait( |
| | | # json.dumps({"type": "listen_volume", "data": {"code": code, |
| | | # "volume": count}}).encode( |
| | | # 'utf-8')) |
| | | async_log_util.info(logger_trade, f"{code}华鑫本地真实下单结束") |
| | | # --------------------------------影子订单-------------------------------- |
| | | if shadow_price: |
| | |
| | | logger_system.info("交易进程ID:{}", os.getpid()) |
| | | logger_system.info(f"trade 线程ID:{tool.get_thread_id()}") |
| | | __init_trade_data_server() |
| | | global queue_other_w_l2_r |
| | | queue_other_w_l2_r = queue_other_w_l2_r_ |
| | | |
| | | global queue_strategy_trade_write |
| | | queue_strategy_trade_write = queue_strategy_trade_write_ |
| | |
| | | |
| | | # 网络请求 |
| | | def __request(_type, data, request_id=None, blocking=False, is_pipe=True, log_enable=True, is_trade=False): |
| | | """ |
| | | 请求,将交易(包含下单/撤单)与查询(包含查持仓/账户可用金额/委托列表/成交列表)队列分离 |
| | | @param _type: |
| | | @param data: |
| | | @param request_id: |
| | | @param blocking: |
| | | @param is_pipe: |
| | | @param log_enable: |
| | | @param is_trade: |
| | | @return: |
| | | """ |
| | | if not request_id: |
| | | request_id = __get_request_id(_type) |
| | | try: |
| | |
| | | # 设置L2订阅数据 |
| | | def __test_trade_channel(sid): |
| | | request_id = __request("test", |
| | | {"type": "test", "data": {"sid": sid}}, blocking=True, log_enable=False) |
| | | {"type": "test", "data": {"sid": sid}}, blocking=True, log_enable=False, is_trade=True) |
| | | return __read_response(request_id, True, log_enable=False) |
| | | |
| | | |