| | |
| | | # from datetime import time |
| | | # from datetime import timedelta |
| | | import time |
| | | |
| | | import constant |
| | | import utils.tool |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_kpl_jingxuan_in, logger_common |
| | |
| | | from strategy import basic_methods |
| | | from strategy import account_management |
| | | from strategy import order_methods |
| | | from strategy.forbidden_plates_manager import ForbiddenPlatesManager |
| | | from strategy.order_methods import TodayBuyCodeManager |
| | | |
| | | from utils import tool, huaxin_util |
| | |
| | | # print(f"没有在概念缓存列表中找到:{symbol_to_search}。") |
| | | |
| | | # 声明要检查过滤不可用的概念板块名称常量 【代表着 是否有无概念及跟随概念的可能性(有明显个股独特增长特性的不可跟随,因为概念本身是宽泛的,许多不同概念的个股都有这个概念)】 |
| | | check_plate_list = {'无', 'ST摘帽', 'ST板块', '超跌', '次新股', '北交所', '科创板', |
| | | '年报增长', '年报预增', '并购重组', '股权转让', '送转填权', '高送转', '壳资源', |
| | | '资产管理', '举牌', |
| | | '专用设备', '创投'} |
| | | # check_plate_list = constant.check_plate_list | set(ForbiddenPlatesManager().list_plates()) |
| | | check_plate_list = constant.check_plate_list |
| | | |
| | | # 查询当前个股的代码是否在板块强度个股列表中(低吸优选目标) |
| | | strength_list_have_it = False # 是否有强度赋初值 |
| | |
| | | """ |
| | | 黑名单板块管理 |
| | | """ |
| | | import json |
| | | |
| | | from db import redis_manager_delegate as redis_manager |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from utils import tool |
| | |
| | | @tool.singleton |
| | | class ForbiddenPlatesManager: |
| | | def __init__(self): |
| | | self.forbidden_plates = set() |
| | | self.forbidden_plates = [] |
| | | self.__db = 1 |
| | | self.__redisManager = redis_manager.RedisManager(self.__db) |
| | | self.__load_forbidden_plates() |
| | | |
| | | def __load_forbidden_plates(self): |
| | | plates = RedisUtils.smembers(self.__redisManager.getRedis(), "forbidden_plates") |
| | | plates = RedisUtils.get(self.__redisManager.getRedis(), "forbidden_plate_list") |
| | | if plates: |
| | | self.forbidden_plates = set(plates) |
| | | self.forbidden_plates = json.loads(plates) |
| | | |
| | | def add_plate(self, plate): |
| | | """ |
| | |
| | | """ |
| | | if plate in self.forbidden_plates: |
| | | return |
| | | self.forbidden_plates.add(plate) |
| | | RedisUtils.sadd_async(self.__db, "forbidden_plates", plate) |
| | | RedisUtils.expire_async(self.__db, "forbidden_plates", tool.get_expire()) |
| | | self.forbidden_plates.append(plate) |
| | | RedisUtils.setex_async(self.__db, "forbidden_plate_list",tool.get_expire(), json.dumps( self.forbidden_plates)) |
| | | |
| | | def remove_plate(self, plate): |
| | | """ |
| | |
| | | if plate not in self.forbidden_plates: |
| | | return |
| | | self.forbidden_plates.remove(plate) |
| | | RedisUtils.srem_async(self.__db, "forbidden_plates", plate) |
| | | RedisUtils.expire_async(self.__db, "forbidden_plates", tool.get_expire()) |
| | | RedisUtils.setex_async(self.__db, "forbidden_plate_list", tool.get_expire(), json.dumps(self.forbidden_plates)) |
| | | |
| | | def list_plates(self): |
| | | """ |
| | |
| | | if data_cache.OPENING_TIME < now_time < data_cache.AFTER_CLOSING_TIME: |
| | | logger_kpl_market_sift_plate.info(f"{market_sift_plate['list']}") |
| | | # 总控制时间段 |
| | | # TODO 测试 |
| | | if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME) and False: |
| | | if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME): |
| | | return |
| | | # ['801235', '化工', 6996, 0.027, 2.43, 117836347690, -122548038, 8105997595, -8228545633, 0.92, 8595377775454, 0.09, 332297449, 9954902621130, -192457252, 24.0487, 17.1809, 6996, 0.027] |
| | | # market_sift_plate['list'][0] = ['801062', '军工', 3520, -0.49, 0.666, 139133934669, 383864272, 9077352839, -8693488567, 1.183, 6129448037490,-0.12, 168245858, 7088854452019, -290614763, 50.2408, 30.3672, 3520, 0] |
| | |
| | | # print(f"kpl_limit_up_process开始了{now}") |
| | | start_time = time.time() |
| | | now_time = tool.get_now_time_str() |
| | | # TODO 测试 |
| | | if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME or True: |
| | | if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME: |
| | | its_stock_power = get_market_sift_plate_its_stock_power() |
| | | time_str = datetime.datetime.now().strftime("%H%M%S") |
| | | if 92900 < int(time_str) < 95000: |