| | |
| | | |
| | | |
| | | # 华鑫L2的卡位数量 |
| | | HUAXIN_L2_MAX_CODES_COUNT = 50 |
| | | HUAXIN_L2_MAX_CODES_COUNT = 70 |
| | | |
| | | TRADE_WAY_HUAXIN = "huaxin" |
| | | TRADE_WAY_JUEJIN = "juejin" |
| | |
| | | real_place_index_info = shadow_place_order_index, RELIABILITY_TYPE_VIRTUAL |
| | | else: |
| | | real_place_index_info = real_place_index, RELIABILITY_TYPE_REAL |
| | | elif time.time() - order_time >= 2: |
| | | # 下单超过1s |
| | | elif L2DataUtil.time_sub_as_ms(datas[-1]["val"], exec_data['val']) >= 2000: |
| | | # 下单超过2s |
| | | estimate_index = __compute_estimate_order_position(code, exec_data["index"]) |
| | | if estimate_index: |
| | | real_place_index_info = estimate_index, RELIABILITY_TYPE_ESTIMATE |
| | |
| | | from log_module.log import logger_l2_codes_subscript |
| | | from third_data import kpl_data_manager, kpl_api |
| | | from trade import current_price_process_manager |
| | | from utils import tool, global_util, socket_util, init_data_util |
| | | from trade.trade_manager import MarketSituationManager |
| | | from utils import tool, global_util, socket_util, init_data_util, buy_condition_util |
| | | |
| | | redisManager = redis_manager.RedisManager(4) |
| | | l2_codes_queue = queue.Queue() |
| | |
| | | if not global_util.zyltgb_map: |
| | | global_data_loader.load_zyltgb() |
| | | |
| | | situation = MarketSituationManager().get_situation_cache() |
| | | zyltgb_thresholds = buy_condition_util.get_zyltgb_threshold(situation) |
| | | want_codes = gpcode_manager.WantBuyCodesManager().list_code_cache() |
| | | for d in datas: |
| | | code = d[0] |
| | | # 格式 (代码,现价,涨幅,量,更新时间,买1价格,买1量) |
| | |
| | | # 剔除股价大于40块的票 |
| | | if d[1] > constant.MAX_SUBSCRIPT_CODE_PRICE: |
| | | continue |
| | | |
| | | # 获取自由流通市值 |
| | | if code not in global_util.zyltgb_map: |
| | | try: |
| | |
| | | global_util.zyltgb_map[code] = int(zylt) |
| | | except: |
| | | pass |
| | | # 自由流通市值不符合标准 |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb: |
| | | zyltgb_as_yi = round(zyltgb / 100000000, 2) |
| | | if zyltgb_as_yi < zyltgb_thresholds[0] or zyltgb_as_yi > zyltgb_thresholds[1]: |
| | | if not want_codes or code not in want_codes: |
| | | # 想买单中的不能排除 |
| | | continue |
| | | # 保存今日实时量 |
| | | temp_volumns.append((code, d[3])) |
| | | |
| | |
| | | # 上5个交易日有炸板之后 |
| | | if has_open_limit_up_in_5: |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.29: |
| | | return False, True, f"强势10分钟,上5个交易日炸板,量未达到{0.29}({cls.volume_rate_info[code][0]})" |
| | | return False, True, f"非强势10分钟,上5个交易日炸板,量未达到{0.29}({cls.volume_rate_info[code][0]})" |
| | | |
| | | # 上5个交易日有跌停 |
| | | if has_limit_down_in_5: |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.29: |
| | | return False, True, f"强势10分钟,上5个交易日跌停,量未达到{0.29}({cls.volume_rate_info[code][0]})" |
| | | return False, True, f"非强势10分钟,上5个交易日跌停,量未达到{0.29}({cls.volume_rate_info[code][0]})" |
| | | |
| | | # 获取量的参考日期 |
| | | if code in global_util.max60_volumn: |
| | |
| | | |
| | | from third_data import kpl_api, kpl_util |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | from third_data.kpl_data_manager import KPLDataManager |
| | | from utils import tool |
| | | |
| | | |
| | | def getFirstLimitUpPremium(day): |
| | | results = kpl_api.getHistoryLimitUpInfo(day) |
| | | # 保存 |
| | | # KPLDataManager.save_data("limit_up", kpl_util.parseDaBanData({"list": results, "errcode": 0}, 1)) |
| | | |
| | | # 获取下一个交易日 |
| | | next_day = HistoryKDatasUtils.get_next_trading_date(day) |
| | | result_list = kpl_util.parseDaBanData(json.dumps({"list": results, "errcode": 0}), kpl_util.DABAN_TYPE_LIMIT_UP) |
| | |
| | | print(record) |
| | | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | getFirstLimitUpPremium("2023-12-26") |
| | | getFirstLimitUpPremium("2024-02-08") |
| | |
| | | |
| | | def getHistoryLimitUpInfo(day): |
| | | fresults = [] |
| | | for i in range(0, 5): |
| | | for i in range(0, 100): |
| | | data = f"Order=1&a=HisDaBanList&st=20&c=HisHomeDingPan&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&Index={i * 20}&Is_st=1&PidType=1&apiv=w32&Type=6&FilterMotherboard=0&Filter=0&FilterTIB=0&Day={day}&FilterGem=0&" |
| | | result = __base_request("https://apphis.longhuvip.com/w1/api/index.php", data=data) |
| | | result = json.loads(result) |
| | |
| | | total_big_num -= canceled_data["val"]["num"] |
| | | total_big_num += val["num"] |
| | | |
| | | not_deal_total_big_num = 0 |
| | | not_deal_total_big_count = 0 |
| | | for i in range(trade_index, trade_index): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | not_deal_total_big_count += 1 |
| | | else: |
| | | not_deal_total_big_num -= canceled_data["val"]["num"] |
| | | not_deal_total_big_num += val["num"] |
| | | |
| | | |
| | | |
| | | |
| | | real_place_order_after_count = 0 |
| | | real_place_order_after_num = 0 |
| | | |
| | |
| | | "buy1_money": output_util.money_desc(buy1_money), |
| | | "big_num_count": total_big_count, |
| | | "big_num_money": output_util.money_desc(total_big_num * float(limit_up_price) * 100), |
| | | "not_deal_big_num_count": not_deal_total_big_count, |
| | | "not_deal_big_num_money": output_util.money_desc(not_deal_total_big_num * float(limit_up_price) * 100), |
| | | "left_count": total_left_count, |
| | | "volume_rate": volume_rate, |
| | | "left_money": output_util.money_desc(total_left_num * float(limit_up_price) * 100), |