| | |
| | | limit_up_time = limit_up_time_manager.get_limit_up_time(code) |
| | | if limit_up_time is None: |
| | | limit_up_time = tool.get_now_time_str() |
| | | score = None |
| | | if len(add_datas) < 10: |
| | | score = first_code_score_manager.get_score(code, volume_rate, limit_up_time, True) |
| | | else: |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(first_code_score_manager.get_score) |
| | | score = lp_wrap(code, volume_rate, limit_up_time, True) |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | with open( |
| | | f"/home/logs/profile/{code}_get_score_{add_datas[0]['index']}_{add_datas[-1]['index']}.txt", |
| | | 'w') as f: |
| | | f.write(output.getvalue()) |
| | | score = first_code_score_manager.get_score(code, volume_rate, limit_up_time, True) |
| | | |
| | | cls.__l2PlaceOrderParamsManagerDict[code] = l2_trade_factor.L2PlaceOrderParamsManager(code, is_first_code, |
| | | volume_rate, |
| | | volume_rate_index, |
| | |
| | | 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 len(add_datas) < 10: |
| | | if True: #len(add_datas) < 10: |
| | | cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | else: |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(cls.__process_order) |
| | | lp_wrap(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | with open( |
| | | f"/home/logs/profile/{code}_process_order_{add_datas[0]['index']}_{add_datas[-1]['index']}.txt", |
| | | 'w') as f: |
| | | f.write(output.getvalue()) |
| | | pass |
| | | # lp = LineProfiler() |
| | | # lp.enable() |
| | | # lp_wrap = lp(cls.__process_order) |
| | | # lp_wrap(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | # output = io.StringIO() |
| | | # lp.print_stats(stream=output) |
| | | # lp.disable() |
| | | # with open( |
| | | # f"/home/logs/profile/{code}_process_order_{add_datas[0]['index']}_{add_datas[-1]['index']}.txt", |
| | | # 'w') as f: |
| | | # f.write(output.getvalue()) |
| | | else: |
| | | # 未挂单,时间相差不大才能挂单 |
| | | if l2.l2_data_util.L2DataUtil.is_same_time(now_time_str, latest_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 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: |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(cls.__start_compute_buy) |
| | | lp_wrap(code, start_index, end_index, threshold_money, capture_time, is_first_code) |
| | | 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()) |
| | | pass |
| | | # lp = LineProfiler() |
| | | # lp.enable() |
| | | # lp_wrap = lp(cls.__start_compute_buy) |
| | | # lp_wrap(code, start_index, end_index, threshold_money, capture_time, is_first_code) |
| | | # 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()) |
| | | |
| | | # 测试专用 |
| | | @classmethod |