| | |
| | | def buy_1_cancel(): |
| | | _start_time = round(t.time() * 1000) |
| | | # 撤单计算,只看买1 |
| | | cancel_data, cancel_msg = L2LimitUpMoneyStatisticUtil.process_data(code, start_index, |
| | | end_index, |
| | | buy_single_index, buy_exec_index) |
| | | cancel_data, cancel_msg = L2LimitUpMoneyStatisticUtil().process_data(code, start_index, |
| | | end_index, |
| | | buy_single_index, buy_exec_index) |
| | | |
| | | l2_data_log.l2_time(code, round(t.time() * 1000) - _start_time, |
| | | "已下单-买1统计耗时") |
| | |
| | | # 统计板上卖 |
| | | try: |
| | | cancel_data, cancel_msg = L2LimitUpSellStatisticUtil().process(code, start_index, |
| | | end_index, |
| | | buy_exec_index) |
| | | end_index, |
| | | buy_exec_index) |
| | | return cancel_data, cancel_msg |
| | | except Exception as e: |
| | | logging.exception(e) |
| | |
| | | # is_limited_up = gpcode_manager.FirstCodeManager().is_limited_up(code) |
| | | # if not is_limited_up: |
| | | # gpcode_manager.FirstCodeManager().add_limited_up_record([code]) |
| | | # place_order_count = trade_data_manager.PlaceOrderCountManager.get_place_order_count( |
| | | # place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count( |
| | | # code) |
| | | # if place_order_count == 0: |
| | | # trade_data_manager.PlaceOrderCountManager.place_order(code) |
| | | # trade_data_manager.PlaceOrderCountManager().place_order(code) |
| | | # return False, True, "首板代码,且尚未涨停过" |
| | | |
| | | try: |
| | | # 买1价格必须为涨停价才能买 |
| | | # buy1_price = cls.buy1PriceManager.get_price(code) |
| | | # buy1_price = cls.buy1PriceManager().get_price(code) |
| | | # if buy1_price is None: |
| | | # return False, "买1价尚未获取到" |
| | | # limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | |
| | | if zyltgb >= 200 * 100000000: |
| | | buy1_price = code_price_manager.Buy1PriceManager.get_buy1_price(code) |
| | | buy1_price = code_price_manager.Buy1PriceManager().get_buy1_price(code) |
| | | if buy1_price is None: |
| | | return False, True, f"尚未获取到买1价" |
| | | dif = float(limit_up_price) - float(buy1_price) |
| | |
| | | if dif > 0.10001: |
| | | return False, True, f"自由流通200亿以上,买1剩余档数大于10档,买一({buy1_price})涨停({limit_up_price})" |
| | | |
| | | open_limit_up_lowest_price = code_price_manager.Buy1PriceManager.get_open_limit_up_lowest_price(code) |
| | | open_limit_up_lowest_price = code_price_manager.Buy1PriceManager().get_open_limit_up_lowest_price(code) |
| | | price_pre_close = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code) |
| | | if open_limit_up_lowest_price and ( |
| | | float(open_limit_up_lowest_price) - price_pre_close) / price_pre_close < 0.05: |
| | | return False, True, f"炸板后最低价跌至5%以下" |
| | | |
| | | limit_up_info = code_price_manager.Buy1PriceManager.get_limit_up_info(code) |
| | | limit_up_info = code_price_manager.Buy1PriceManager().get_limit_up_info(code) |
| | | if limit_up_info[0] is None and False: |
| | | total_data = local_today_datas.get(code) |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |
| | |
| | | f1 = dask.delayed(cls.__save_order_begin_data)(code, buy_single_index, compute_index, compute_index, |
| | | buy_nums, buy_count, max_num_set_new, |
| | | cls.volume_rate_info[code][0]) |
| | | f2 = dask.delayed(limit_up_time_manager.LimitUpTimeManager().save_limit_up_time)(code, total_datas[compute_index]["val"]["time"]) |
| | | f2 = dask.delayed(limit_up_time_manager.LimitUpTimeManager().save_limit_up_time)(code, |
| | | total_datas[compute_index][ |
| | | "val"]["time"]) |
| | | f3 = dask.delayed(cls.__virtual_buy)(code, buy_single_index, compute_index, capture_time) |
| | | f4 = dask.delayed(l2_data_manager.TradePointManager.delete_buy_cancel_point)(code) |
| | | f5 = dask.delayed(L2LimitUpMoneyStatisticUtil.process_data)(code, buy_single_index, |
| | | compute_index, |
| | | buy_single_index, |
| | | buy_exec_index, False) |
| | | dask.compute(f1, f2, f3, f4, f5) |
| | | f4 = dask.delayed(l2_data_manager.TradePointManager().delete_buy_cancel_point)(code) |
| | | # 暂时不需要 |
| | | # f5 = dask.delayed(L2LimitUpMoneyStatisticUtil.process_data)(code, buy_single_index, |
| | | # compute_index, |
| | | # buy_single_index, |
| | | # buy_exec_index, False) |
| | | dask.compute(f1, f2, f3, f4) |
| | | |
| | | # 已被并行处理 |
| | | # # 记录买入信号位置 |
| | |
| | | # 获取下单起始信号 |
| | | @classmethod |
| | | def __get_order_begin_pos(cls, code): |
| | | buy_single_index, buy_exec_index, compute_index, num, count, max_num_set, volume_rate = l2_data_manager.TradePointManager.get_buy_compute_start_data_cache( |
| | | buy_single_index, buy_exec_index, compute_index, num, count, max_num_set, volume_rate = l2_data_manager.TradePointManager().get_buy_compute_start_data_cache( |
| | | code) |
| | | return buy_single_index, buy_exec_index, compute_index, num, count, max_num_set, volume_rate |
| | | |
| | |
| | | @classmethod |
| | | def __save_order_begin_data(self, code, buy_single_index, buy_exec_index, compute_index, num, count, max_num_set, |
| | | volume_rate): |
| | | TradePointManager.set_buy_compute_start_data(code, buy_single_index, buy_exec_index, compute_index, num, count, |
| | | TradePointManager().set_buy_compute_start_data(code, buy_single_index, buy_exec_index, compute_index, num, count, |
| | | max_num_set, volume_rate) |
| | | |
| | | # 计算下单起始信号 |
| | |
| | | # 目标手数 |
| | | threshold_num = round(threshold_money / (limit_up_price * 100)) |
| | | |
| | | # place_order_count = trade_data_manager.PlaceOrderCountManager.get_place_order_count(code) |
| | | # place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count(code) |
| | | # 目标订单数量 |
| | | threshold_count = cls.__l2PlaceOrderParamsManagerDict[code].get_safe_count() |
| | | |
| | |
| | | trigger_buy = False |
| | | # 必须为连续2秒内的数据 |
| | | if L2DataUtil.get_time_as_second(_val["time"]) - buy_single_time_seconds + 1 > max_space_time: |
| | | TradePointManager.delete_buy_point(code) |
| | | TradePointManager().delete_buy_point(code) |
| | | if i == compute_end_index: |
| | | # 数据处理完毕 |
| | | return None, buy_nums, buy_count, None, max_buy_num_set |