| | |
| | | from log_module.log import logger_l2_process_time |
| | | from utils import tool |
| | | |
| | | __log_cache_data = {} |
| | | |
| | | |
| | | # 日志缓存 |
| | | def cache_log(fn): |
| | | def wrapper(*args, **kwargs): |
| | | can_cache = tool.get_now_time_as_int() > 150000 |
| | | cache_key = f"{fn.__name__}#{args}#{kwargs}" |
| | | if can_cache: |
| | | # 15:00:00之后才能缓存 |
| | | |
| | | if cache_key in __log_cache_data: |
| | | return __log_cache_data[cache_key] |
| | | result = fn(*args, **kwargs) |
| | | if can_cache: |
| | | __log_cache_data[cache_key] = result |
| | | return result |
| | | |
| | | return wrapper |
| | | |
| | | |
| | | class LogUtil: |
| | | @classmethod |
| | |
| | | return tool.time_seconds_format(s - 2 - cha) |
| | | |
| | | |
| | | @cache_log |
| | | def load_l2_from_log(date=None): |
| | | today_data = {} |
| | | if date is None: |
| | |
| | | |
| | | |
| | | # 获取L2每次批量处理数据的位置范围 |
| | | @cache_log |
| | | def get_l2_process_position(code, date=None): |
| | | if not date: |
| | | date = datetime.datetime.now().strftime("%Y-%m-%d") |
| | |
| | | |
| | | |
| | | # 获取L2每次批量处理数据的位置范围 |
| | | @cache_log |
| | | def get_l2_trade_position(code, date=None): |
| | | if not date: |
| | | date = datetime.datetime.now().strftime("%Y-%m-%d") |
| | |
| | | |
| | | |
| | | # 获取L2每次批量处理数据的位置范围 |
| | | @cache_log |
| | | def get_real_place_order_positions(code, date=None): |
| | | if not date: |
| | | date = datetime.datetime.now().strftime("%Y-%m-%d") |
| | |
| | | code = data_json["code"] |
| | | if type != type_: |
| | | continue |
| | | fdatas.append((time_str,code, type, data_json["data"])) |
| | | fdatas.append((time_str, code, type, data_json["data"])) |
| | | return fdatas |
| | | |
| | | |
| | | @cache_log |
| | | def load_cancel_buy_reasons(code, date=tool.get_now_date_str()): |
| | | """ |
| | | 获取撤单原因 |
| | |
| | | |
| | | |
| | | # 加载l2订单成交数据 |
| | | @cache_log |
| | | def load_huaxin_deal_record(code, date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/l2/transaction_desc.{date}.log" |
| | | # 格式:[(订单号,手数,开始成交时间,成交结束时间,下单手数)] |
| | |
| | | return fdatas |
| | | |
| | | |
| | | @cache_log |
| | | def load_kpl_limit_up_records(current_time_str, date=tool.get_now_date_str()): |
| | | """ |
| | | 获取离给定时间最近的涨停数据 |
| | |
| | | |
| | | |
| | | # 加载华鑫成交的卖单 |
| | | @cache_log |
| | | def load_huaxin_transaction_sell_no(code=None, date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/l2/transaction_sell_order.{date}.log" |
| | | fdatas = {} |
| | |
| | | pass |
| | | return fdatas |
| | | |
| | | |
| | | @cache_log |
| | | def load_huaxin_active_sell_map(date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/trade/l2_active_sell.{date}.log" |
| | | fdatas = {} |
| | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | fdatas = load_kpl_limit_up_records("10:00:00", "2024-10-21") |
| | | print(fdatas) |
| | | 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") |