From d6b6be5eb2ae00a8ccf46bd7d53cd7d0c1e59c72 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 24 十一月 2023 19:19:37 +0800 Subject: [PATCH] 初始化独立某些方法 --- inited_data.py | 86 ------------------------------------------- 1 files changed, 0 insertions(+), 86 deletions(-) diff --git a/inited_data.py b/inited_data.py index 3891bf5..b735ee9 100644 --- a/inited_data.py +++ b/inited_data.py @@ -208,93 +208,7 @@ symbol = symbol.split(".")[1] -# 璁剧疆鏀剁洏浠� -def re_set_price_pre(code): - codes = [code] - re_set_price_pres(codes) - - -def re_set_price_pres(codes, force=False): - result = HistoryKDatasUtils.get_gp_latest_info(codes) - for item in result: - symbol = item['symbol'] - symbol = symbol.split(".")[1] - pre_close = tool.to_price(decimal.Decimal(str(item['pre_close']))) - gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force) - - __prices_now = {} - - -# 鑾峰彇杩�90澶╃殑鏈�澶ч噺涓庢渶杩戠殑閲� -# 鑾峰彇鏈�杩戜竴娆℃定鍋�/娑ㄥ仠涓嬩竴涓氦鏄撴棩鐨勬渶澶у�� -def get_volumns_by_code(code, count=60) -> object: - datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount") - # 璁$畻 - datas.sort(key=lambda x: x["bob"], reverse=True) - return datas - - -# 瑙f瀽鏈�澶ч噺 -def parse_max_volume(datas, is_new_top=False): - max_volume = 0 - - max_volume_date = None - if is_new_top: - # 濡傛灉鏄獊鐮村墠楂樺氨鍙栨渶澶ч噺 - for item in datas: - if max_volume < item["volume"]: - max_volume = item["volume"] - max_volume_date = item["bob"] - return max_volume, max_volume, max_volume_date.strftime("%Y-%m-%d") - else: - - date = None - target_volume = None - for i in range(len(datas)): - # 鏌ヨ娑ㄥ仠 - item = datas[i] - volume = item["volume"] - if max_volume < volume: - max_volume = volume - max_volume_date = item['bob'] - # 鏄惁鏈夋定鍋� - limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) - if abs(limit_up_price - item["high"]) < 0.01: - # 娑ㄥ仠 - next_volume = 0 - if i > 0: - next_volume = datas[i - 1]["volume"] - date = datas[i]["bob"] - if volume < next_volume: - volume = next_volume - date = datas[i - 1]["bob"] - target_volume = (volume, date) - break - if not target_volume: - target_volume = (max_volume, max_volume_date) - - # --鍒ゆ柇杩�60澶╂棤娑ㄥ仠鐨勬渶澶ч噺 - max_60_volume_info = [0, None] - # 60澶╁唴鏄惁鏈夋定鍋� - has_60_limit_up = False - for i in range(60): - if i >= len(datas): - break - item = datas[i] - volume = item["volume"] - if max_60_volume_info[0] < volume: - max_60_volume_info = [volume, item["bob"]] - limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) - if abs(limit_up_price - item["high"]) < 0.01: - has_60_limit_up = True - break - - if not has_60_limit_up and target_volume[0] > max_60_volume_info[0] * 3: - # 60澶╁唴鏃犳定鍋�,涓�60澶╁唴鏈�澶ч噺灏忎簬鏈�澶ч噺鐨�1/3,鍒ゆ柇涓哄湴閲�,杩斿洖杩�60涓氦鏄撴棩鐨勬渶澶ч噺 - return max_60_volume_info[0], max_60_volume_info[0], max_60_volume_info[1].strftime("%Y-%m-%d") - else: - return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d") # 淇濆瓨杩愯鏃舵暟鎹� -- Gitblit v1.8.0