| | |
| | | |
| | | |
| | | # 获取K线形态 |
| | | # 返回 (15个交易日涨幅是否大于24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V,是否有形态,天量大阳信息,是否具有辨识度,近2天有10天内最大量,上个交易日是否炸板) |
| | | # 返回 (15个交易日涨幅是否大于24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V,是否有形态,天量大阳信息,是否具有辨识度,近2天有10天内最大量,上个交易日是否炸板, 上个交易日是否跌停) |
| | | def get_k_format(code, limit_up_price, record_datas): |
| | | p1_data = get_lowest_price_rate(code, record_datas) |
| | | p1 = p1_data[0] >= 0.249, p1_data[1] |
| | |
| | | # 是否具有辨识度 |
| | | p9 = is_special(code, record_datas) |
| | | p10 = is_latest_10d_max_volume_at_latest_2d(code, record_datas) |
| | | # 最近5天是否炸板 |
| | | p11 = __is_latest_open_limit_up(code, record_datas, 5) |
| | | # 最近5天是否有炸板/涨停/跌停 |
| | | p11 = __has_latest_throwing_pressure(code, record_datas, 5) |
| | | # 90天内是否有涨停 |
| | | p12 = __has_limit_up(code, record_datas, 90) |
| | | # 上个交易日是否跌幅过大 |
| | | # 上个交易日是否振幅过大 |
| | | p13 = __is_pre_day_limit_rate_too_low(code, record_datas) |
| | | # 60个交易日是否曾涨停 |
| | | p14 = __has_limited_up(code, record_datas, 60) |
| | | # 昨日是否涨停过 |
| | | p15 = __has_limited_up(code, record_datas, 1) |
| | | # 昨日是否跌停 |
| | | p16 = __is_latest_limit_down(code, record_datas, 1) |
| | | |
| | | return p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 |
| | | return p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16 |
| | | |
| | | |
| | | # 是否具有K线形态 |
| | |
| | | return False, '' |
| | | |
| | | |
| | | # 最近几天是否有炸板或跌停 |
| | | def __is_latest_open_limit_up(code, datas, day_count): |
| | | def __has_latest_throwing_pressure(code, datas, day_count): |
| | | """ |
| | | 最近释放有抛压 |
| | | @param code: |
| | | @param datas: |
| | | @param day_count: |
| | | @return: 是否有抛压, None/(p高价数据, t高价数据) |
| | | """ |
| | | datas = copy.deepcopy(datas) |
| | | datas.sort(key=lambda x: x["bob"]) |
| | | items = datas[0 - day_count:] |
| | | for item in items: |
| | | target_item = None |
| | | for i in range(len(items) - 1, -1, -1): |
| | | item = items[i] |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, item["pre_close"])) |
| | | limit_down_price = float(gpcode_manager.get_limit_down_price_by_preprice(code, item["pre_close"])) |
| | | if abs(limit_up_price - item["high"]) < 0.001 or abs(limit_down_price - item["close"]) < 0.001: |
| | | # 炸板 # 或涨停 # 或者跌停 |
| | | return True |
| | | return False |
| | | target_item = item |
| | | break |
| | | if not target_item: |
| | | return False, None |
| | | p_price, p_volume = target_item["high"], target_item["volume"] |
| | | t_price, t_volume = 0, 0 |
| | | for i in range(len(items) - 1, -1, -1): |
| | | item = items[i] |
| | | if item["bob"] == target_item["bob"]: |
| | | break |
| | | if item["high"] >= p_price * 1.03: |
| | | t_price, t_volume = item["high"], item["volume"] |
| | | break |
| | | if t_price > 0: |
| | | return True, ((p_price, p_volume), (t_price, t_volume)) |
| | | else: |
| | | return True, ((p_price, p_volume), None) |
| | | |
| | | |
| | | def __is_latest_limit_down(code, datas, day_count): |
| | |
| | | for item in items: |
| | | # 是否有跌停 |
| | | # 获取当日涨幅 |
| | | rate = (item["close"] - item["pre_close"]) / item["pre_close"] |
| | | threshold_rate_ = round(0 - ((1 - tool.get_limit_down_rate(code)) * 0.9), 2) |
| | | if rate < threshold_rate_: |
| | | rate_open = (item["open"] - item["pre_close"]) / item["pre_close"] |
| | | rate_close = (item["close"] - item["pre_close"]) / item["pre_close"] |
| | | threshold_rate_ = 0.15 |
| | | if abs(rate_open - rate_close) >= threshold_rate_: |
| | | return True |
| | | return False |
| | | |
| | |
| | | |
| | | if not WantBuyCodesManager().is_in_cache( |
| | | code) and not gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(code): |
| | | if len(k_format) > 10 and k_format[10]: |
| | | l2_trade_util.forbidden_trade(code, "近5个交易日有涨停/炸板/跌停") |
| | | continue |
| | | # 新题材破前高就不需要加黑 |
| | | # 新题材该拉黑还是拉黑 |
| | | need_forbidden = True #new_block_processor.is_can_forbidden(code) |
| | |
| | | |
| | | if tool.is_ge_code(code) and float(limit_up_price) < 10: |
| | | l2_trade_util.forbidden_trade(code, "创业板股价10块内") |
| | | continue |
| | | |
| | | if len(k_format) > 14 and k_format[14]: |
| | | l2_trade_util.forbidden_trade(code, "昨日炸板") |
| | | l2_trade_util.forbidden_trade(code, "上个交易日涨停/炸板") |
| | | continue |
| | | |
| | | if len(k_format) > 15 and k_format[15]: |
| | | l2_trade_util.forbidden_trade(code, "上个交易日跌停") |
| | | continue |
| | | |
| | | if len(k_format) > 12 and k_format[12]: |
| | | l2_trade_util.forbidden_trade(code, "上个交易日振幅过大") |
| | | continue |
| | | |
| | | # if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(code, volumes_data): |
| | |
| | | else: |
| | | if average_rate < 0.04: |
| | | return False, True, f"均价涨幅({average_rate})小于4%", True |
| | | |
| | | if not gpcode_manager.WantBuyCodesManager().is_in_cache(code): |
| | | zyltgb_as_yi = round(global_util.zyltgb_map.get(code) / 100000000, |
| | | 2) if code in global_util.zyltgb_map else None |
| | | if zyltgb_as_yi and zyltgb_as_yi < 40: |
| | | return False, True, f"自由流通市值小于({zyltgb_as_yi})< 40亿", True |
| | | return True, False, f"", False |
| | | |
| | | @classmethod |
| | |
| | | |
| | | import constant |
| | | import l2_data_util |
| | | from code_attribute.code_volumn_manager import CodeVolumeManager |
| | | from l2 import l2_data_util as l2_data_util_new, l2_log |
| | | from code_attribute import code_nature_analyse, code_volumn_manager, gpcode_manager |
| | | from code_attribute.code_l1_data_manager import L1DataManager |
| | |
| | | return False, "自由流通市值/价格不满足扫的范围", True |
| | | # 判断昨日是否跌幅过大 |
| | | if k_format and len(k_format) > 12 and k_format[12]: |
| | | return False, "上个交易日跌幅过大", True |
| | | return False, "上个交易日振幅过大", True |
| | | |
| | | # 是否有抛压 |
| | | if len(k_format) > 10 and k_format[10][0]: |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | # 近5个交易日有涨停/炸板/跌停 |
| | | price_info = k_format[10][1] |
| | | p_price_info = price_info[0] # (价格,量) |
| | | t_price_info = price_info[1] # (价格,量)/None |
| | | # 初始化不能买 |
| | | can_buy = False |
| | | # 抛压已释放:今日涨停价≥T高价且T高价当日成交量≥P高价对应的那一天的成交量*101% |
| | | if t_price_info and limit_up_price >= t_price_info[0] and t_price_info[1] >= p_price_info[0] * 1.01: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | # 抛压当日大幅释放:今日涨停价≥T高价+2%且今日涨停实时成交量≥T高价当日成交量*90% |
| | | if t_price_info and limit_up_price >= t_price_info[0] * 1.02: |
| | | today_volume = CodeVolumeManager().get_today_volumn_cache(code) |
| | | if today_volume >= t_price_info[1] * 0.9: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | # 抛压今日强势释放:没有T高价时,今日涨停价≥P高价+6%且今日涨停实时成交量≥P高价当日成交量*101% |
| | | if not t_price_info and limit_up_price >= p_price_info[0] * 1.06: |
| | | today_volume = CodeVolumeManager().get_today_volumn_cache(code) |
| | | if today_volume >= p_price_info[1] * 1.01: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | return False, "抛压没释放", False |
| | | |
| | | if gpcode_manager.BlackListCodeManager().is_in_cache(code): |
| | | if deal_codes is not None and code in deal_codes: |
| | |
| | | if total_lack_money < 0: |
| | | total_lack_money = 0 |
| | | if current_lack_money == 0 and total_lack_money == 0: |
| | | return True, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, 0, total_lack_money <=0 |
| | | return True, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, 0, total_lack_money <= 0 |
| | | return False, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, max( |
| | | current_lack_money, total_lack_money), total_lack_money<=0 |
| | | current_lack_money, total_lack_money), total_lack_money <= 0 |
| | | |
| | | |
| | | class EveryLimitupBigDealOrderManager: |
| | |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | |
| | | def pull_pre_deal_big_orders_by_codes(codes): |
| | | for code in codes: |
| | | try: |