| | |
| | | limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code) |
| | | if limit_up_time is None: |
| | | limit_up_time = tool.get_now_time_str() |
| | | # score = first_code_score_manager.get_score(code, volume_rate, limit_up_time, True) |
| | | |
| | | score = None |
| | | cls.__l2PlaceOrderParamsManagerDict[code] = l2_trade_factor.L2PlaceOrderParamsManager(code, is_first_code, |
| | | volume_rate, |
| | |
| | | logging.exception(e) |
| | | async_log_util.error(logger_l2_error, |
| | | f"H撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} {str(e)}") |
| | | # async_log_util.exception(logger_l2_error, e) |
| | | logger_l2_error.exception(e) |
| | | async_log_util.exception(logger_l2_error, e) |
| | | # logger_l2_error.exception(e) |
| | | finally: |
| | | # l2_data_log.l2_time(code, round(t.time() * 1000) - _start_time, "已下单-H撤大单计算") |
| | | pass |
| | |
| | | # limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code) |
| | | # if limit_up_time is None: |
| | | # limit_up_time = tool.get_now_time_str() |
| | | # score = first_code_score_manager.get_score(code, cls.volume_rate_info[code][0], limit_up_time, True, |
| | | # left_big_num) |
| | | # cls.__l2PlaceOrderParamsManagerDict[code].set_score(score) |
| | | |
| | | # logger_place_order_score.info("code={},data='score_index':{},'score_info':{}", code, |
| | | # cls.__l2PlaceOrderParamsManagerDict[code].score_index, |
| | |
| | | import time |
| | | import code_attribute |
| | | from code_attribute import code_volumn_manager, limit_up_time_manager, global_data_loader, gpcode_manager |
| | | import constant |
| | | from l2.l2_data_manager import OrderBeginPosInfo |
| | | from l2.l2_data_util import L2DataUtil |
| | | from utils import global_util, tool |
| | |
| | | import l2.l2_data_manager_new |
| | | from third_data import kpl_data_manager, kpl_api |
| | | from third_data.kpl_data_manager import KPLLimitUpDataRecordManager |
| | | from trade import first_code_score_manager, l2_trade_factor, trade_manager, l2_trade_util, trade_record_log_util |
| | | from trade import l2_trade_factor, trade_manager, l2_trade_util, trade_record_log_util |
| | | from trade.l2_trade_factor import L2TradeFactorUtil |
| | | import trade.deal_big_money_manager |
| | | |
| | | base_output_content = {} |
| | | kpl_block_info_dict = {} |
| | |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | limit_up_time = limit_up_time_manager.LimitUpTimeManager().get_limit_up_time_cache(code) |
| | | volume_rate, volume_info = code_volumn_manager.get_volume_rate(code, True) |
| | | (score, score_list), score_source_list = first_code_score_manager.get_score(code, volume_rate, limit_up_time, |
| | | True) |
| | | |
| | | ################################买前评分################################ |
| | | |
| | |
| | | params["trade_data"] = {} |
| | | |
| | | # 获取买入意愿 |
| | | volume_rate = score_source_list[6] |
| | | __L2PlaceOrderParamsManager = l2_trade_factor.L2PlaceOrderParamsManager(code, True, volume_rate, |
| | | code_volumn_manager.get_volume_rate_index( |
| | | volume_rate), |
| | | ( |
| | | (score, score_list), |
| | | score_source_list)) |
| | | None) |
| | | # 是否可以买入的信息 |
| | | can_buy_info = l2.l2_data_manager_new.L2TradeDataProcessor.can_buy_first(code, limit_up_price) |
| | | params["trade_data"]["can_buy_info"] = can_buy_info |
| | |
| | | __base_L2PlaceOrderParamsManager = l2_trade_factor.L2PlaceOrderParamsManager(code, False, volume_rate, |
| | | code_volumn_manager.get_volume_rate_index( |
| | | volume_rate), |
| | | ((score, score_list), |
| | | score_source_list)) |
| | | None) |
| | | if -1 < __L2PlaceOrderParamsManager.score_index < 3: |
| | | params["trade_data"]["star"] = {"desc": "主动买入"} |
| | | if __L2PlaceOrderParamsManager.score_index == 0: |
| | |
| | | log.logger_debug.info(f"获取代码的历史涨停数据耗时:{time.time() - __start_time}") |
| | | __start_time = time.time() |
| | | return params |
| | | |
| | | |
| | | def __load_codes_scores(): |
| | | # 获取所有监听中的代码 |
| | | codes = gpcode_manager.FirstGPCodesManager().get_first_gp_codes() |
| | | scores = {} # l2_data_manager_new.L2TradeDataProcessor.get_code_scores() |
| | | for code in codes: |
| | | if code not in scores: |
| | | # 获取分数 |
| | | try: |
| | | limit_up_time = limit_up_time_manager.LimitUpTimeManager().get_limit_up_time_cache(code) |
| | | volume_rate, volume_info = code_volumn_manager.get_volume_rate(code, True) |
| | | (score, score_list), score_source_list = first_code_score_manager.get_score(code, volume_rate, |
| | | limit_up_time, |
| | | True) |
| | | scores[code] = score |
| | | except: |
| | | pass |
| | | # 筛选180分以上的代码 |
| | | scores_list = [] |
| | | for code in scores: |
| | | code_name = gpcode_manager.get_code_name(code) |
| | | # 获取现价,判断是否涨停 |
| | | current_price_info = global_util.cuurent_prices.get(code) |
| | | limit_up_info = code_price_manager.Buy1PriceManager().get_limit_up_info(code) |
| | | is_limit_up = True |
| | | open_limit_up = limit_up_info[0] and limit_up_info[1] |
| | | if current_price_info is not None and not current_price_info[1]: |
| | | is_limit_up = False |
| | | else: |
| | | is_limit_up = True |
| | | scores_list.append((code, code_name, scores[code], is_limit_up, open_limit_up)) |
| | | scores_list.sort(key=lambda x: x[2], reverse=True) |
| | | fscores_list = [[], [], []] |
| | | for score in scores_list: |
| | | if score[2] >= constant.BUY_SCORE_RANK_1: |
| | | fscores_list[0].append(score) |
| | | elif score[2] >= constant.BUY_SCORE_RANK_0: |
| | | fscores_list[1].append(score) |
| | | else: |
| | | fscores_list[2].append(score) |
| | | |
| | | return fscores_list |
| | | |
| | | |
| | | def __load_trade_record(code, total_datas): |
| | |
| | | """ |
| | | |
| | | # 判断是龙几,判断是否涨停,判断是否炸板,加载分数 |
| | | |
| | | from code_attribute import code_volumn_manager, limit_up_time_manager, gpcode_manager |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from utils import tool |
| | | from db import redis_manager_delegate as redis_manager |
| | | from third_data.kpl_data_manager import KPLDataManager |
| | | from third_data.kpl_util import KPLDataType |
| | | from trade import first_code_score_manager |
| | | |
| | | __kplDataManager = KPLDataManager() |
| | | |
| | |
| | | for code in codes: |
| | | dict_[code] = (code in limit_up_codes, code in open_limit_up_codes) |
| | | return dict_, limit_up_codes, open_limit_up_codes |
| | | |
| | | |
| | | # 获取代码分数字典 |
| | | def get_codes_scores_dict(codes): |
| | | # 获取所有监听中的代码 |
| | | first_codes = gpcode_manager.FirstGPCodesManager().get_first_gp_codes() |
| | | scores = {} |
| | | for code in codes: |
| | | if code not in first_codes: |
| | | continue |
| | | if code not in scores: |
| | | # 获取分数 |
| | | try: |
| | | limit_up_time = limit_up_time_manager.LimitUpTimeManager().get_limit_up_time_cache(code) |
| | | volume_rate, volume_info = code_volumn_manager.get_volume_rate(code, True) |
| | | (score, score_list), score_source_list = first_code_score_manager.get_score(code, volume_rate, |
| | | limit_up_time, |
| | | True) |
| | | scores[code] = score |
| | | except: |
| | | pass |
| | | return scores |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | get_limit_up_info() |
| | |
| | | # 判断是龙几,判断是否涨停,判断是否炸板,加载分数 |
| | | rank_dict = limit_up_data_filter.get_limit_up_time_rank_dict(total_datas) |
| | | limit_up_dict, limit_up_codes, open_limit_up_codes = limit_up_data_filter.get_limit_up_info(codes_set) |
| | | score_dict = limit_up_data_filter.get_codes_scores_dict(codes_set) |
| | | score_dict = {} |
| | | fresult = [] |
| | | ignore_codes = self.__IgnoreCodeManager.list_ignore_codes("1") |
| | | |
| | |
| | | # --数据准备开始-- |
| | | codes_set = set([d[0] for d in temps]) |
| | | limit_up_dict, limit_up_codes, open_limit_up_codes = limit_up_data_filter.get_limit_up_info(codes_set) |
| | | score_dict = limit_up_data_filter.get_codes_scores_dict(codes_set) |
| | | score_dict = {} |
| | | want_codes = gpcode_manager.WantBuyCodesManager().list_code_cache() |
| | | black_codes = BlackListCodeManager().list_codes() |
| | | total_datas = KPLLimitUpDataRecordManager.total_datas |