| | |
| | | try: |
| | | add_code_set = set(add_code_list) |
| | | global latest_add_codes |
| | | if not latest_add_codes or tuple(latest_add_codes) != tuple(add_code_set): |
| | | if not latest_add_codes: |
| | | latest_add_codes = set() |
| | | # 判断设置的代码是否相同 |
| | | dif1 = latest_add_codes - add_code_set |
| | | dif2 = add_code_set - latest_add_codes |
| | | if dif1 or dif2: |
| | | print("设置L2代码数量:", len(add_code_set)) |
| | | latest_add_codes = add_code_set |
| | | add_datas = [] |
| | | for d in add_code_list: |
| | |
| | | limit_up_price = round(float(limit_up_price), 2) |
| | | min_volume = int(round(50 * 10000 / limit_up_price)) |
| | | add_datas.append((d, min_volume, limit_up_price)) |
| | | huaxin_target_codes_manager.push(add_datas) |
| | | huaxin_target_codes_manager.push(add_datas) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | else: |
| | |
| | | import time |
| | | |
| | | import constant |
| | | from l2 import l2_data_manager_new |
| | | from l2 import l2_data_manager_new, l2_log |
| | | from l2.huaxin import huaxin_target_codes_manager |
| | | from log_module.log import hx_logger_l2_upload, hx_logger_contact_debug, hx_logger_trade_callback, \ |
| | | hx_logger_l2_orderdetail, hx_logger_l2_transaction, hx_logger_trade_debug |
| | |
| | | code = data["code"] |
| | | datas = data["data"] |
| | | hx_logger_l2_orderdetail.info(f"{code}#{datas}") |
| | | l2_log.threadIds[code] = random.randint(0, 100000) |
| | | l2_data_manager_new.L2TradeDataProcessor.process_huaxin(code, datas) |
| | | sk.sendall(json.dumps({"code": 0}).encode(encoding='utf-8')) |
| | | |