Administrator
2024-09-30 e383953789e9eb7c46de7fa3d4d2f3679d150929
目标代码板块修改
4个文件已修改
70 ■■■■ 已修改文件
api/outside_api_command_callback.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/data_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/outside_api_command_callback.py
@@ -34,7 +34,7 @@
    logger_trade, logger_trade_position_api_request, logger_request_api, \
    logger_real_place_order_position, logger_device
from output import l2_output_util
from third_data import kpl_data_manager, kpl_util, history_k_data_manager, huaxin_l1_data_manager, third_blocks_manager
from third_data import anager, kpl_util, history_k_data_manager, huaxin_l1_data_manager, third_blocks_manager
from third_data.code_plate_key_manager import CodePlateKeyBuyManager, KPLCodeJXBlockManager
from third_data.history_k_data_manager import HistoryKDataManager
from third_data.history_k_data_util import JueJinApi, HistoryKDatasUtils
servers/data_server.py
@@ -899,7 +899,7 @@
            # 保存精选数据
            if result_list:
                self.__kplDataManager.save_data(type_, result_list)
                RealTimeKplMarketData.set_top_5_reasons(result_list)
                RealTimeKplMarketData.set_market_jingxuan_blocks(result_list)
        return json.dumps({"code": 0})
    def __send_response(self, data):
third_data/code_plate_key_manager.py
@@ -344,31 +344,21 @@
    __KPLPlateForbiddenManager = KPLPlateForbiddenManager()
    __LimitUpCodesPlateKeyManager = LimitUpCodesPlateKeyManager()
    __KPLPlatManager = KPLPlatManager()
    # 精选前几
    __top_jx_blocks = set()
    @classmethod
    def set_top_5_reasons(cls, datas):
        temp_list = []
        for d in datas:
            cls.total_reason_dict[d[1]] = d
        # 排序
        for i in range(0, len(datas)):
            if datas[i][1] not in constant.KPL_INVALID_BLOCKS:
                # (名称,净流入金额,排名)
                temp_list.append((datas[i][1], datas[i][3], len(temp_list)))
                # 只获取前10个
                if len(temp_list) > 10:
                    break
                if datas[i][3] < 3 * 10000 * 10000:
                    break
    def set_market_jingxuan_blocks(cls, datas):
        blocks = set()
        for data in datas:
            if data[3] <= 0:
                break
            blocks.add(data[1])
        cls.__top_jx_blocks = blocks
        for temp in temp_list:
            names = cls.__KPLPlatManager.get_same_plat_names_by_id(temp[0])
            for name in names:
                if name == temp[1]:
                    continue
                temp_list.append((name, temp[1], temp[2]))
        cls.top_5_reason_list = temp_list
        cls.__reset_top_5_dict()
    @classmethod
    def get_top_market_jingxuan_blocks(cls):
        return cls.__top_jx_blocks
    @classmethod
    def set_top_5_industry(cls, datas):
@@ -400,35 +390,6 @@
    def get_can_buy_key_set(cls):
        temp_set = cls.top_5_key_dict.keys()
        return temp_set
    # 通过关键字判断能买的代码数量
    @classmethod
    def get_can_buy_codes_count(cls, code, key):
        # 判断行业涨停票数量,除开自己必须大于1个
        temp_codes = LimitUpCodesPlateKeyManager.total_key_codes_dict.get(key)
        if temp_codes is None:
            temp_codes = set()
        else:
            temp_codes = set(temp_codes)
        temp_codes.discard(code)
        if len(temp_codes) < 1:
            # 后排才能挂单
            return 0, "身位不为后排"
        forbidden_plates = cls.__KPLPlateForbiddenManager.list_all_cache()
        if key in forbidden_plates:
            return 0, "不买该板块"
        # 10:30以前可以挂2个单
        if int(tool.get_now_time_str().replace(':', '')) < int("100000"):
            return 2, "10:00以前可以挂2个单"
        # 10:30以后
        if key not in cls.top_5_key_dict:
            return 0, "净流入没在前5"
        if cls.top_5_key_dict[key][1] > 3 * 10000 * 10000:
            return 2, "净流入在前5且大于3亿"
        else:
            return 1, "净流入在前5"
    @classmethod
    def is_in_top(cls, keys):
@@ -1478,6 +1439,7 @@
                open_limit_up_blocks |= open_limit_up_code_dict[c][1]
        # 获取代码的板块
        keys_ = KPLCodeJXBlockManager().get_jx_blocks_radical(code)
        keys_ &= RealTimeKplMarketData.get_top_market_jingxuan_blocks()
        if not keys_:
            return set(), "没获取到板块"
        keys_ = BlockMapManager().filter_blocks(keys_)
third_data/kpl_data_manager.py
@@ -542,7 +542,7 @@
        threading.Thread(target=cls.run_limit_up_task, daemon=True).start()
        # threading.Thread(target=get_bidding_money, daemon=True).start()
        # threading.Thread(target=get_market_industry, daemon=True).start()
        # threading.Thread(target=get_market_jingxuan, daemon=True).start()
        threading.Thread(target=get_market_jingxuan, daemon=True).start()
if __name__ == "__main__":