| | |
| | | local_latest_datas |
| | | import l2.l2_data_util |
| | | from log_module.log import logger_l2_trade_buy, logger_l2_process, \ |
| | | logger_place_order_score, logger_l2_error |
| | | logger_place_order_score, logger_l2_error, logger_profile |
| | | |
| | | # TODO l2数据管理 |
| | | from trade.trade_data_manager import CodeActualPriceProcessor |
| | |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | with open( |
| | | f"/home/logs/profile/{code}_start_compute_buy_{start_index}_{end_index}.txt", |
| | | 'w') as f: |
| | | f.write(output.getvalue()) |
| | | logger_profile.info(output.getvalue()) |
| | | |
| | | # 测试专用 |
| | | @classmethod |
| | |
| | | _start_time = round(t.time() * 1000) |
| | | try: |
| | | b_need_cancel, b_cancel_data = HourCancelBigNumComputer().need_cancel(code, buy_single_index, |
| | | buy_exec_index, start_index, |
| | | end_index, total_data, |
| | | local_today_num_operate_map.get( |
| | | code), |
| | | code_volumn_manager.get_volume_rate_index( |
| | | buy_volume_rate), |
| | | cls.volume_rate_info[code][1], |
| | | is_first_code) |
| | | buy_exec_index, start_index, |
| | | end_index, total_data, |
| | | local_today_num_operate_map.get( |
| | | code), |
| | | code_volumn_manager.get_volume_rate_index( |
| | | buy_volume_rate), |
| | | cls.volume_rate_info[code][1], |
| | | is_first_code) |
| | | if b_need_cancel and b_cancel_data: |
| | | return b_cancel_data, "H撤销比例触发阈值" |
| | | except Exception as e: |
| | |
| | | _start_time = round(t.time() * 1000) |
| | | try: |
| | | b_need_cancel, b_cancel_data = LCancelBigNumComputer().need_cancel(code, |
| | | buy_exec_index, start_index, |
| | | end_index, total_data, |
| | | local_today_num_operate_map.get( |
| | | code), is_first_code) |
| | | buy_exec_index, start_index, |
| | | end_index, total_data, |
| | | local_today_num_operate_map.get( |
| | | code), is_first_code) |
| | | if b_need_cancel and b_cancel_data: |
| | | return b_cancel_data, "L撤销比例触发阈值" |
| | | except Exception as e: |
| | |
| | | max_num_set) |
| | | _start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - _start_time, "纯买额统计时间") |
| | | |
| | | l2_log.debug(code, "m值-{} 量比:{} rebegin_buy_pos:{}", threshold_money, cls.volume_rate_info[code][0], rebegin_buy_pos) |
| | | l2_log.debug(code, "m值-{} 量比:{} rebegin_buy_pos:{}", threshold_money, cls.volume_rate_info[code][0], |
| | | rebegin_buy_pos) |
| | | |
| | | # 买入信号位与计算位置间隔2s及以上了 |
| | | if rebegin_buy_pos is not None: |
| | |
| | | # 数据尚未处理完毕,进行下一步处理 |
| | | l2_log.debug(code, "数据尚未处理完毕,进行下一步处理,处理进度:{}", compute_index) |
| | | # 处理撤单步骤 |
| | | cls.__process_order(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False) |
| | | # cls.__process_order(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False) |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(cls.__process_order) |
| | | lp_wrap(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False) |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | logger_profile.info(output.getvalue()) |
| | | |
| | | |
| | | _start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - _start_time, |
| | | f"处理撤单步骤耗时,范围:{compute_index + 1}-{compute_end_index}", force=True) |
| | | |
| | |
| | | filter=lambda record: record["extra"].get("name") == "redis_debug", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_path("profile", "profile"), |
| | | filter=lambda record: record["extra"].get("name") == "profile", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | ################################华鑫日志################################ |
| | | logger.add(self.get_hx_path("l2", "transaction"), |
| | | filter=lambda record: record["extra"].get("name") == "hx_l2_transaction", |
| | |
| | | |
| | | logger_redis_debug = __mylogger.get_logger("redis_debug") |
| | | |
| | | logger_profile = __mylogger.get_logger("profile") |
| | | |
| | | # -------------------------------华鑫日志--------------------------------- |
| | | hx_logger_l2_orderdetail = __mylogger.get_logger("hx_l2_orderdetail") |
| | | hx_logger_l2_transaction = __mylogger.get_logger("hx_l2_transaction") |