| | |
| | | sinfo = data["sinfo"] |
| | | order_ref = data.get("order_ref") |
| | | shadow_price = data.get("shadow_price") |
| | | blocking = data.get("blocking") |
| | | |
| | | if direction == 1: |
| | | async_log_util.info(logger_trade, f"{code}华鑫本地开始下单") |
| | | # 买 |
| | | try: |
| | | req_rid_dict[sinfo] = (client_id, request_id, sk, order_ref) |
| | | if blocking: |
| | | req_rid_dict[sinfo] = (client_id, request_id, sk, order_ref) |
| | | # threading.Thread(target=lambda: self.__tradeSimpleApi.buy(code, volume, price, sinfo, order_ref), |
| | | # daemon=True).start() |
| | | self.trade_thread_pool.submit(self.__tradeSimpleApi.buy, code, volume, price, sinfo, order_ref, shadow_price) |
| | |
| | | "order_ref": order_ref, |
| | | "volume": volume, |
| | | "price_type": price_type, |
| | | "price": price, "shadow_price": shadow_price, "sinfo": sinfo}, request_id=request_id, |
| | | "price": price, "shadow_price": shadow_price, "sinfo": sinfo, "blocking": blocking}, |
| | | request_id=request_id, |
| | | blocking=blocking, |
| | | is_pipe=is_pipe_channel_normal()) |
| | | try: |
| | |
| | | if huaxin_util.is_can_cancel(order.orderStatus): |
| | | # 设置下单成功 |
| | | new_place_order_index_ = process_order_success(order) |
| | | if not new_place_order_index_: |
| | | # 有可能由于L2数据还没有来,导致正确的下单位置尚未获取到,需要延时200ms再进行处理 |
| | | cls.__thread_pool.submit(lambda: process_order_success(order, delay_s=0.2)) |
| | | # 暂时不需要验证 |
| | | # if not new_place_order_index_: |
| | | # # 有可能由于L2数据还没有来,导致正确的下单位置尚未获取到,需要延时200ms再进行处理 |
| | | # cls.__thread_pool.submit(lambda: process_order_success(order, delay_s=0.2)) |
| | | elif huaxin_util.is_canceled(order.orderStatus) or huaxin_util.is_deal( |
| | | order.orderStatus): |
| | | # 已经撤单/已经成交,需要处理临时保存的系统订单号 |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | try: |
| | | export_l2_excel("000010") |
| | | export_l2_excel("000981") |
| | | except Exception as e: |
| | | logging.exception(e) |