Administrator
2024-03-12 1fa992787fc7113e79b9a027114899a71a430227
bug修复
6个文件已修改
30 ■■■■■ 已修改文件
huaxin_client/l2_data_manager.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/huaxin/huaxin_delegate_postion_manager.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_api.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api_server.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/middle_api_protocol.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py
@@ -143,9 +143,9 @@
            t1.start()
            t2 = threading.Thread(target=lambda: self.__run_upload_transaction_task(code), daemon=True)
            t2.start()
            t3 = threading.Thread(target=lambda: self.__run_log_task(code), daemon=True)
            t3.start()
            self.upload_l2_data_task_dict[code] = (t1, t2, t3)
            # t3 = threading.Thread(target=lambda: self.__run_log_task(code), daemon=True)
            # t3.start()
            self.upload_l2_data_task_dict[code] = (t1, t2)
        # 释放已经分配的队列
    def release_distributed_upload_queue(self, code):
l2/huaxin/huaxin_delegate_postion_manager.py
@@ -160,6 +160,7 @@
        if not real_place_index:
            real_place_index_info = shadow_place_order_index, RELIABILITY_TYPE_VIRTUAL
        else:
            # TODO 需要矫正是否撤单
            real_place_index_info = real_place_index, RELIABILITY_TYPE_REAL
    elif tool.trade_time_sub(datas[-1]['val']['time'], exec_data['val']['time']) >= estimate_time_space:
        # 下单超过2s
third_data/code_plate_key_manager.py
@@ -101,8 +101,9 @@
                    if not jx_blocks_info:
                        start_time = time.time()
                        blocks = kpl_api.getCodeBlocks(code)
                        async_log_util.info(logger_kpl_block_can_buy,
                                            f"{code}:获取到精选板块-{blocks}  耗时:{int(time.time() - start_time)}s")
                        self.save_jx_blocks(code, blocks, current_limit_up_blocks)
                        async_log_util.info(logger_kpl_block_can_buy, f"{code}:获取到精选板块-{blocks}  耗时:{int(time.time() - start_time)}s")
                    else:
                        # 还没涨停的需要更新精选板块 更新精选板块
                        if abs(float(buy_1_price) - float(limit_up_price)) >= 0.001:
@@ -120,8 +121,10 @@
                                start_time = time.time()
                                # 距离上次更新时间过去了5分钟
                                blocks = kpl_api.getCodeBlocks(code)
                                async_log_util.info(logger_kpl_block_can_buy,
                                                    f"{code}:获取到精选板块(更新)-{blocks}  耗时:{int(time.time() - start_time)}s")
                                self.save_jx_blocks(code, blocks, current_limit_up_blocks)
                                async_log_util.info(logger_kpl_block_can_buy, f"{code}:获取到精选板块(更新)-{blocks}  耗时:{int(time.time() - start_time)}s")
                elif price_rate > 0.03:
                    # 添加备用板块
third_data/kpl_api.py
@@ -34,7 +34,7 @@
            raise Exception("请求出错")
        return response.text
    else:
        fdata = middle_api_protocol.load_kpl(url, data)
        fdata = middle_api_protocol.load_kpl(url, data, timeout)
        return middle_api_protocol.request(fdata)
@@ -259,4 +259,4 @@
if __name__ == "__main__":
    print(getLimitUpInfoNew())
    print(getCodeBlocks("600822"))
trade/huaxin/huaxin_trade_api_server.py
@@ -479,8 +479,12 @@
                    # 如果在9:24-9:30 需要加载板块
                    if int("092400") < int(tool.get_now_time_str().replace(":", "")) < int("093000"):
                        for d in datas:
                            KPLCodeJXBlockManager().load_jx_blocks(d[0], gpcode_manager.get_price(d[0]), float(d[2]),
                                                                   KPLLimitUpDataRecordManager.get_current_reasons())
                            threading.Thread(target=lambda: KPLCodeJXBlockManager().load_jx_blocks(d[0],
                                                                                                   gpcode_manager.get_price(
                                                                                                       d[0]),
                                                                                                   float(d[2]),
                                                                                                   KPLLimitUpDataRecordManager.get_current_reasons()),
                                             daemon=True).start()
                            time.sleep(1)
                    logger_l2_codes_subscript.info("({})发送到华鑫L2代码处理队列:数量-{}", request_id, len(datas))
        except Exception as e:
utils/middle_api_protocol.py
@@ -54,8 +54,8 @@
# ------------------------------开盘啦-------------------------------------
def load_kpl(url, data):
    fdata = {"type": "kpl", "data": {"ctype": "kpl", "data": {"url": url, "data": data}}}
def load_kpl(url, data, timeout):
    fdata = {"type": "kpl", "data": {"ctype": "kpl", "data": {"url": url, "data": data, "timeout": timeout}}}
    return fdata