| | |
| | | import datetime |
| | | import hashlib |
| | | import json |
| | | import logging |
| | |
| | | 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 |
| | | from l2.huaxin import huaxin_target_codes_manager |
| | | from l2.huaxin.huaxin_target_codes_manager import HuaXinL1TargetCodesManager |
| | | from l2.l2_data_manager_new import L2TradeDataProcessor |
| | | 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_l2_market_data, logger_l2_trade_buy_queue |
| | | from third_data import block_info, kpl_api |
| | | from third_data import block_info, kpl_api, kpl_data_manager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager |
| | | from third_data.history_k_data_util import JueJinApi |
| | | from trade import deal_big_money_manager, current_price_process_manager |
| | | |
| | | from trade.huaxin import huaxin_trade_api as trade_api, trade_api_server, huaxin_trade_api, huaxin_trade_data_update |
| | |
| | | datas = data["data"] |
| | | print("l2_subscript_codes", data_json) |
| | | # 订阅的代码 |
| | | huaxin_target_codes_manager.save_subscript_codes(datas) |
| | | huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.save_subscript_codes(datas) |
| | | finally: |
| | | sk.sendall(socket_util.load_header(json.dumps({"code": 0}).encode(encoding='utf-8'))) |
| | | elif data_json["type"] == "get_level1_codes": |
| | | # 获取level1的代码 |
| | | list_ = JueJinApi.get_exchanges_codes(["SHSE", "SZSE"]) |
| | | fdatas = [] |
| | | for d in list_: |
| | | if d["sec_id"].find("60") != 0 and d["sec_id"].find("00") != 0: |
| | | continue |
| | | if d["sec_level"] != 1: |
| | | continue |
| | | if d["pre_close"] * 1.1 > 40: |
| | | continue |
| | | if (d["listed_date"] + datetime.timedelta( |
| | | 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'))) |
| | | |
| | | elif data_json["type"] == "set_target_codes": |
| | | try: |
| | | data = data_json["data"] |
| | | datas = data["data"] |
| | | print("set_target_codes", data_json) |
| | | HuaXinL1TargetCodesManager.set_level_1_codes_datas(datas) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |
| | | sk.sendall(socket_util.load_header(json.dumps({"code": 0}).encode(encoding='utf-8'))) |
| | | else: |