| | |
| | | """ |
| | | watch_indexes = set() |
| | | total_datas = local_today_datas.get(code) |
| | | is_ge_code = tool.is_ge_code(code) |
| | | try: |
| | | # 真实下单位置后面的数据就只看大单 |
| | | MIN_NUM = int(5000 / (float(gpcode_manager.get_limit_up_price(code)))) |
| | |
| | | code)) |
| | | if left_count > 0: |
| | | after_count += 1 |
| | | if l2_data_util.is_big_money(val): |
| | | if l2_data_util.is_big_money(val,is_ge_code): |
| | | watch_indexes.add(i) |
| | | # 记录索引的位置 |
| | | self.__set_cancel_l_down_after_place_order_index(code, i, after_count - 1) |
| | |
| | | return |
| | | # 重新囊括1笔 |
| | | real_place_order_info = self.__real_place_order_index_dict.get(code) |
| | | is_ge_code = tool.is_ge_code(code) |
| | | if real_place_order_info and real_place_order_info[0] > index: |
| | | total_datas = local_today_datas.get(code) |
| | | min_num = int(5000 / (float(gpcode_manager.get_limit_up_price(code)))) |
| | |
| | | code)) |
| | | if left_count > 0: |
| | | left_count_after += 1 |
| | | if l2_data_util.is_big_money(val) and j not in watch_indexes: |
| | | if l2_data_util.is_big_money(val, is_ge_code) and j not in watch_indexes: |
| | | watch_indexes.add(j) |
| | | self.__set_cancel_l_down_after_place_order_index(code, j, left_count_after - 1) |
| | | break |
| | |
| | | end_index = L2DataComputeUtil.compute_end_index(code, real_order_index + 1, total_datas[-1]["index"], |
| | | limit_up_price, 10) |
| | | # 从成交进度位到截至位置计算大单 |
| | | min_money = l2_data_util.get_big_money_val(limit_up_price) |
| | | |
| | | min_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code)) |
| | | left_count, left_money = L2DataComputeUtil.compute_left_buy_order(code, trade_index, end_index, limit_up_price, |
| | | min_money=min_money) |
| | | if left_count < 1: |
| | |
| | | trade_index = 0 |
| | | limit_up_price = round(float(gpcode_manager.get_limit_up_price(code)), 2) |
| | | # 从成交进度位到截至位置计算大单 |
| | | min_money = l2_data_util.get_big_money_val(limit_up_price) |
| | | min_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code)) |
| | | left_count, left_money = cancel_buy_strategy.L2DataComputeUtil.compute_left_buy_order(code, |
| | | trade_index, |
| | | total_data[ |
| | |
| | | bigger_num = round(5000 / limit_up_price) |
| | | |
| | | not_buy_msg = "" |
| | | is_ge_code = tool.is_ge_code(code) |
| | | for i in range(compute_start_index, compute_end_index + 1): |
| | | data = total_datas[i] |
| | | _val = total_datas[i]["val"] |
| | |
| | | return None, buy_nums, buy_count, ii, max_buy_num_set, f"【{i}】信号不连续,囊括时间-{max_space_time_ms}ms" |
| | | # 涨停买 |
| | | if L2DataUtil.is_limit_up_price_buy(_val): |
| | | if l2_data_util.is_big_money(_val): |
| | | if l2_data_util.is_big_money(_val,is_ge_code): |
| | | max_buy_num_set.add(i) |
| | | if _val["num"] >= bigger_num: |
| | | trigger_buy = True |
| | |
| | | place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count(code) |
| | | if place_order_count is None: |
| | | place_order_count = 0 |
| | | is_ge_code = tool.is_ge_code(code) |
| | | for i in range(compute_start_index, compute_end_index + 1): |
| | | data = total_datas[i] |
| | | _val = total_datas[i]["val"] |
| | |
| | | threshold_num = round(threshold_money / (limit_up_price * 100)) |
| | | # 涨停买 |
| | | elif L2DataUtil.is_limit_up_price_buy(_val): |
| | | if l2_data_util.is_big_money(_val): |
| | | if l2_data_util.is_big_money(_val, is_ge_code): |
| | | max_buy_num_set.add(i) |
| | | trigger_buy = True |
| | | # 只统计59万以上的金额 |
| | |
| | | not_buy_msg = "" |
| | | max_buy_num_set = set(max_num_set) |
| | | active_buy_blocks = cls.get_active_buy_blocks(code) |
| | | is_ge_code = tool.is_ge_code(code) |
| | | for i in range(compute_start_index, compute_end_index + 1): |
| | | data = total_datas[i] |
| | | _val = total_datas[i]["val"] |
| | |
| | | elif L2DataUtil.is_limit_up_price_buy(_val): |
| | | if _val['num'] < bigger_threshold_num: |
| | | continue |
| | | if l2_data_util.is_big_money(_val): |
| | | if l2_data_util.is_big_money(_val, is_ge_code): |
| | | max_buy_num_set.add(i) |
| | | trigger_buy = True |
| | | # 只统计59万以上的金额 |
| | |
| | | big_buy_datas = [] |
| | | normal_buy_datas = [] |
| | | # 大单阈值 |
| | | threshold_big_money = l2_data_util.get_big_money_val(limit_up_price) |
| | | threshold_big_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code)) |
| | | for data in datas: |
| | | # q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'], |
| | | # data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], |
| | |
| | | |
| | | |
| | | # 是否为大单 |
| | | def is_big_money(val): |
| | | def is_big_money(val, is_ge=False): |
| | | """ |
| | | 判断是否为大单 |
| | | @param val: l2数据 |
| | | @param is_ge: 是否为创业板 |
| | | @return: |
| | | """ |
| | | price = float(val["price"]) |
| | | money = price * val["num"] |
| | | if price > 3.0: |
| | | if money >= 29900 or val["num"] >= 7999: |
| | | if is_ge: |
| | | if money >= 29900 or val["num"] >= 2999: |
| | | return True |
| | | else: |
| | | return False |
| | | else: |
| | | max_money = price * 10000 |
| | | if money >= max_money * 0.95: |
| | | return True |
| | | if price > 3.0: |
| | | if money >= 29900 or val["num"] >= 7999: |
| | | return True |
| | | else: |
| | | return False |
| | | else: |
| | | return False |
| | | max_money = price * 10000 |
| | | if money >= max_money * 0.95: |
| | | return True |
| | | else: |
| | | return False |
| | | |
| | | |
| | | # 获取大资金的金额 |
| | | def get_big_money_val(limit_up_price): |
| | | if limit_up_price > 3.0: |
| | | return min(299 * 10000, round(limit_up_price * 7999 * 100)) |
| | | def get_big_money_val(limit_up_price, is_ge=False): |
| | | if is_ge: |
| | | return min(299 * 10000, round(limit_up_price * 2999 * 100)) |
| | | else: |
| | | max_money = limit_up_price * 10000 * 100 |
| | | return int(max_money * 0.95) |
| | | |
| | | if limit_up_price > 3.0: |
| | | return min(299 * 10000, round(limit_up_price * 7999 * 100)) |
| | | else: |
| | | max_money = limit_up_price * 10000 * 100 |
| | | return int(max_money * 0.95) |
| | | |
| | | # if int(val["num"]) >= constant.BIG_MONEY_NUM: |
| | | # return True |
| | |
| | | |
| | | real_place_order_after_count = 0 |
| | | real_place_order_after_money = 0 |
| | | is_ge_code = tool.is_ge_code(code) |
| | | |
| | | # 统计真实下单位置后面未撤的金额 |
| | | for i in range(real_order_index, total_datas[-1]["index"]): |
| | |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | if not l2_data_util.is_big_money(val, is_ge_code): |
| | | continue |
| | | |
| | | canceled_data = l2.l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | |
| | | # 获取已经成交的大单数量 |
| | | total_big_num = 0 |
| | | total_big_count = 0 |
| | | |
| | | is_ge_code = tool.is_ge_code(code) |
| | | for i in range(0, trade_index): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util_old.is_big_money(val): |
| | | if not l2_data_util_old.is_big_money(val, is_ge_code): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2( |
| | |
| | | not_deal_total_big_count_pre = 0 |
| | | not_deal_total_big_num_after = 0 |
| | | not_deal_total_big_count_after = 0 |
| | | is_ge_code = tool.is_ge_code(code) |
| | | for i in range(trade_index, total_datas[-1]["index"] + 1): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util_old.is_big_money(val): |
| | | if not l2_data_util_old.is_big_money(val, is_ge_code): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2( |
| | |
| | | |
| | | real_place_order_after_count = 0 |
| | | real_place_order_after_num = 0 |
| | | |
| | | is_ge_code = tool.is_ge_code(code) |
| | | # 统计真实下单位置后面未撤的金额 |
| | | for i in range(place_order_index, total_datas[-1]["index"]): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util_old.is_big_money(val): |
| | | if not l2_data_util_old.is_big_money(val, is_ge_code): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2( |
| | |
| | | # 获取大单成交列表 |
| | | code = data["code"] |
| | | data_list = BigOrderDealManager().get_total_buy_money_list(code) |
| | | bigger_money = l2_data_util_old.get_big_money_val(float(gpcode_manager.get_limit_up_price(code))) |
| | | bigger_money = l2_data_util_old.get_big_money_val(float(gpcode_manager.get_limit_up_price(code)), tool.is_ge_code(code)) |
| | | fdatas = [] |
| | | for d in data_list: |
| | | if d < bigger_money: |
| | |
| | | """ |
| | | return get_market_type(code) == MARKET_TYPE_SZSE |
| | | |
| | | def is_ge_code(code): |
| | | """ |
| | | 是否是创业板 |
| | | @param code: |
| | | @return: |
| | | """ |
| | | return code.find("30")==0 |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(is_sz_code("0000")) |