| | |
| | | import ths_util |
| | | import tool |
| | | from output import code_info_output |
| | | from third_data import hot_block_data_process, block_info, kpl_api, kpl_util |
| | | from third_data.code_plate_key_manager import TargetCodePlateKeyManager |
| | | from third_data import hot_block_data_process, block_info, kpl_api |
| | | from third_data.code_plate_key_manager import CodesHisReasonAndBlocksManager |
| | | from third_data.kpl_data_manager import KPLCodeLimitUpReasonManager, KPLLimitUpDataRecordManager |
| | | from ths import l2_listen_pos_health_manager |
| | | from trade import trade_gui, trade_data_manager, trade_manager, l2_trade_util, deal_big_money_manager, \ |
| | | first_code_score_manager, current_price_process_manager |
| | | first_code_score_manager, current_price_process_manager, trade_juejin |
| | | import l2_code_operate |
| | | from code_data_util import ZYLTGBUtil |
| | | import l2.transaction_progress |
| | |
| | | latest_oringin_data = {} |
| | | last_l2_listen_health_time = {} |
| | | __KPLCodeLimitUpReasonManager = KPLCodeLimitUpReasonManager() |
| | | __TargetCodePlateKeyManager = TargetCodePlateKeyManager() |
| | | __CodesPlateKeysManager = CodesHisReasonAndBlocksManager() |
| | | |
| | | def setup(self): |
| | | super().setup() # 可以不调用父类的setup()方法,父类的setup方法什么都没做 |
| | |
| | | code_list.append(data["code"]) |
| | | # 获取基本信息 |
| | | code_datas = juejin.JueJinManager.get_gp_latest_info(code_list) |
| | | if is_add: |
| | | gpcode_manager.add_gp_list(code_datas) |
| | | else: |
| | | gpcode_manager.set_gp_list(code_datas) |
| | | # if is_add: |
| | | # gpcode_manager.add_gp_list(code_datas) |
| | | # else: |
| | | # gpcode_manager.set_gp_list(code_datas) |
| | | |
| | | if not is_add: |
| | | # 同步同花顺目标代码 |
| | |
| | | |
| | | # 板块关键字准备 |
| | | for code in codes: |
| | | if self.__TargetCodePlateKeyManager.get_history_limit_up_reason(code) is None: |
| | | self.__TargetCodePlateKeyManager.set_history_limit_up_reason(code, |
| | | KPLLimitUpDataRecordManager.get_latest_blocks_set( |
| | | code)) |
| | | if self.__TargetCodePlateKeyManager.get_blocks(code) is None: |
| | | if not self.__CodesPlateKeysManager.get_history_limit_up_reason(code) is None: |
| | | self.__CodesPlateKeysManager.set_history_limit_up_reason(code, |
| | | KPLLimitUpDataRecordManager.get_latest_blocks_set( |
| | | code)) |
| | | if self.__CodesPlateKeysManager.get_blocks(code) is None: |
| | | try: |
| | | results = kpl_api.getStockIDPlate(code) |
| | | bs = [r[1] for r in results] |
| | | self.__TargetCodePlateKeyManager.set_blocks(code, bs) |
| | | self.__CodesPlateKeysManager.set_blocks(code, bs) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | pass |
| | |
| | | volumes_data) |
| | | gpcode_manager.FirstCodeManager.add_record(codes) |
| | | if new_add_codes: |
| | | gpcode_manager.set_first_gp_codes_with_data(juejin.JueJinManager.get_gp_latest_info(codes)) |
| | | gpcode_manager.set_first_gp_codes_with_data(juejin.JueJinManager.get_gp_latest_info(codes,fields="symbol,sec_name,sec_type,sec_level")) |
| | | # 加入首板历史记录 |
| | | |
| | | logger_first_code_record.info("新增首板:{}", new_add_codes) |
| | |
| | | |
| | | def send_msg(client_id, data): |
| | | _ip = client_manager.getActiveClientIP(client_id) |
| | | print("ip", client_id, _ip) |
| | | # print("ip", client_id, _ip) |
| | | if _ip is None or len(_ip) <= 0: |
| | | raise Exception("客户端IP为空") |
| | | socketClient = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| | |
| | | while True: |
| | | clients = authority.get_l2_clients() |
| | | for client in clients: |
| | | print("心跳", client) |
| | | # print("心跳", client) |
| | | try: |
| | | send_msg(client, {"action": "test"}) |
| | | except: |
| | |
| | | l2_listen_pos_health_manager.init_all(client_infos) |
| | | |
| | | |
| | | if __name__ == "__main__1": |
| | | cid, pid = gpcode_manager.get_listen_code_pos("000070") |
| | | print(cid, pid) |
| | | |
| | | if __name__ == "__main__": |
| | | datas =trade_juejin.get_execution_reports() |
| | | # 上传数据 |
| | | fdatas = [] |
| | | for d in datas: |
| | | fdatas.append( |
| | | {"code": d[0], "money": d[4], "num": d[2], "price": d[3], "time": d[7], "trade_num": d[5], |
| | | "type": d[1] - 1}) |
| | | print(fdatas) |
| | | if fdatas: |
| | | try: |
| | | trade_manager.process_trade_success_data(fdatas) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | trade_manager.save_trade_success_data(fdatas) |
| | | |
| | | if __name__ == "__main__1": |
| | | codes = gpcode_manager.get_first_gp_codes() |
| | | for code in codes: |
| | | try: |