From bda4216d608a12db7132c97083c19ecdad48d78f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 28 八月 2024 18:29:21 +0800 Subject: [PATCH] 激进买入 --- third_data/code_plate_key_manager.py | 73 +++++++++++++++++++++++++++++++++--- 1 files changed, 66 insertions(+), 7 deletions(-) diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py index cdd0181..57c7ef1 100644 --- a/third_data/code_plate_key_manager.py +++ b/third_data/code_plate_key_manager.py @@ -4,12 +4,13 @@ # 娑ㄥ仠浠g爜鍏抽敭璇嶆澘鍧楃鐞� import copy +import datetime import json import time import constant from db.redis_manager_delegate import RedisUtils -from third_data import kpl_block_util, kpl_api, kpl_util +from third_data import kpl_block_util, kpl_api, kpl_util, kpl_data_constant, huaxin_l1_data_manager from settings.trade_setting import MarketSituationManager from third_data.history_k_data_manager import HistoryKDataManager from third_data.history_k_data_util import HistoryKDatasUtils @@ -511,7 +512,7 @@ return self.__redisManager.getRedis() # 杩斿洖key闆嗗悎(鎺掗櫎鏃犳晥鏉垮潡),浠婃棩娑ㄥ仠鍘熷洜,浠婃棩鍘嗗彶娑ㄥ仠鍘熷洜,鍘嗗彶娑ㄥ仠鍘熷洜,浜岀骇,绮鹃�夋澘鍧� - def get_plate_keys(self, code): + def get_plate_keys(self, code, contains_today = True): """ 鑾峰彇浠g爜鐨勬澘鍧�: 锛�180澶╃殑娑ㄥ仠鍘熷洜+鎺ㄨ崘鍘熷洜锛�+浠婃棩娑ㄥ仠鍘熷洜+浠婃棩娑ㄥ仠鎺ㄨ崘鍘熷洜+浠婃棩鎺ㄨ崘鍘熷洜 @param code: @@ -543,12 +544,13 @@ if jingxuan_block_info: jingxuan_blocks = jingxuan_block_info[0] k4 |= set(jingxuan_blocks) # set([x[1] for x in jingxuan_blocks]) - if k1: + if k1 and contains_today: # 娑ㄥ仠杩� keys |= k1 # 鑾峰彇涓嶅埌娑ㄥ仠鍘熷洜 - keys |= k4 + if contains_today: + keys |= k4 keys = keys - set(constant.KPL_INVALID_BLOCKS) return keys, k1, k11, k2, k3, k4 @@ -852,14 +854,18 @@ # 鍔犺浇娑ㄥ仠浠g爜鐨勭洰鏍囨澘鍧� def load_code_block(): if limit_up_record_datas: + # 鑾峰彇浠婃棩9:30浠ュ墠鐨勬椂闂� + time_str = datetime.datetime.now().strftime("%Y-%m-%d") + " 09:30:00" + timestamp = time.mktime(time.strptime(time_str, '%Y-%m-%d %H:%M:%S')) + for d in limit_up_record_datas: if d[2] in constant.KPL_INVALID_BLOCKS and d[3] in before_blocks_dict: code_limit_up_reasons_dict[d[3]] = {list(before_blocks_dict.get(d[3]))[0]} else: code_limit_up_reasons_dict[d[3]] = {d[2]} - # 涓嶅寘鍚帹鑽愬師鍥� - # if d[6]: - # code_limit_up_reasons_dict[d[3]] |= set(d[6].split("銆�")) + # 寮�1鎵嶈兘鍖呭惈鎺ㄨ崘鍘熷洜 + if d[6] and int(d[5]) < timestamp: + code_limit_up_reasons_dict[d[3]] |= set(d[6].split("銆�")) return code_limit_up_reasons_dict if current_limit_up_datas is None: @@ -1045,5 +1051,58 @@ can_buy_blocks, unique, msg, can_buy_strong_blocks, keys, active_buy_blocks) + + @classmethod + def compute_open_limit_up_code_dict_for_radical_buy(cls, current_limit_up_datas): + """ + 璁$畻寮�1鐨勪唬鐮佷俊鎭紝涓嶅寘鍚�5鏉夸互涓婄殑 + @param current_limit_up_datas: + @return: + """ + time_str = datetime.datetime.now().strftime("%Y-%m-%d") + " 09:30:00" + timestamp = time.mktime(time.strptime(time_str, '%Y-%m-%d %H:%M:%S')) + temp_dict = {} + for d in current_limit_up_datas: + code = d[0] + # d: (浠g爜, 鍚嶇О, 棣栨娑ㄥ仠鏃堕棿, 鏈�杩戞定鍋滄椂闂�, 鍑犳澘, 娑ㄥ仠鍘熷洜, 鏉垮潡, 瀹為檯娴侀��, 涓诲姏鍑�棰�,娑ㄥ仠鍘熷洜浠g爜,娑ㄥ仠鍘熷洜浠g爜鏁伴噺) + # 璁$畻鏄惁寮�1 + if int(d[2]) >= timestamp: + continue + # 鍓旈櫎5鏉夸互涓婄殑 + if d[4].find("杩炴澘") > 0 and int(d[4].replace("杩炴澘","")) >=5: + continue + buy1_money = huaxin_l1_data_manager.get_buy1_money(code) + if not buy1_money or buy1_money < 1e8: + continue + if not tool.is_can_buy_code(code): + continue + # 涔�1鏄惁澶т簬1浜� + blocks = {d[5]} + if d[6]: + blocks |= set(d[6].split("銆�")) + blocks-=constant.KPL_INVALID_BLOCKS + temp_dict[code] = (kpl_util.get_high_level_count(d[4]), d[6]) + kpl_data_constant.open_limit_up_code_dict_for_radical_buy = temp_dict + + + @classmethod + def is_radical_buy(cls, code): + """ + 鏄惁鏄縺杩涗拱 + @param code: + @return: + """ + # 鑾峰彇浠婃棩寮�涓�鐨勪唬鐮�,鍓旈櫎5鏉夸互涓婄殑 + current_limit_up_datas = kpl_data_constant.current_limit_up_datas + # 璁$畻 + + # 鑾峰彇浠g爜鐨勬澘鍧� + keys_, k1_, k11_, k2_, k3_, k4_ = cls.__TargetCodePlateKeyManager.get_plate_keys(code, contains_today=False) + # 鑾峰彇 + + + + + if __name__ == "__main__": pass -- Gitblit v1.8.0