| | |
| | | |
| | | logger.add(self.get_path("system", "system"), filter=lambda record: record["extra"].get("name") == "system", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | # 显示在控制台 |
| | | logger.add(sys.stdout, |
| | | filter=lambda record: record["extra"].get("name") == "system", enqueue=True) |
| | | |
| | | logger.add(self.get_path("ths", "buy_1_volumn"), |
| | | filter=lambda record: record["extra"].get("name") == "buy_1_volumn", |
| | |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | def get_path(self, dir_name, log_name): |
| | | path_str = "{}/ls_logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name, log_name) + ".{time:YYYY-MM-DD}.log" |
| | | path_str = "{}/ls_logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name, |
| | | log_name) + ".{time:YYYY-MM-DD}.log" |
| | | # print(path_str) |
| | | return path_str |
| | | |
| | | def get_hx_path(self, dir_name, log_name): |
| | | path_str = "{}/ls_logs/huaxin/{}/{}".format(constant.get_path_prefix(), dir_name, |
| | | log_name) + ".{time:YYYY-MM-DD}.log" |
| | | log_name) + ".{time:YYYY-MM-DD}.log" |
| | | # print(path_str) |
| | | return path_str |
| | | |
| | | def get_local_huaxin_path(self, dir_name, log_name): |
| | | path_str = "{}/ls_logs/huaxin_local/{}/{}".format(constant.get_path_prefix(), dir_name, |
| | | log_name) + ".{time:YYYY-MM-DD}.log" |
| | | log_name) + ".{time:YYYY-MM-DD}.log" |
| | | # print(path_str) |
| | | return path_str |
| | | |
| | |
| | | # 初始化数据 |
| | | strategy_manager.low_suction_strtegy = strategy_manager.LowSuctionStrategy(tool.get_now_date_str()) |
| | | logger_system.info("初始化策略对象成功") |
| | | |
| | | |
| | | strategy_manager.low_suction_strtegy.load_data() |
| | | logger_system.info("加载策略数据成功") |
| | | |
| | | # -------启动L2 market订阅------ |
| | | __run_l2_market_subscript() |
| | |
| | | """ |
| | | |
| | | def __init__(self, day, script_name="strategy_script_v6.py", |
| | | settings=StrategyParamsSettingsManager().get_settings()): |
| | | settings=StrategyParamsSettingsManager().get_settings(), need_load_data = False): |
| | | self.now_day = day |
| | | # 买大单:{代码:[大单数据]} |
| | | self.big_order_buy = {} |
| | |
| | | |
| | | self.data_loader = DataLoader(self.now_day, cache_path=f"{constant.get_path_prefix()}/datas") |
| | | self.__LowSuctionOriginDataExportManager = LowSuctionOriginDataExportManager(self.now_day) |
| | | self.load_data() |
| | | if need_load_data: |
| | | self.load_data() |
| | | |
| | | def load_data(self): |
| | | # 加载历史数据 |
| | |
| | | continue |
| | | orderids.add(o[0]) |
| | | big_order_money += o[1] |
| | | threshold_money = max(sv.自由流通市值 // 1000, 200e4) |
| | | threshold_money = max(1.5 * sv.自由流通市值 // 1000, 200e4) |
| | | |
| | | limit_up_codes_count = max([(p, len(sv.开盘啦最正板块涨停.get(p, []))) for p in can_buy_plates], key=lambda x: x[1])[1] |
| | | |
| | | threshold_money *= max(10 - limit_up_codes_count + 3, 5) / 10 |
| | | # threshold_money *= max(10 - limit_up_codes_count + 3, 5) / 10 |
| | | if big_order_money < threshold_money: |
| | | return False, f"({big_order_money}/{threshold_money})大单金额不足" |
| | | |
| | |
| | | (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) // 3 if len(results) % 3 == 0 else len(results) // 3 + 1 |
| | | results = results[:max_count] |
| | | # results = results[:max_count] |
| | | # 取前10 |
| | | results = results[:10] |
| | | codes = [x[0] for x in results] |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | |
| | | __load_target_codes_v1() |
| | | # __load_target_codes_v1() |
| | | |
| | | __DataLoader = DataLoader("2025-06-12") |
| | | __DataLoader = DataLoader("2025-06-17") |
| | | # __test_jx_blocks(__DataLoader) |
| | | |
| | | # instance = StockVariables() |
| | |
| | | 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)) |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | # print("======3个票涨停之后买+开盘价>=-3") |
| | | # statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买.txt") |
| | | print("======3个票涨停之后买") |
| | | statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买.txt") |
| | | # print("======3个票涨停之后买+不限开盘涨幅+3个涨停之后大单打折") |
| | | # statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买_不限开盘涨幅.txt") |
| | | codes = set() |
| | |
| | | if p not in most_real_kpl_plate_limit_up_codes_info: |
| | | most_real_kpl_plate_limit_up_codes_info[p] = [] |
| | | most_real_kpl_plate_limit_up_codes_info[p].append(code) |
| | | # print(time_str, "涨停数大于3个", [p for p in most_real_kpl_plate_limit_up_codes_info if |
| | | # len(most_real_kpl_plate_limit_up_codes_info[p]) >= 3]) |
| | | |
| | | # ---------测试-------- |
| | | # test_plate = "化工" |
| | |
| | | stock_variables.板块成交代码 = self.deal_block_codes |
| | | |
| | | |
| | | # DEBUG_CODES = ['600727'] |
| | | # DEBUG_CODES = ['603579', '300884'] |
| | | DEBUG_CODES = [] |
| | | |
| | | VOLUME_LOG_ENABLE = False |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | back_test_dict = {} |
| | | # days = ["2025-05-06", "2025-05-07", "2025-05-08", "2025-05-09", "2025-05-12", "2025-05-13", "2025-05-14", |
| | | # "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20", "2025-05-21", "2025-05-22"] |
| | | days = ["2025-05-12", "2025-05-13", "2025-05-14", "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20", |
| | | "2025-05-21", "2025-05-22", "2025-05-23", "2025-05-26", "2025-05-27", "2025-05-28", "2025-05-29", |
| | | "2025-05-30", "2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-09", "2025-06-10", |
| | | "2025-06-11", "2025-06-12", "2025-06-13", "2025-06-16", "2025-06-17"] |
| | | "2025-05-30", "2025-06-03"] |
| | | # days = ["2025-05-12", "2025-05-13", "2025-05-14", "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20", |
| | | # "2025-05-21", "2025-05-22", "2025-05-23", "2025-05-26", "2025-05-27", "2025-05-28", "2025-05-29", |
| | | # "2025-05-30", "2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-09", "2025-06-10", |
| | | # "2025-06-11", "2025-06-12", "2025-06-13", "2025-06-16", "2025-06-17"] |
| | | |
| | | # days = ["2025-06-13"] |
| | | |