| | |
| | | return cancel_reason_dict |
| | | |
| | | |
| | | |
| | | def __parse_content(line): |
| | | line = line.split(" - ")[1] |
| | | time_str = line[line.find("[") + 1:line.find("[") + 9] |
| | | data = line[line.find("]") + 1:].strip() |
| | | if data.find("thread-id=")>-1 and data.find("code=")>-1: |
| | | data = data[data.find("code=")+11:].strip() |
| | | return time_str, data |
| | | |
| | | |
| | | # 加载l2订单成交数据 |
| | | @cache_log |
| | | def load_huaxin_deal_record(code, date=tool.get_now_date_str()): |
| | | datas_dict = load_huaxin_deal_record_all(date) |
| | | return datas_dict.get(code) |
| | | |
| | | |
| | | @cache_log |
| | | def load_huaxin_deal_record_all(date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/l2/transaction_desc.{date}.log" |
| | | # 格式:[(订单号,手数,开始成交时间,成交结束时间,下单手数)] |
| | | fdatas = [] |
| | | fdatas = {} |
| | | lines = __load_file_content(path) |
| | | for line in lines: |
| | | data_index = line.find(f"{code}#") |
| | | data_index = line.find(f"#") |
| | | if data_index > 0: |
| | | line = line.split(" - ")[1] |
| | | time_str = line[line.find("[") + 1:line.find("[") + 9] |
| | | data = line[line.find("]") + 1:].strip() |
| | | time_str, data = __parse_content(line) |
| | | code = data.split("#")[0] |
| | | data = data.split("#")[1] |
| | | data = eval(data) |
| | | fdatas.append(data) |
| | | if code not in fdatas: |
| | | fdatas[code] = [] |
| | | fdatas[code].append(data) |
| | | return fdatas |
| | | |
| | | |
| | |
| | | data = line.split(" - ")[1].strip() |
| | | if data.startswith("["): |
| | | data = data[data.find("]") + 1:].strip() |
| | | if data.find("有涨停主动卖:") < 0: |
| | | continue |
| | | data = data.split("有涨停主动卖:")[1] |
| | | code_ = data[:6] |
| | | if code and code != code_: |
| | |
| | | if code_ not in fdatas: |
| | | fdatas[code_] = [] |
| | | fdatas[code_].append((time_str, volume)) |
| | | return fdatas |
| | | |
| | | |
| | | |
| | | @cache_log |
| | | def load_huaxin_l2_sell_deal_list(code=None, date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/l2/sell_l2_deal.{date}.log" |
| | | fdatas = {} |
| | | if os.path.exists(path): |
| | | with open(path, 'r', encoding="utf-8") as f: |
| | | lines = f.readlines() |
| | | for line in lines: |
| | | if line: |
| | | time_str = __get_async_log_time(line) |
| | | data = line.split(" - ")[1].strip() |
| | | if data.startswith("["): |
| | | data = data[data.find("]") + 1:].strip() |
| | | if data.find("涨停主动买成交:") <0: |
| | | continue |
| | | data = data.split("涨停主动买成交:")[1] |
| | | data = eval(data) |
| | | code_ = data[0][0] |
| | | if code and code != code_: |
| | | continue |
| | | if code_ not in fdatas: |
| | | fdatas[code_] = [] |
| | | fdatas[code_].append((time_str, data)) |
| | | return fdatas |
| | | |
| | | |
| | |
| | | return fdatas |
| | | |
| | | |
| | | def load_special_codes(date=tool.get_now_date_str()): |
| | | """ |
| | | 加载之前的收盘价 |
| | | @param date: |
| | | @return: |
| | | """ |
| | | fdatas = {} |
| | | path = f"{constant.get_path_prefix()}/logs/gp/plates/special_codes.{date}.log" |
| | | lines = __load_file_content(path) |
| | | if lines: |
| | | line = lines[0] |
| | | line = line[line.find(" - ") + 3:] |
| | | return eval(line) |
| | | return None |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | load_huaxin_transaction_sell_no(code='2024-11-10') |
| | | load_huaxin_transaction_sell_no(code='2024-11-10') |
| | | line = """ |
| | | 2025-03-12 14:49:15.028 | DEBUG | log_module.async_log_util:run_sync:66 - [14:49:14.899602] thread-id=3048 code=600841 L前监控范围:{1477, 1478, 1479, 1480, 1481, 1482, 1486, 1487, 1488, 1489, 1492, 1493, 1495, 1498, 1500} 计算范围:1477-1503 |
| | | """ |
| | | print(__parse_content(line)) |
| | | # load_huaxin_transaction_sell_no(code='2024-11-10') |
| | | # load_huaxin_transaction_sell_no(code='2024-11-10') |
| | | # print(get_h_cancel_compute_info("603912")) |
| | | |
| | | # logger_l2_h_cancel.info("test") |