| | |
| | | # except Exception as e: |
| | | # logging.exception(e) |
| | | # pass |
| | | |
| | | logger_l2_codes_subscript.info(f"{request_id}加载l2代码涨停价结束") |
| | | # 获取60天最大记录 |
| | | for code in codes: |
| | | need_get_volumn = False |
| | |
| | | except Exception as e: |
| | | logger_first_code_record.error(f"{code}:{str(e)}") |
| | | logger_first_code_record.exception(e) |
| | | |
| | | logger_l2_codes_subscript.info(f"{request_id}加载l2代码K线结束") |
| | | |
| | | gpcode_manager.FirstCodeManager().add_record(codes) |
| | | # 初始化板块信息,暂时删除 |
| | | # for code in codes: |
| | |
| | | current_price_process_manager.accept_prices(tick_datas, request_id) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | finally: |
| | | async_log_util.info(logger_l2_codes_subscript, f"({request_id})L1数据整体处理结束") |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | |
| | | date = datetime.datetime.now().strftime("%Y-%m-%d") |
| | | pos_list = [] |
| | | path_ = "{}/logs/gp/l2/l2_process.{}.log".format(constant.get_path_prefix(), date) |
| | | if os.path.exists(path_): |
| | | try: |
| | | with open(path_, mode='r', |
| | | encoding="utf-8") as f: |
| | | while True: |
| | |
| | | pos_list.append((int(line.split("-")[0]), int(line.split("-")[1]))) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | except: |
| | | pass |
| | | return pos_list |
| | | |
| | | |
| | |
| | | return fdatas |
| | | |
| | | |
| | | def load_huaxin_order_detail(date=tool.get_now_date_str()): |
| | | """ |
| | | 加载L2逐笔委托数据 |
| | | @param date: |
| | | @return: |
| | | """ |
| | | fdatas = [] |
| | | path = f"{constant.get_path_prefix()}/logs/huaxin/l2/orderdetail.{date}.log" |
| | | lines = __load_file_content(path) |
| | | for line in lines: |
| | | if line: |
| | | time = __get_async_log_time(line) |
| | | line = line[line.rfind("#") + 1:] |
| | | fdatas.append((time, eval(line))) |
| | | return fdatas |
| | | |
| | | |
| | | def load_pre_close_price(date=tool.get_now_date_str()): |
| | | """ |
| | | 加载之前的收盘价 |
| | |
| | | from log_module.log import hx_logger_contact_debug, hx_logger_trade_callback, \ |
| | | hx_logger_l2_orderdetail, hx_logger_l2_market_data, logger_l2_g_cancel, logger_debug, \ |
| | | logger_system, logger_trade, logger_trade_position_api_request, logger_request_api, \ |
| | | logger_local_huaxin_l1_trade_info, logger_real_place_order_position, logger_device |
| | | logger_local_huaxin_l1_trade_info, logger_real_place_order_position, logger_device, logger_l2_codes_subscript |
| | | from output import l2_output_util |
| | | from third_data import block_info, kpl_data_manager, kpl_util, history_k_data_util, kpl_api |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, CodePlateKeyBuyManager |
| | |
| | | request_id = data_json["request_id"] |
| | | datas = data["data"] |
| | | cls.__save_l1_current_price(datas) |
| | | # 9:30之前采用非线程 |
| | | if int(tool.get_now_time_str().replace(":","")) < int("093000"): |
| | | HuaXinL1TargetCodesManager.set_level_1_codes_datas(datas, request_id=request_id) |
| | | else: |
| | | cls.__process_l1_data_thread_pool.submit( |
| | | lambda: HuaXinL1TargetCodesManager.set_level_1_codes_datas(datas, request_id=request_id)) |
| | | |
| | |
| | | timestamp = val.get("time") |
| | | # 大于10s的数据放弃处理 |
| | | if type_ == "set_target_codes": |
| | | async_log_util.info(logger_l2_codes_subscript, f"策略接收到数据") |
| | | if time.time() * 1000 - timestamp > 10 * 1000: |
| | | continue |
| | | TradeServerProcessor.set_target_codes(val) |