Administrator
2023-09-12 09ca670240a660b81d8dbed4c54efec96e99e811
trade/trade_huaxin.py
@@ -34,6 +34,7 @@
# 通过量下单,返回(代码,账号ID,订单号)
def order_volume(code, price, count, last_data_index):
    async_log_util.info(logger_trade, f"{code}下单方法开始")
    price = round(float(price), 2)
    if code.find("00") != 0 and code.find("60") != 0:
        raise Exception("只支持00开头与60开头的代码下单")
@@ -45,9 +46,9 @@
    result = None
    blocking = False
    try:
        async_log_util.info(logger_trade, f"{code}下单开始")
        result = huaxin_trade_api.order(1, code, count, price, blocking=blocking)
        print("华鑫下单耗时", time.time() - start_time)
        async_log_util.info(hx_logger_trade_debug, f"{code}:下单耗时{round(time.time() - start_time, 3)}s")
        async_log_util.info(logger_trade, f"{code}下单结束")
    except Exception as e:
        if str(e).find("超时") >= 0:
            # 此处出现超时,需要通过读取委托列表来设置订单信息
@@ -56,7 +57,6 @@
            raise e
    if result:
        print("下单结果", result)
        if blocking:
            if result['code'] == 0:
                result = result["data"]