| | |
| | | import datetime |
| | | import hashlib |
| | | import io |
| | | import json |
| | | import logging |
| | | import queue |
| | |
| | | import time |
| | | |
| | | import dask |
| | | from line_profiler import LineProfiler |
| | | |
| | | import constant |
| | | from code_attribute import gpcode_manager |
| | | from l2 import l2_data_manager_new, l2_log, code_price_manager, l2_data_util, l2_data_manager, transaction_progress |
| | | from l2.cancel_buy_strategy import HourCancelBigNumComputer, LCancelBigNumComputer, DCancelBigNumComputer |
| | |
| | | days=100)).timestamp() > datetime.datetime.now().timestamp(): |
| | | continue |
| | | fdatas.append(d["sec_id"]) |
| | | sk.sendall(socket_util.load_header(json.dumps({"code": 0, "data":fdatas}).encode(encoding='utf-8'))) |
| | | sk.sendall( |
| | | socket_util.load_header(json.dumps({"code": 0, "data": fdatas}).encode(encoding='utf-8'))) |
| | | |
| | | elif data_json["type"] == "set_target_codes": |
| | | try: |
| | |
| | | datas = data["data"] |
| | | print("set_target_codes", data_json) |
| | | HuaXinL1TargetCodesManager.set_level_1_codes_datas(datas) |
| | | |
| | | lp = LineProfiler() |
| | | lp.enable() |
| | | lp_wrap = lp(HuaXinL1TargetCodesManager.set_level_1_codes_datas) |
| | | lp_wrap(datas) |
| | | output = io.StringIO() |
| | | lp.print_stats(stream=output) |
| | | lp.disable() |
| | | with open( |
| | | f"{constant.get_path_prefix()}/logs/profile/set_level_1_codes_datas_{time.time()}.txt", |
| | | 'w') as f: |
| | | f.write(output.getvalue()) |
| | | |
| | | |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |