Administrator
2023-11-06 b927e0897d7ef068e50b8192eaaf7208fea4a78e
L后比例调整/交易线程池增加至20个/下单请求2次
3个文件已修改
29 ■■■■■ 已修改文件
huaxin_client/trade_client.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py
@@ -859,7 +859,7 @@
class MyTradeActionCallback(command_manager.TradeActionCallback):
    __tradeSimpleApi = TradeSimpleApi()
    trade_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10)
    trade_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=20)
    def OnTrade(self, client_id, request_id, sk, type_, data):
        if type_ == 1:
l2/cancel_buy_strategy.py
@@ -807,7 +807,7 @@
                if temp_rate >= 1:
                    if temp_rate > 3:
                        temp_rate = 3
                    deal_rate = round((temp_rate * 3.5 - 2.5) / 100, 4)
                    deal_rate = round((temp_rate * 3.5 - 2.5) / 100, 4) if is_up else round((temp_rate * 10.5 - 7.5) / 100, 4)
            base_rate += block_rate
            base_rate += deal_rate
trade/huaxin/huaxin_trade_api.py
@@ -372,17 +372,20 @@
        sinfo = f"b_{code}_{timestamp}"
    if not order_ref:
        order_ref = huaxin_util.create_order_ref()
    request_id = __request(ClientSocketManager.CLIENT_TYPE_TRADE,
                           {"type": ClientSocketManager.CLIENT_TYPE_TRADE, "trade_type": 1,
                            "direction": direction,
                            "code": code,
                            "order_ref": order_ref,
                            "volume": volume,
                            "price_type": price_type,
                            "price": price, "shadow_price": shadow_price, "sinfo": sinfo, "blocking": blocking},
                           request_id=request_id,
                           blocking=blocking,
                           is_pipe=is_pipe_channel_normal())
    if not request_id:
        request_id = __get_request_id(ClientSocketManager.CLIENT_TYPE_TRADE)
    for i in range(2):
        request_id = __request(ClientSocketManager.CLIENT_TYPE_TRADE,
                               {"type": ClientSocketManager.CLIENT_TYPE_TRADE, "trade_type": 1,
                                "direction": direction,
                                "code": code,
                                "order_ref": order_ref,
                                "volume": volume,
                                "price_type": price_type,
                                "price": price, "shadow_price": shadow_price, "sinfo": sinfo, "blocking": blocking},
                               request_id=request_id,
                               blocking=blocking,
                               is_pipe=is_pipe_channel_normal())
    try:
        if blocking:
            return __read_response(request_id, blocking)