From 09f84c4ecae2a71e07f6dd64e6066563599a62b6 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 17 六月 2025 17:59:40 +0800 Subject: [PATCH] ‘功能完善 --- strategy/strategy_variable_factory.py | 43 +++++++++++++++++++++++++++++++++++++------ 1 files changed, 37 insertions(+), 6 deletions(-) diff --git a/strategy/strategy_variable_factory.py b/strategy/strategy_variable_factory.py index 97b9e28..7a29a7e 100644 --- a/strategy/strategy_variable_factory.py +++ b/strategy/strategy_variable_factory.py @@ -7,7 +7,7 @@ import re import constant -from code_attribute import global_data_loader +from code_attribute import global_data_loader, gpcode_manager from db import mysql_data_delegate from strategy.data_analyzer import KTickLineAnalyzer, KPLLimitUpDataAnalyzer, K60SLineAnalyzer from strategy.strategy_variable import StockVariables @@ -22,7 +22,7 @@ 鏁版嵁鍔犺浇鍣ㄧ被锛岀敤浜庨泦涓鐞嗙瓥鐣ュ彉閲忔墍闇�鐨勫悇绫绘暟鎹姞杞介�昏緫 """ - def __init__(self, now_day, cache_path="D:/datas"): + def __init__(self, now_day, cache_path=f"{constant.get_path_prefix()}/datas"): """ 鍒濆鍖栨暟鎹姞杞藉櫒 :param now_day: 褰撳墠鏃ユ湡锛屾牸寮忎负"2025-01-01" @@ -235,8 +235,8 @@ results = [x for x in results if (tool.is_can_buy_code(x[0]) and x[0] in valid_codes and x[0] not in exclude_codes)] # 鍙栧墠1/3涓旀定鍋滄暟鏄墠10 - max_count = len(results) // 2 if len(results) % 2 == 0 else len(results) // 2 + 1 - results = results[:max_count] + max_count = len(results) // 3 if len(results) % 3 == 0 else len(results) // 3 + 1 + # results = results[:max_count] # 鍙栧墠10 results = results[:10] codes = [x[0] for x in results] @@ -636,8 +636,39 @@ print(code, code_blocks[code]) +def __load_target_codes_v1(): + """ + 50浜夸互涓嬬殑 + @return: + """ + + def get_zylt(code): + zylt_volume_map = global_util.zylt_volume_map + last_trade_day = __DataLoader.trade_days[0] + volume = zylt_volume_map.get(code) + # 浠婃棩娑ㄥ仠浠疯绐佺牬鏄ㄦ棩鏈�楂樹环 + k_bars = HistoryKDataManager().get_history_bars(code, last_trade_day) + return k_bars[0]["close"] * volume * tool.get_limit_up_rate(code) + + __DataLoader = DataLoader('2025-06-13') + global_data_loader.load_zyltgb_volume_from_db() + results = __DataLoader.load_target_plate_and_codes() + # for k in results: + # print(k, results[k]) + plates = ["澶╃劧姘�", "鍐涘伐"] + print("==========鏂伴鏉�=======") + for p in plates: + codes = [x for x in results.get(p)] # if get_zylt(x) < 31e8 + print("======", p) + for code in codes: + print("\t\t", code, gpcode_manager.CodesNameManager().get_code_name(code)) + + if __name__ == "__main__": - __DataLoader = DataLoader("2025-06-12") + + # __load_target_codes_v1() + + __DataLoader = DataLoader("2025-06-17") # __test_jx_blocks(__DataLoader) # instance = StockVariables() @@ -655,7 +686,7 @@ results = __DataLoader.load_target_plate_and_codes() # for k in results: # print(k, results[k]) - plates = ["姹借溅闆堕儴浠�", "绋�鍦熸案纾�", "鍖栧伐", "鍖昏嵂", "鍏変紡"] + plates = ["鑴戞満鎺ュ彛"] print("==========鏂伴鏉�=======") for p in plates: print(p, results.get(p)) -- Gitblit v1.8.0