Administrator
2023-11-27 6c5361a6141380604d621ac1809b729fa88ff5e6
bug修复
3个文件已修改
20 ■■■■ 已修改文件
db/redis_manager_delegate.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/redis_manager_delegate.py
@@ -9,6 +9,7 @@
import redis
import constant
from log_module import async_log_util
from log_module.log import logger_redis_debug, logger_system
from utils import tool, middle_api_protocol
@@ -97,6 +98,7 @@
    @classmethod
    def keys(cls, redis_, key, auto_free=True):
        async_log_util.info(logger_redis_debug, f"keys:{key}")
        return cls.exec("keys", key, lambda: cls.__request(cls.__get_db(redis_), "keys", key))
    @classmethod
huaxin_client/trade_client.py
@@ -266,7 +266,7 @@
        return
    # 卖
    def sell(self, code, count, price, price_type, sinfo):
    def sell(self, code, count, price, price_type, sinfo, order_ref=None):
        if sinfo in self.__sell_sinfo_set:
            raise Exception(f'下单请求已经提交:{sinfo}')
        self.__sell_sinfo_set.add(sinfo)
@@ -316,6 +316,8 @@
        req_field.TimeCondition = traderapi.TORA_TSTP_TC_GFD
        req_field.VolumeCondition = traderapi.TORA_TSTP_VC_AV
        if order_ref:
            req_field.OrderRef = order_ref
        '''
        OrderRef为报单引用,类型为整型,该字段报单时为选填
@@ -922,8 +924,9 @@
            elif direction == 2:
                try:
                    price_type = data["price_type"]
                    req_rid_dict[sinfo] = (client_id, request_id, sk)
                    self.__tradeSimpleApi.sell(code, volume, price, price_type, sinfo)
                    if blocking:
                        req_rid_dict[sinfo] = (client_id, request_id, sk)
                    self.__tradeSimpleApi.sell(code, volume, price, price_type, sinfo, order_ref)
                    print("sell", req_rid_dict)
                except Exception as e:
                    logging.exception(e)
trade/huaxin/huaxin_trade_server.py
@@ -1046,6 +1046,13 @@
l2DataListenManager: L2DataListenManager = None
# 做一些初始化的操作
def __init():
    # 持仓刷新
    huaxin_trade_data_update.add_position_list()
def run(queue_strategy_r_trade_w, queue_l1_w_strategy_r, queue_strategy_w_trade_r, queue_strategy_w_trade_r_for_read,
        order_queues, transaction_queues,
        market_queue):
@@ -1085,6 +1092,8 @@
        t1 = threading.Thread(target=lambda: clear_invalid_client(), daemon=True)
        t1.start()
        __init()
        laddr = "0.0.0.0", 10008
        try:
            tcpserver = MyThreadingTCPServer(laddr, MyBaseRequestHandle)  # 注意:参数是MyBaseRequestHandle