| | |
| | | from utils import tool |
| | | from l2.transaction_progress import TradeBuyQueue |
| | | from trade import trade_queue_manager, l2_trade_factor, trade_manager, trade_data_manager |
| | | from l2 import l2_log, l2_data_source_util |
| | | from l2 import l2_log, l2_data_source_util, code_price_manager |
| | | from l2.l2_data_util import L2DataUtil, local_today_num_operate_map, local_today_datas, local_today_buyno_map, \ |
| | | local_today_canceled_buyno_map |
| | | from log_module.log import logger_buy_1_volumn, logger_l2_error |
| | |
| | | __redis_manager = redis_manager.RedisManager(0) |
| | | __real_order_index_cache = {} |
| | | __max_buy_order_num_cache = {} |
| | | # 下单距离太远计算 |
| | | __far_away_computed_cache = {} |
| | | |
| | | __instance = None |
| | | |
| | |
| | | # 设置真实的下单位置 |
| | | def set_real_order_index(self, code, index, is_default): |
| | | self.__set_real_order_index(code, index, is_default) |
| | | self.__far_away_computed_cache[code] = False |
| | | # if not is_default and code.find("60") == 0: |
| | | try: |
| | | # 统计未成交的最大单 |
| | |
| | | total_count, total_num = L2DataComputeUtil.compute_left_buy_order(code, trade_index, real_order_index, |
| | | limit_up_price, min_money) |
| | | |
| | | # 下单后3秒,排撤比例≥65%则撤掉,视为P撤的一种,排得太后了。 |
| | | if sub_time > 3 and not self.__far_away_computed_cache.get(code): |
| | | self.__far_away_computed_cache[code] = True |
| | | # 成交进度位到真实下单位的位置过远 |
| | | total_count_, total_num_ = L2DataComputeUtil.compute_left_buy_order(code, trade_index, real_order_index, |
| | | limit_up_price, 500000) |
| | | # 获取买1金额 |
| | | buy1_money = code_price_manager.Buy1PriceManager().get_latest_buy1_money(code) |
| | | if buy1_money: |
| | | if total_num_ * limit_up_price * 100 > buy1_money * 0.65: |
| | | return True, f"P撤:成交位置距离下单位置太远 成交位-{trade_index} 下单位-{real_order_index} 买1-{buy1_money}" |
| | | min_time_s, max_time_s = 2, 30 |
| | | if total_num * limit_up_price >= 299 * 100: |
| | | min_time_s, max_time_s = 30, 60 |