bug修复/回踩不够拉黑/闪电下单涨停挂单笔数必须≥5笔
| | |
| | | return False |
| | | |
| | | |
| | | # 连续涨停后是否回调不足够 |
| | | def is_continue_limit_up_not_enough_fall_dwon(record_datas): |
| | | # 10 天内是否有连续3板 |
| | | datas = copy.deepcopy(record_datas) |
| | | datas.sort(key=lambda x: x["bob"]) |
| | | datas = datas[0 - 10:] |
| | | limit_up_continue_count_info = None |
| | | max_limit_up_continue_count_info_list = [] # [连续涨停次数,涨停起点] |
| | | |
| | | for i in range(len(datas)): |
| | | item = datas[i] |
| | | if __is_limit_up(item): |
| | | if not limit_up_continue_count_info: |
| | | limit_up_continue_count_info = [1, i] |
| | | else: |
| | | limit_up_continue_count_info[0] += 1 |
| | | else: |
| | | if limit_up_continue_count_info: |
| | | max_limit_up_continue_count_info_list.append(limit_up_continue_count_info) |
| | | limit_up_continue_count_info = None |
| | | max_limit_up_info = None |
| | | for x in max_limit_up_continue_count_info_list: |
| | | if max_limit_up_info is None: |
| | | max_limit_up_info = x |
| | | if max_limit_up_info[0] <= x[0]: |
| | | max_limit_up_info = x |
| | | |
| | | if not max_limit_up_info or max_limit_up_info[0] < 3: |
| | | print("无3连板") |
| | | return False |
| | | start_index = max_limit_up_info[1] |
| | | max_price_info = [0, None] |
| | | for i in range(start_index, len(datas)): |
| | | item = datas[i] |
| | | if item["high"] > max_price_info[0]: |
| | | max_price_info = [item["high"], i] |
| | | # 计算回踩价格 |
| | | lowest_price_threhhold = round((1-0.28) * max_price_info[0], 2) |
| | | for i in range(max_price_info[1] + 1, len(datas)): |
| | | item = datas[i] |
| | | if item["low"] < lowest_price_threhhold: |
| | | print("回踩足够") |
| | | return False |
| | | return True |
| | | |
| | | |
| | | # 是否有涨停 |
| | | def get_first_limit_up_count(datas): |
| | | datas = copy.deepcopy(datas) |
| | |
| | | # 获取60天最大记录 |
| | | for code in codes: |
| | | need_get_volumn = False |
| | | if code not in global_util.max60_volumn or global_util.max60_volumn.get(code) is None or code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code) is None: |
| | | if code not in global_util.max60_volumn or global_util.max60_volumn.get( |
| | | code) is None or code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code) is None: |
| | | need_get_volumn = True |
| | | # if not need_get_volumn and code_nature_analyse.CodeNatureRecordManager.get_nature_cache( |
| | | # code) is None: |
| | |
| | | if code_nature_analyse.is_price_too_high_in_days(volumes_data, limit_up_price): |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "6天内股价长得太高") |
| | | # HighIncreaseCodeManager().add_code(code) |
| | | |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(volumes_data): |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "回踩不够") |
| | | |
| | | if code_nature_analyse.is_have_latest_max_volume(volumes_data, 2): |
| | | # 最近2天是否是最高量 |
| | |
| | | gpcode_first_screen_manager.process_ticks(prices) |
| | | logger_l2_codes_subscript.info(f"({request_id})l2代码相关数据加载完成") |
| | | return tick_datas |
| | | |
| | |
| | | logger_l2_l_cancel.exception(e) |
| | | raise e |
| | | extra_msg = "L后" |
| | | if not can_cancel and int(tool.get_now_time_str().replace(":", "")) > int("100000"): |
| | | if not can_cancel: |
| | | # 成交位临近撤 |
| | | try: |
| | | can_cancel, cancel_data = self.__compute_near_by_trade_progress_need_cancel(code, buy_exec_index, |
| | |
| | | buy_count -= int(total_datas[i]["re"]) |
| | | l2_log.buy_debug(code, "位置-{},总手数:{},目标手数:{}", i, |
| | | buy_nums, threshold_num) |
| | | # 有撤单信号,且小于阈值 |
| | | if buy_nums >= threshold_num and trigger_buy: |
| | | # 纯买额足够,且笔数大于5笔 |
| | | if buy_nums >= threshold_num and trigger_buy and buy_count>=5: |
| | | try: |
| | | info = cls.__trade_log_placr_order_info_dict[code] |
| | | info.set_trade_factor(threshold_money, 0, []) |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | code = "000897" |
| | | limit_up_price = 2.39 |
| | | code = "002167" |
| | | volumes_data = init_data_util.get_volumns_by_code(code, 150) |
| | | volumes = init_data_util.parse_max_volume(volumes_data[:90], |
| | | code_nature_analyse.is_new_top( |
| | | limit_up_price, |
| | | volumes_data[:90]) or code_nature_analyse.is_near_top( |
| | | limit_up_price, |
| | | volumes_data[:90])) |
| | | print(volumes) |
| | | volumes_data=volumes_data[0:] |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(volumes_data): |
| | | print("回踩不够") |
| | |
| | | |
| | | |
| | | def __getLimitUpInfo(pidType, page, pageSize): |
| | | data = f"Order=0&a=DailyLimitPerformance&st={pageSize}&apiv=w35&Type=4&c=HomeDingPan&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.13.0.0&Index={(page - 1) * pageSize}&PidType={pidType}&" |
| | | data = f"Order=0&a=DailyLimitPerformance&st={pageSize}&apiv=w35&Type=4&c=HomeDingPan&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e24&VerSion=5.13.0.0&Index={(page - 1) * pageSize}&PidType={pidType}&" |
| | | result = __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data) |
| | | print(result) |
| | | return result |
| | | |
| | | |
| | |
| | | for pid_info in pids: |
| | | results = [] |
| | | for i in range(10): |
| | | start_time = time.time() |
| | | result = __getLimitUpInfo(pid_info[0], i + 1, 20) |
| | | print("请求用时", time.time() - start_time) |
| | | result = json.loads(result) |
| | | datas = result["info"][0] |
| | | results.extend(datas) |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | print(getLimitUpInfoNew()) |
| | | |
| | |
| | | __current_delegate_records_cache = fresults |
| | | |
| | | # 获取当前处于委托状态的订单 |
| | | def list_current_delegates(self): |
| | | def list_current_delegates(self, code=None): |
| | | if self.__current_delegate_records_dict_cache: |
| | | return [self.__current_delegate_records_dict_cache[k] for k in self.__current_delegate_records_dict_cache] |
| | | fresults = [] |
| | | for k in self.__current_delegate_records_dict_cache: |
| | | if code and self.__current_delegate_records_dict_cache[k]["securityID"] != code: |
| | | continue |
| | | fresults.append(self.__current_delegate_records_dict_cache[k]) |
| | | return fresults |
| | | return None |
| | | |
| | | @classmethod |
| | |
| | | else: |
| | | deal_order_system_id_infos[d["orderSysID"]][0] += d["volume"] |
| | | # 获取9:30之前的卖委托 |
| | | current_delegates = DelegateRecordManager().list_current_delegates() |
| | | current_delegates = DelegateRecordManager().list_current_delegates(code) |
| | | if current_delegates: |
| | | for d in current_delegates: |
| | | if d["orderSysID"] not in deal_order_system_id_infos: |