From 4bb98ab3b49687265fb60754d07610d50b3b8431 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 28 六月 2024 10:55:44 +0800 Subject: [PATCH] 水下捞相关数据删除/优化目标代码处理 --- l2/l2_data_manager_new.py | 137 --------------------------------------------- 1 files changed, 2 insertions(+), 135 deletions(-) diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py index 07a9e21..0aa17a8 100644 --- a/l2/l2_data_manager_new.py +++ b/l2/l2_data_manager_new.py @@ -705,11 +705,8 @@ # 涓嶅浜庡彲涓嬪崟鐘舵�� return False __start_time = tool.get_now_timestamp() - can, need_clear_data, reason = False, False, "" - if not is_first_code: - can, need_clear_data, reason = cls.__can_buy(code) - else: - can, need_clear_data, reason = cls.__can_buy_first(code) + + can, need_clear_data, reason = cls.__can_buy_first(code) # __start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - __start_time, "鏈�鍚庡垽鏂槸鍚﹁兘涓嬪崟", force=True) # 鍒犻櫎铏氭嫙涓嬪崟 @@ -821,136 +818,6 @@ # return False, "14:00鍚庤�佸ぇ閮藉紑鐩樻定鍋滐紝鑰佷簩涓嶈兘鎾ゅ崟" return True, "" - - # 鏄惁鍙互涔� - # 杩斿洖鏄惁鍙互涔�,鏄惁闇�瑕佹竻闄や箣鍓嶇殑涔板叆淇℃伅锛屽師鍥� - @classmethod - def __can_buy(cls, code): - __start_time = t.time() - if not cls.__TradeStateManager.is_can_buy_cache(): - return False, True, f"浠婃棩宸茬姝氦鏄�" - # 涔嬪墠鐨勪唬鐮� - # 棣栨澘浠g爜涓斿皻鏈定鍋滆繃鐨勪笉鑳戒笅鍗� - # is_limited_up = gpcode_manager.FirstCodeManager().is_limited_up(code) - # if not is_limited_up: - # gpcode_manager.FirstCodeManager().add_limited_up_record([code]) - # place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count( - # code) - # if place_order_count == 0: - # trade_data_manager.PlaceOrderCountManager().place_order(code) - # return False, True, "棣栨澘浠g爜锛屼笖灏氭湭娑ㄥ仠杩�" - - try: - # 涔�1浠锋牸蹇呴』涓烘定鍋滀环鎵嶈兘涔� - # buy1_price = cls.buy1PriceManager().get_price(code) - # if buy1_price is None: - # return False, "涔�1浠峰皻鏈幏鍙栧埌" - # limit_up_price = gpcode_manager.get_limit_up_price(code) - # if limit_up_price is None: - # return False, "灏氭湭鑾峰彇鍒版定鍋滀环" - # if abs(float(buy1_price) - float(limit_up_price)) >= 0.001: - # return False, "涔�1浠蜂笉涓烘定鍋滀环锛屼拱1浠�-{} 娑ㄥ仠浠�-{}".format(buy1_price, limit_up_price) - # 浠庝拱鍏ヤ俊鍙疯捣濮嬬偣鍒板綋鍓嶆暟鎹湯灏剧殑绾拱鎵嬫暟涓庡綋鍓嶇殑鍗�1鍋氭瘮杈冿紝濡傛灉姣斿崠1灏忓垯涓嶈兘涔板叆 - total_datas = local_today_datas[code] - if total_datas[-1]["index"] + 1 > len(total_datas): - return False, True, "L2鏁版嵁閿欒" - - try: - sell1_time, sell1_price, sell1_volumn = cls.__ths_l2_trade_queue_manager.get_sell1_info(code) - l2_log.buy_debug(code, "鍗�1淇℃伅涓猴細({},{},{})", sell1_time, sell1_price, sell1_volumn) - if sell1_time is not None and sell1_volumn > 0: - # 鑾峰彇鎵ц浣嶄俊鎭� - - order_begin_pos = cls.__get_order_begin_pos(code) - buy_nums = order_begin_pos.num - for i in range(order_begin_pos.buy_exec_index + 1, total_datas[-1]["index"] + 1): - _val = total_datas[i]["val"] - # 娑ㄥ仠涔� - if L2DataUtil.is_limit_up_price_buy(_val): - # 娑ㄥ仠涔� - buy_nums += _val["num"] * total_datas[i]["re"] - elif L2DataUtil.is_limit_up_price_buy_cancel(_val): - buy_nums -= _val["num"] * total_datas[i]["re"] - if buy_nums < sell1_volumn * 0.49: - return False, False, "绾拱閲�({})灏忎簬鍗�1閲忕殑49%{} 鍗�1鏃堕棿锛歿}".format(buy_nums, sell1_volumn, sell1_time) - except Exception as e: - logging.exception(e) - - # 閲忔瘮瓒呰繃1.3鐨勪笉鑳戒拱 - volumn_rate = cls.volume_rate_info[code][0] - if volumn_rate >= 1.3: - return False, False, "鏈�澶ч噺姣旇秴杩�1.3涓嶈兘涔�" - - limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code) - if limit_up_time is not None: - limit_up_time_seconds = l2.l2_data_util.L2DataUtil.get_time_as_second( - limit_up_time) - if limit_up_time_seconds >= l2.l2_data_util.L2DataUtil.get_time_as_second( - "13:00:00"): - return False, False, "浜屾澘涓嬪崍娑ㄥ仠鐨勪笉鑳戒拱锛屾定鍋滄椂闂翠负{}".format(limit_up_time) - if limit_up_time_seconds >= l2.l2_data_util.L2DataUtil.get_time_as_second("14:55:00"): - return False, False, "14:55鍚庢定鍋滅殑涓嶈兘涔帮紝娑ㄥ仠鏃堕棿涓簕}".format(limit_up_time) - - # 鍚屼竴鏉垮潡涓�佷簩鍚庨潰鐨勪笉鑳戒拱 - industry, codes = ths_industry_util.get_same_industry_codes(code, gpcode_manager.get_gp_list()) - if industry is None: - return True, False, "娌℃湁鑾峰彇鍒拌涓�" - - codes_index = industry_codes_sort.sort_codes(codes, code) - if codes_index is not None and codes_index.get(code) is not None and codes_index.get(code) > 1: - # 褰撹�佸ぇ鑰佷簩褰撳墠娌℃定鍋� - return False, False, "鍚屼竴鏉垮潡涓�佷笁,鑰佸洓,...涓嶈兘涔�" - - if cls.__codeActualPriceProcessor.is_under_water(code, total_datas[-1]["val"]["time"]): - # 姘翠笅鎹炰笖鏉垮潡涓殑绁ㄥ皬浜�16涓嶈兘涔� - # if global_util.industry_hot_num.get(industry) is not None and global_util.industry_hot_num.get( - # industry) <= 16: - # return False, "姘翠笅鎹�,鏉垮潡涓殑绁ㄥ皬浜�2鍙�,涓簕}".format(global_util.industry_hot_num.get(industry)) - # 姘翠笅鎹炶嚜鐢辨祦閫氬競鍊煎ぇ浜庤�佸ぇ鐨勪笉瑕佷拱 - if codes_index.get(code) != 0: - # 鑾峰彇鑰佸ぇ鐨勫競鍊� - for c in codes_index: - if codes_index.get(c) == 0 and global_util.zyltgb_map.get(code) > global_util.zyltgb_map.get(c): - return False, False, "姘翠笅鎹烇紝涓嶆槸鑰佸ぇ锛屼笖鑷敱娴侀�氬競鍊煎ぇ浜庤�佸ぇ" - - # 13:30鍚庢定鍋滐紝鏈澘鍧椾腑娑ㄥ仠绁ㄦ暟<29涓嶈兘涔� - # if limit_up_time is not None: - # if int(limit_up_time.replace(":", "")) >= 133000 and global_util.industry_hot_num.get(industry) is not None: - # if global_util.industry_hot_num.get(industry) < 16: - # return False, "13:30鍚庢定鍋滐紝鏈澘鍧椾腑娑ㄥ仠绁ㄦ暟<16涓嶈兘涔�" - - if codes_index.get(code) is not None and codes_index.get(code) == 1: - # 濡傛灉鑰佸ぇ宸茬粡涔版垚鍔熶簡, 鑰佷簩灏变笉闇�瑕佷拱浜� - first_codes = [] - for key in codes_index: - if codes_index.get(key) == 0: - first_codes.append(key) - # 鏆傛椂娉ㄩ噴鎺� - # for key in first_codes: - # state = trade_manager.get_trade_state(key) - # if state == trade_manager.TRADE_STATE_BUY_SUCCESS: - # # 鑰佸ぇ宸茬粡涔版垚鍔熶簡 - # return False, "鑰佸ぇ{}宸茬粡涔版垚鍔燂紝鑰佷簩鏃犻渶璐拱".format(key) - # - # # 鏈�9鐐瑰崐娑ㄥ仠鐨勮�佸ぇ鎵嶈兘涔拌�佷簩锛屼笉鐒朵笉鑳戒拱 - # # 鑾峰彇鑰佸ぇ鐨勬定鍋滄椂闂� - # for key in first_codes: - # # 鎵惧埌浜嗚�佸ぇ - # time_ = limit_up_time_manager.get_limit_up_time(key) - # if time_ == "09:30:00": - # return True, "9:30娑ㄥ仠鐨勮�佸ぇ锛岃�佷簩鍙互涓嬪崟" - # return False, "鑰佸ぇ闈�9:30娑ㄥ仠锛岃�佷簩涓嶈兘涓嬪崟" - - # 杩囨椂 鑰佷簩锛屾湰鏉垮潡涓定鍋滅エ鏁�<29 涓嶈兘涔� - # if codes_index.get(code) is not None and codes_index.get(code) == 1 and global_util.industry_hot_num.get( - # industry) is not None: - # if global_util.industry_hot_num.get(industry) < 29: - # return False, "鑰佷簩锛屾湰鏉垮潡涓定鍋滅エ鏁�<29涓嶈兘涔�" - # 鍙互涓嬪崟 - return True, False, None - finally: - # l2_data_log.l2_time(code, round((t.time() - __start_time) * 1000), "鏄惁鍙互涓嬪崟璁$畻") - pass @classmethod def __can_buy_first(cls, code): -- Gitblit v1.8.0