| | |
| | | from third_data.kpl_data_constant import LimitUpCodesBlockRecordManager, LimitUpDataConstant |
| | | from third_data.kpl_limit_up_data_manager import LatestLimitUpBlockManager, CodeLimitUpSequenceManager |
| | | from third_data.third_blocks_manager import BlockMapManager |
| | | from trade.buy_radical.block_special_codes_manager import BlockSpecialCodesManager |
| | | from trade.buy_strategy import OpenLimitUpGoodBlocksBuyStrategy |
| | | from trade.buy_radical.radical_buy_data_manager import RadicalBuyBlockManager |
| | | from utils import global_util, tool, data_export_util |
| | |
| | | # (板块名称,涨停代码数量,炸板数量,涨停时间) |
| | | limit_up_reason_statistic_info = [(k, len(record_reason_dict[k]), len(record_reason_dict[k]) - len( |
| | | current_reason_dict.get(k) if k in current_reason_dict else []), |
| | | int(records_map.get([record_reason_dict[k][0]])[5])) for k in record_reason_dict] |
| | | 0) for k in record_reason_dict] |
| | | limit_up_reason_statistic_info.sort(key=lambda x: x[1] - x[2]) |
| | | limit_up_reason_statistic_info.reverse() |
| | | |
| | |
| | | # 获取涨停原因下面的代码 |
| | | ps_dict = dict([(k, v[0]) for k, v in parse_qs(url.query).items()]) |
| | | plate = kpl_util.filter_block(ps_dict["plate"]) |
| | | special_codes = BlockSpecialCodesManager().get_block_codes(plate) |
| | | if special_codes is None: |
| | | special_codes = set() |
| | | # 获取板块下的代码 |
| | | # 统计目前为止的代码涨停数量(分涨停原因) |
| | | now_limit_up_codes_info = self.__kplDataManager.get_data(KPLDataType.LIMIT_UP) |
| | |
| | | # 代码,名称,涨停时间,是否炸板,是否想买,是否已经下过单,涨停时间,自由流通市值,是否在黑名单里面 |
| | | codes_info.append( |
| | | [d[3], d[4], tool.to_time_str(int(d[5])), 1 if d[3] not in now_limit_up_codes else 0, 0, 0, d[12], |
| | | output_util.money_desc(d[13]), 1, 1 if l2_trade_util.is_in_forbidden_trade_codes(d[3]) else 0]) |
| | | output_util.money_desc(d[13]), 1, 1 if l2_trade_util.is_in_forbidden_trade_codes(d[3]) else 0, |
| | | 1 if d[3] in special_codes else 0]) |
| | | |
| | | for d in record_limit_up_datas: |
| | | if kpl_util.filter_block(d[2]) == plate: |
| | |
| | | # 获取涨停原因下面的代码 |
| | | ps_dict = dict([(k, v[0]) for k, v in parse_qs(url.query).items()]) |
| | | plate = kpl_util.filter_block(ps_dict["plate"]) |
| | | |
| | | special_codes = set() |
| | | plates = BlockMapManager().filter_blocks({plate}) |
| | | for p in plates: |
| | | _codes = BlockSpecialCodesManager().get_block_codes(p) |
| | | if _codes is None: |
| | | _codes = set() |
| | | special_codes |= _codes |
| | | |
| | | # 获取板块下的代码 |
| | | # 统计目前为止的代码涨停数量(分涨停原因) |
| | | now_limit_up_codes_info = self.__kplDataManager.get_data(KPLDataType.LIMIT_UP) |
| | |
| | | # 代码,名称,涨停时间,是否炸板,是否想买,是否已经下过单,涨停时间,自由流通市值,是否在黑名单里面 |
| | | codes_info.append( |
| | | [d[3], d[4], tool.to_time_str(int(d[5])), 1 if d[3] not in now_limit_up_codes else 0, 0, 0, d[12], |
| | | output_util.money_desc(d[13]), 1, 1 if l2_trade_util.is_in_forbidden_trade_codes(d[3]) else 0]) |
| | | output_util.money_desc(d[13]), 1, 1 if l2_trade_util.is_in_forbidden_trade_codes(d[3]) else 0, 1 if d[3] in special_codes else 0]) |
| | | codes_info.sort(key=lambda x: x[2]) |
| | | # 查询是否为想买单 |
| | | green_codes = gpcode_manager.GreenListCodeManager().list_codes_cache() |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | code = "603359" |
| | | records = code_info_output.load_trade_record_cancel_watch_indexes(code, |
| | | trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_H) |
| | | print(records) |
| | | # 统计目前为止的代码涨停数量(分涨停原因) |
| | | currents = LimitUpDataConstant.current_limit_up_datas |
| | | records = LimitUpDataConstant.history_limit_up_datas |
| | | if not currents: |
| | | currents = KPLDataManager.get_data(KPLDataType.LIMIT_UP) |
| | | # 获取历史涨停 |
| | | if not records: |
| | | KPLLimitUpDataRecordManager.load_total_datas() |
| | | records = KPLLimitUpDataRecordManager.total_datas |
| | | |
| | | records_map = {x[3]: x for x in records} |
| | | current_codes = [d[0] for d in currents] |
| | | record_codes = [d[3] for d in records] |
| | | # 计算涨停时间排序 |
| | | record_reason_dict = {} |
| | | current_reason_dict = {} |
| | | for _code in record_codes: |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(_code) |
| | | if not blocks: |
| | | blocks = set() |
| | | for b in blocks: |
| | | if b not in record_reason_dict: |
| | | record_reason_dict[b] = [] |
| | | record_reason_dict[b].append(_code) |
| | | for _code in current_codes: |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(_code) |
| | | if not blocks: |
| | | blocks = set() |
| | | for b in blocks: |
| | | if b not in current_reason_dict: |
| | | current_reason_dict[b] = [] |
| | | current_reason_dict[b].append(_code) |
| | | # (板块名称,涨停代码数量,炸板数量,涨停时间) |
| | | limit_up_reason_statistic_info = [(k, len(record_reason_dict[k]), len(record_reason_dict[k]) - len( |
| | | current_reason_dict.get(k) if k in current_reason_dict else []), |
| | | 0) for k in record_reason_dict] |
| | | limit_up_reason_statistic_info.sort(key=lambda x: x[1] - x[2]) |
| | | limit_up_reason_statistic_info.reverse() |
| | | |
| | | response_data = json.dumps({"code": 0, "data": {"limit_up_count": len(current_codes), |
| | | "open_limit_up_count": len(record_codes) - len(current_codes), |
| | | "limit_up_reason_statistic": limit_up_reason_statistic_info}}) |
| | | |
| | | # data = code_info_output.get_output_params(code, self.__jingxuan_cache_dict, self.__industry_cache_dict, |
| | | # trade_record_date=date) |