| | |
| | | "radical_buy": {"price": (constant.MIN_CODE_RADICAL_BUY_PRICE, constant.MAX_CODE_RADICAL_BUY_PRICE), |
| | | "zyltgb": constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES, |
| | | "top_block_count_by_market_strong": constant.RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG, |
| | | "special_codes_max_block_in_rank": constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL |
| | | "special_codes_max_block_in_rank": constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL, |
| | | "ignore_block_in_money":constant.IS_IGNORE_BLOCK_IN_MONEY_WITH_MARKET_STRONG |
| | | }} |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |
| | |
| | | if radical_buy.get("special_codes_max_block_in_rank"): |
| | | constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL = radical_buy.get( |
| | | "special_codes_max_block_in_rank") |
| | | |
| | | if radical_buy.get('ignore_block_in_money') is not None: |
| | | constant.IS_IGNORE_BLOCK_IN_MONEY_WITH_MARKET_STRONG = radical_buy.get('ignore_block_in_money') |
| | | self.send_response({"code": 0, "data": {}, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | if deal_big_order_info[1]/deal_big_order_info[2] > 0.8: |
| | | # 大单成交比例达到80%,半加红 |
| | | return constant.L_CANCEL_RATE_WITH_HALF_MUST_BUY_FOR_REDICAL_BUY, False |
| | | deal_rate = round(deal_big_order_info[1]/deal_big_order_info[2], 2) |
| | | threshold_rate = 0.5*deal_rate+0.35 |
| | | threshold_rate = max(threshold_rate, 0.375) |
| | | threshold_rate = min(threshold_rate, 0.95) |
| | | return threshold_rate, False |
| | | if must_buy: |
| | | if is_up: |
| | | return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True |
| | |
| | | |
| | | # 是否为新版下单 |
| | | IS_NEW_VERSION_PLACE_ORDER = True |
| | | |
| | | # 是否因为分数忽略板块流入 |
| | | IS_IGNORE_BLOCK_IN_MONEY_WITH_MARKET_STRONG = 0 |
| | |
| | | big_order_deal_enough_result = radical_buy_data_manager.is_big_order_deal_enough(code, |
| | | code_volumn_manager.CodeVolumeManager().get_volume_rate_refer_in_5days( |
| | | code), |
| | | refer_sell_money) |
| | | refer_sell_money, for_buy=True) |
| | | # 缺乏的大单金额 |
| | | lack_money = big_order_deal_enough_result[3] |
| | | # 如果有大单成交就不需要看大单 |
| | |
| | | def list_all_deleted_cache(self): |
| | | return self.__deleted_kpl_forbidden_plates_cache |
| | | |
| | | |
| | | def is_in_cache(self, plate): |
| | | if self.__kpl_forbidden_plates_cache and plate in self.__kpl_forbidden_plates_cache: |
| | | return True |
| | |
| | | cls.__market_strong = strong |
| | | |
| | | @classmethod |
| | | def is_ignore_block_in_money(cls): |
| | | if constant.IS_IGNORE_BLOCK_IN_MONEY_WITH_MARKET_STRONG and cls.__market_strong and cls.__market_strong >= 80: |
| | | return True |
| | | return False |
| | | |
| | | @classmethod |
| | | def get_market_strong(cls): |
| | | return cls.__market_strong |
| | | |
| | |
| | | big_order_deal_enough = is_big_order_deal_enough(code, volume_rate, 0) |
| | | if not big_order_deal_enough[0] and big_order_deal_enough[2]: |
| | | return False, "交易前两分钟大单不足", False |
| | | |
| | | jx_out_blocks = RealTimeKplMarketData.get_top_market_jingxuan_out_blocks() |
| | | if jx_out_blocks: |
| | | blocks = RadicalBuyBlockManager.get_code_blocks(code)[0] |
| | | same_blocks = blocks & set(jx_out_blocks) |
| | | if same_blocks: |
| | | return False, f"【{same_blocks}】板块精选流出", False |
| | | if not RealTimeKplMarketData.is_ignore_block_in_money(): |
| | | jx_out_blocks = RealTimeKplMarketData.get_top_market_jingxuan_out_blocks() |
| | | if jx_out_blocks: |
| | | blocks = RadicalBuyBlockManager.get_code_blocks(code)[0] |
| | | same_blocks = blocks & set(jx_out_blocks) |
| | | if same_blocks: |
| | | return False, f"【{same_blocks}】板块精选流出", False |
| | | |
| | | return True, "", False |
| | | |
| | |
| | | @param is_for_buy: 是否是买入 |
| | | @return:板块是否可买, 是否需要大单够 |
| | | """ |
| | | if RealTimeKplMarketData.is_ignore_block_in_money(): |
| | | return True, False |
| | | jx_in_blocks = RealTimeKplMarketData.get_top_market_jingxuan_blocks() |
| | | if jx_in_blocks and block in jx_in_blocks: |
| | | return True, False |
| | |
| | | return total_lack_money, deal_big_order_money, TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY |
| | | |
| | | |
| | | def is_big_order_deal_enough(code, volume_rate, refer_total_sell_money): |
| | | def is_big_order_deal_enough(code, volume_rate, refer_total_sell_money, for_buy=False): |
| | | """ |
| | | 大单成交是否足够 |
| | | @param refer_total_sell_money: 引用的总卖额 |
| | |
| | | |
| | | # ==========判断总大单成交================ |
| | | total_lack_money_info = get_total_deal_big_order_info(code, limit_up_price) |
| | | total_lack_money = total_lack_money_info[0] |
| | | total_lack_money, total_deal_money, total_threshold_money = total_lack_money_info[0], total_lack_money_info[1], \ |
| | | total_lack_money_info[2] |
| | | # ===========判断单次大单成交============== |
| | | current_big_order_deal_money = 0 |
| | | current_big_order_deal_money_info = EveryLimitupBigDealOrderManager.get_big_buy_deal_order_money_info(code) |
| | |
| | | else: |
| | | current_big_order_deal_money = current_big_order_deal_money_info[0] |
| | | current_lack_money = max(0, int(current_threshold_money - current_big_order_deal_money)) |
| | | if total_lack_money == 0 and current_lack_money == 0: |
| | | if for_buy: |
| | | total_lack_money = int(total_threshold_money * 0.8 - total_deal_money) |
| | | 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 |
| | | 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) |
| | |
| | | if rate >= THRESHOLD_RATE: |
| | | # 根据大单判断是否可以扫 |
| | | big_order_deal_result = radical_buy_data_manager.is_big_order_deal_enough(code, volume_rate, |
| | | refer_sell_money) |
| | | refer_sell_money, for_buy=True) |
| | | if big_order_deal_result[0]: |
| | | return BUY_MODE_DIRECT, f"剩余涨停总卖额-{selling_num * price},原涨停总卖-{total_sell},已成交额-{__deal_active_buy_total_money[code]},成交比例-{rate}/{THRESHOLD_RATE}, 大单信息-{big_order_deal_result}" |
| | | else: |
| | |
| | | MustBuyCodesManager().remove_code(code) |
| | | |
| | | # 如果是绿名单,下单之后就加红 |
| | | if GreenListCodeManager().is_in_cache(code): |
| | | MustBuyCodesManager().add_code(code) |
| | | trade_record_log_util.add_must_buy(code, "如果是绿名单,下单之后就加红") |
| | | # if GreenListCodeManager().is_in_cache(code): |
| | | # MustBuyCodesManager().add_code(code) |
| | | # trade_record_log_util.add_must_buy(code, "如果是绿名单,下单之后就加红") |
| | | |
| | | # 如果是扫入下单,下单之后就加红 |
| | | if order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL: |