Administrator
2024-12-04 b190e8942bb9d174a652999faf0e570701d28e2d
订阅修改
4个文件已修改
27 ■■■■■ 已修改文件
huaxin_client/l1_client.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/current_price_process_manager.py 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l1_client.py
@@ -287,11 +287,10 @@
            list_ = [level1_data_dict[k] for k in level1_data_dict]
            flist = []
            now_time_int = int(tool.get_now_time_str().replace(":", ""))
            threshold_rate = constant.L1_MIN_RATE_PRE if now_time_int < int(
                "094000") else constant.L1_MIN_RATE
            threshold_rate = constant.L1_MIN_RATE
            for d in list_:
                if d[2] >= threshold_rate or d[0] in fixed_codes:
                    # 涨幅小于5%的需要删除
                    # 涨幅小于3%的需要删除
                    flist.append(d)
            flist.sort(key=lambda x: x[2], reverse=True)
            # 将固定代码的排在最前
@@ -310,7 +309,6 @@
            if len(datas) > 0:
                logger_l2_codes_subscript.info("开始#华鑫L1上传代码:数量-{}", len(datas))
                __upload_codes_info(queue_l1_w_strategy_r, datas)
        except Exception as e:
            logging.exception(e)
            logger_debug.exception(e)
huaxin_client/l2_data_manager.py
@@ -116,8 +116,9 @@
        q: collections.deque = self.temp_order_queue_dict.get(code)
        if q is not None:
            q.append((data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'],
                      data['MainSeq'], data['SubSeq'], data['OrderNO'], data['OrderStatus'], time.time(), start_time))
            q.append(
                (data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'],
                 data['MainSeq'], data['SubSeq'], data['OrderNO'], data['OrderStatus'], time.time(), start_time))
    # 添加逐笔成交
    def add_transaction_detail(self, data):
@@ -135,7 +136,7 @@
        if q is not None:
            q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'],
                      data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],
                      data['SellNo'], data['ExecType']))
                      data['SellNo'], data['ExecType'], time.time()))
    def add_market_data(self, data):
        # 加入上传队列
servers/huaxin_trade_server.py
@@ -900,7 +900,7 @@
                try:
                    volume = tool.get_buy_volume_by_money(limit_up_price, constant.AVAILABLE_BUY_MONEYS[0])
                    result = huaxin_trade_api.order(huaxin_trade_api.TRADE_DIRECTION_BUY, code, volume, limit_up_price,
                                                    bolcking=False,
                                                    blocking=False,
                                                    shadow_price=shadow_price, shadow_volume=volume)
                    async_log_util.info(logger_trade, f"{code}下单结束:{result}")
                    buy_open_limit_up_strategy.BuyOpenLimitupDataManager().set_place_order_info(code, volume, volume,
trade/current_price_process_manager.py
@@ -94,6 +94,7 @@
        _code_list = []
        _delete_list = []
        temp_prices = []
        now_time_int = tool.get_now_time_as_int()
        for d in prices:
            code, price = d["code"], float(d["price"])
            temp_prices.append((code, price))
@@ -102,13 +103,20 @@
            if pricePre is not None:
                # 是否是想买单
                order_index = __compute_code_order(code, top_in_blocks, yesterday_limit_up_codes, today_history_limit_up_codes)
                rate = round((price - pricePre) * 100 / pricePre, 2)
                if tool.is_ge_code(code):
                    # 创业板的涨幅需要打折
                    rate = rate / 2
                if order_index >= 0:
                    _code_list.append((rate, code, order_index))
                    if now_time_int < 150000:
                        if order_index < 1000:
                            # 10点之前只订阅有效代码
                            _code_list.append((rate, code, order_index))
                        else:
                            _delete_list.append((rate, code, 0))
                    else:
                        # 10点之后常规订阅
                        _code_list.append((rate, code, order_index))
                else:
                    # 暂存涨幅为负的代码
                    _delete_list.append((rate, code, 0))