| | |
| | | return |
| | | # 获取成交进度位与真实下单位置 |
| | | real_place_order_index_info = self.__real_place_order_index_dict.get(code) |
| | | last_trade_progress_index = self.__last_trade_progress_dict.get(code) |
| | | last_trade_progress_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if big_sell_info: |
| | | last_trade_progress_index = big_sell_info[0] |
| | | |
| | |
| | | self.__real_place_order_index_dict[code] = (index, is_default) |
| | | RedisUtils.setex_async(self.__db, f"l_cancel_real_place_order_index-{code}", tool.get_expire(), |
| | | json.dumps((index, is_default))) |
| | | |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | | |
| | | if buy_single_index is not None: |
| | | if code in self.__last_trade_progress_dict: |
| | | # L撤从成交进度位开始计算 |
| | | self.compute_watch_index(code, buy_single_index, |
| | | self.__last_trade_progress_dict[code], index) |
| | | else: |
| | | self.compute_watch_index(code, buy_single_index, buy_single_index, index) |
| | | # L后撤从成交进度位开始计算 |
| | | self.compute_watch_index(code, buy_single_index, trade_index, index) |
| | | self.__compute_trade_progress_near_by_indexes(code, buy_single_index, trade_index, index) |
| | | |
| | | if self.__last_trade_progress_dict.get(code): |
| | | self.__compute_trade_progress_near_by_indexes(code, buy_single_index, |
| | | self.__last_trade_progress_dict.get(code) + 1, index) |
| | | else: |
| | | self.__compute_trade_progress_near_by_indexes(code, buy_single_index, buy_single_index, index) |
| | | |
| | | # 重新计算L上 |
| | | # 重新计算L前 |
| | | def re_compute_l_up_watch_indexes(self, code, buy_single_index): |
| | | if code not in self.__last_trade_progress_dict: |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | return |
| | | if code not in self.__real_place_order_index_dict: |
| | | return |
| | | if code not in self.__last_l_up_compute_info or time.time() - self.__last_l_up_compute_info[code][0] >= 3: |
| | | self.__compute_trade_progress_near_by_indexes(code, buy_single_index, |
| | | self.__last_trade_progress_dict.get(code) + 1, |
| | | trade_index + 1, |
| | | self.__real_place_order_index_dict.get(code)[0]) |
| | | |
| | | # 计算范围内的成交位临近未撤大单 |
| | |
| | | if not l_down_cancel_info: |
| | | return |
| | | |
| | | trade_progress = self.__last_trade_progress_dict.get(code) |
| | | trade_progress, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_progress is None: |
| | | trade_progress = 0 |
| | | |
| | | if trade_progress is None: |
| | | return |
| | | |
| | |
| | | if rate >= thresh_cancel_rate: |
| | | # 计算成交进度位置到当前下单位置的纯买额 |
| | | real_place_order_index_info = self.__real_place_order_index_dict.get(code) |
| | | trade_progress_index = self.__last_trade_progress_dict.get(code) |
| | | trade_progress_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_progress_index is None: |
| | | trade_progress_index = 0 |
| | | if real_place_order_index_info and trade_progress_index: |
| | | total_num = 0 |
| | | thresh_hold_money = l2_trade_factor.L2PlaceOrderParamsManager.get_base_m_val(code) |
| | |
| | | watch_indexes_info = self.__get_watch_indexes_cache(code) |
| | | if not watch_indexes_info: |
| | | return True |
| | | trade_index = self.__last_trade_progress_dict.get(code) |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | | if trade_index is None: |
| | | return True |
| | | # 计算已经成交的比例 |