| | |
| | | import gpcode_manager |
| | | import authority |
| | | import juejin |
| | | import limit_up_time_manager |
| | | from l2 import l2_data_manager_new, l2_data_manager, l2_data_log, l2_log, code_price_manager |
| | | import l2_data_util |
| | | from l2.cancel_buy_strategy import HourCancelBigNumComputer, L2LimitUpMoneyStatisticUtil |
| | |
| | | from third_data import hot_block_data_process |
| | | 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 |
| | | first_code_score_manager, current_price_process_manager |
| | | import l2_code_operate |
| | | from code_data_util import ZYLTGBUtil |
| | | import l2.transaction_progress |
| | |
| | | # 保存未筛选的首板代码 |
| | | new_add_codes = gpcode_first_screen_manager.set_target_no_screen_codes(codes) |
| | | # 保存自由流通股本 |
| | | zyltgb_list = [] |
| | | for data in dataList: |
| | | code = data["code"] |
| | | if code in global_util.zyltgb_map: |
| | | continue |
| | | zyltgb_list.append( |
| | | {"code": code, "zyltgb": data["zyltgb"], "zyltgb_unit": data["zyltgbUnit"]}) |
| | | if zyltgb_list: |
| | | ZYLTGBUtil.save_list(zyltgb_list) |
| | | global_data_loader.load_zyltgb() |
| | | if dataList: |
| | | zyltgb_list = [] |
| | | for data in dataList: |
| | | code = data["code"] |
| | | if code in global_util.zyltgb_map: |
| | | continue |
| | | zyltgb_list.append( |
| | | {"code": code, "zyltgb": data["zyltgb"], "zyltgb_unit": data["zyltgbUnit"]}) |
| | | if zyltgb_list: |
| | | ZYLTGBUtil.save_list(zyltgb_list) |
| | | global_data_loader.load_zyltgb() |
| | | |
| | | bad_codes = set() |
| | | |
| | |
| | | need_get_volumn = True |
| | | if need_get_volumn: |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], code_nature_analyse.is_new_top( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data[:60])) |
| | | volumes = juejin.parse_max_volume(volumes_data[:90], code_nature_analyse.is_new_top( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data[:90])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2]) |
| | | # 判断K线形态 |
| | |
| | | if not gpcode_manager.is_in_gp_pool(lc): |
| | | # 移除代码 |
| | | l2_code_operate.L2CodeOperate.get_instance().add_operate(0, lc, "代码被移除") |
| | | |
| | | if new_add_codes: |
| | | # 低分值代码禁止交易 |
| | | for code in new_add_codes: |
| | | try: |
| | | score, score_list = first_code_score_manager.get_score(code, 0, None, False) |
| | | if score < 0: |
| | | trade_manager.ForbiddenBuyCodeByScoreManager.add_code(code) |
| | | # elif score >= 200: |
| | | # # 如果没有涨停过 |
| | | # limit_up_time = limit_up_time_manager.get_limit_up_time(code) |
| | | # if limit_up_time is None and int(tool.get_now_time_str().replace(":","")) > int("113000"): |
| | | # gpcode_manager.WantBuyCodesManager.add_code(code) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | |
| | | # if dataList and int(tool.get_now_time_str().replace(":","")) > int("113000"): |
| | | # for data in dataList: |
| | | # code = data["code"] |
| | | # if gpcode_manager.WantBuyCodesManager.is_in(code): |
| | | # score, score_list = first_code_score_manager.get_score(code, 0, None, False) |
| | | # if score < 200: |
| | | # gpcode_manager.WantBuyCodesManager.remove_code(code) |
| | | |
| | | # 保存现价 |
| | | if dataList: |
| | |
| | | buy_time = data["buyTime"] |
| | | buy_one_price = data["buyOnePrice"] |
| | | buy_one_volumn = data["buyOneVolumn"] |
| | | sell_one_price = data["sellOnePrice"] |
| | | sell_one_volumn = data["sellOneVolumn"] |
| | | |
| | | buy_queue = data["buyQueue"] |
| | | if buy_one_price is None: |
| | | print('买1价没有,', code) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | |
| | | if limit_up_price is not None: |
| | | code_price_manager.Buy1PriceManager.process(code, buy_one_price, buy_time, limit_up_price) |
| | | code_price_manager.Buy1PriceManager.process(code, buy_one_price, buy_time, limit_up_price, |
| | | sell_one_price, sell_one_volumn) |
| | | _start_time = time.time() |
| | | msg += "买1价格处理:" + f"{_start_time - __start_time} " |
| | | |
| | |
| | | volumn = item["volume"] |
| | | volumnUnit = item["volumeUnit"] |
| | | code_volumn_manager.save_today_volumn(item["code"], volumn, volumnUnit) |
| | | juejin.accept_prices(datas) |
| | | current_price_process_manager.accept_prices(datas) |
| | | elif type == 50: |
| | | data = data_process.parse(_str)["data"] |
| | | if data is not None: |
| | |
| | | # 加入白名单 |
| | | data = json.loads(_str) |
| | | codes = data["data"]["codes"] |
| | | for code in codes: |
| | | l2_trade_util.WhiteListCodeManager.add_code(code) |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = juejin.JueJinManager.get_gp_codes_names([code]) |
| | | if results: |
| | | gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) |
| | | return_str = json.dumps({"code": 0}) |
| | | try: |
| | | for code in codes: |
| | | # 自由流通市值>50亿,股价高于30块的不能加白名单 |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | if float(limit_up_price) > 30: |
| | | raise Exception("股价高于30元") |
| | | # zyltgb = global_util.zyltgb_map.get(code) |
| | | # if zyltgb is None: |
| | | # global_data_loader.load_zyltgb() |
| | | # zyltgb = global_util.zyltgb_map.get(code) |
| | | # if zyltgb > 50 * 100000000: |
| | | # raise Exception("自由流通股本大于50亿") |
| | | |
| | | l2_trade_util.WhiteListCodeManager.add_code(code) |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = juejin.JueJinManager.get_gp_codes_names([code]) |
| | | if results: |
| | | gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) |
| | | return_str = json.dumps({"code": 0}) |
| | | except Exception as e: |
| | | return_str = json.dumps({"code": 1, "msg": str(e)}) |
| | | |
| | | elif type == 203: |
| | | # 移除黑名单 |
| | | data = json.loads(_str) |
| | |
| | | else: |
| | | trade_manager.TradeStateManager.close_buy() |
| | | return_str = json.dumps({"code": 0, "msg": ("开启成功" if is_open else "关闭成功")}) |
| | | elif type == 502: |
| | | can_buy = trade_manager.TradeStateManager.is_can_buy() |
| | | return_str = json.dumps({"code": 0, "data": {"can_buy": can_buy}}) |
| | | |
| | | sk.send(return_str.encode()) |
| | | |
| | |
| | | for code in codes: |
| | | try: |
| | | global_data_loader.load_zyltgb() |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price(code)) |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price(code)) |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes_data = volumes_data[1:] |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], |