| | |
| | | _start_index = 0 |
| | | total_datas = local_today_datas.get(code) |
| | | if total_datas: |
| | | _start_index =total_datas[-1]["index"] + 1 |
| | | _start_index = total_datas[-1]["index"] + 1 |
| | | datas = l2_huaxin_util.get_format_l2_datas(code, origin_datas, |
| | | gpcode_manager.get_limit_up_price(code), _start_index) |
| | | # 获取下单位置 |
| | |
| | | |
| | | if len(add_datas) > 0: |
| | | # 是否为首板代码 |
| | | is_first_code = True #gpcode_manager.FirstCodeManager.is_in_first_record(code) |
| | | is_first_code = True # gpcode_manager.FirstCodeManager.is_in_first_record(code) |
| | | # 计算量 |
| | | volume_rate = code_volumn_manager.get_volume_rate(code) |
| | | volume_rate_index = code_volumn_manager.get_volume_rate_index(volume_rate) |
| | |
| | | end_index = len(total_datas) - 1 |
| | | if state == trade_manager.TRADE_STATE_BUY_DELEGATED or state == trade_manager.TRADE_STATE_BUY_PLACE_ORDER or state == trade_manager.TRADE_STATE_BUY_SUCCESS: |
| | | # 已挂单 |
| | | if True: #len(add_datas) < 10: |
| | | if True: # len(add_datas) < 10: |
| | | cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | else: |
| | | pass |
| | |
| | | else: |
| | | # 未挂单,时间相差不大才能挂单 |
| | | if l2.l2_data_util.L2DataUtil.is_same_time(now_time_str, latest_time): |
| | | |
| | | cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | |
| | | |
| | | logger_l2_process.info("code:{} 处理数据范围: {}-{} 处理时间:{} 截图时间戳:{}", code, add_datas[0]["index"], |
| | | add_datas[-1]["index"], round(t.time() * 1000) - __start_time, |
| | |
| | | if round(t.time() * 1000) - __start_time > 10: |
| | | __start_time = l2_data_log.l2_time(code, round(t.time() * 1000) - __start_time, |
| | | "获取m值数据耗时") |
| | | if True: #end_index - start_index < 10: |
| | | if True: # end_index - start_index < 10: |
| | | cls.__start_compute_buy(code, start_index, end_index, threshold_money, capture_time, is_first_code) |
| | | else: |
| | | pass |
| | |
| | | if not is_first_code: |
| | | can, need_clear_data, reason = cls.__can_buy(code) |
| | | else: |
| | | can, need_clear_data, reason = cls.__can_buy_first(code) |
| | | # can, need_clear_data, reason = cls.__can_buy_first(code) |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(cls.__can_buy_first) |
| | | can, need_clear_data, reason = lp_wrap(code) |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | with open(f"/home/logs/profile/{code}_can_buy_first.txt", 'w') as f: |
| | | f.write(output.getvalue()) |
| | | |
| | | __start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - __start_time, "最后判断是否能下单", force=True) |
| | | # 删除虚拟下单 |
| | | if code in cls.unreal_buy_dict: |