Administrator
2023-09-12 233db64812e67ba4cc1f5813eb502abba384d6cc
获取成交列表的timeout
2个文件已修改
9 ■■■■■ 已修改文件
trade/huaxin/huaxin_trade_api.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_data_update.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py
@@ -320,7 +320,8 @@
# volume:交易量
# price:价格(如果是卖时不传价格就按照5挡价卖)
# blocking是否阻塞进程
def order(direction, code, volume, price, price_type=2, blocking=False, sinfo=None, request_id=None,local_order_id = None):
def order(direction, code, volume, price, price_type=2, blocking=False, sinfo=None, request_id=None,
          local_order_id=None):
    timestamp = round(time.time() * 1000)
    if not sinfo:
        sinfo = f"b_{code}_{timestamp}"
@@ -379,11 +380,11 @@
# 获取成交列表
def get_deal_list(blocking=True):
def get_deal_list(blocking=True, timeout=TIMEOUT):
    request_id = __request(ClientSocketManager.CLIENT_TYPE_DEAL_LIST,
                           {"type": ClientSocketManager.CLIENT_TYPE_DEAL_LIST}, blocking=blocking,
                           is_pipe=is_pipe_channel_normal())
    return __read_response(request_id, blocking)
    return __read_response(request_id, blocking, timeout=timeout)
# 获取持仓列表
trade/huaxin/huaxin_trade_data_update.py
@@ -73,7 +73,7 @@
                                trade_manager.AccountAvailableMoneyManager().set_available_money(0, usefulMoney)
                            # 设置可用资金
                    elif type_ == "deal_list":
                        dataJSON = huaxin_trade_api.get_deal_list()
                        dataJSON = huaxin_trade_api.get_deal_list(timeout=10)
                        print("成交响应:", dataJSON)
                        if dataJSON["code"] == 0:
                            datas = dataJSON["data"]