| | |
| | | type_ = data_json["type"] |
| | | # 记录交易反馈日志 |
| | | hx_logger_trade_callback.info(data_json) |
| | | sk.sendall(json.dumps({"code": 0}).encode(encoding='utf-8')) |
| | | # 重新请求委托列表与资金 |
| | | trade_api_server.trade_data_request_queue.put_nowait({"type": "delegate_list"}) |
| | | trade_api_server.trade_data_request_queue.put_nowait({"type": "money"}) |
| | |
| | | huaxin.huaxin_delegate_postion_manager.place_order(code, price, count, last_data_index) |
| | | if not constant.TRADE_ENABLE: |
| | | return |
| | | result = huaxin_trade_api.order(1, code, count, price) |
| | | print("华鑫下单耗时", time.time() - start_time) |
| | | logger_juejin_trade.info(f"{code}:下单耗时{round(time.time() - start_time, 3)}s") |
| | | result = None |
| | | try: |
| | | result = huaxin_trade_api.order(1, code, count, price) |
| | | print("华鑫下单耗时", time.time() - start_time) |
| | | logger_juejin_trade.info(f"{code}:下单耗时{round(time.time() - start_time, 3)}s") |
| | | except Exception as e: |
| | | if str(e).find("超时") >= 0: |
| | | # 此处出现超时,需要通过读取委托列表来设置订单信息 |
| | | pass |
| | | else: |
| | | raise e |
| | | |
| | | if result: |
| | | print("下单结果", result) |