| | |
| | | try: |
| | | must_buy = cls.__MustBuyCodesManager.is_in_cache(code) |
| | | if buy_mode == OrderBeginPosInfo.MODE_RADICAL: |
| | | try: |
| | | human_rate = CancelRateHumanSettingManager().get_l_down(code) |
| | | if human_rate is None: |
| | | human_rate = 0 |
| | | except: |
| | | human_rate = 0 |
| | | if must_buy: |
| | | # 扫入加红 |
| | | return constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, True |
| | | return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True |
| | | else: |
| | | # 根据成交额的大单成交占比来计算撤单比例 |
| | | big_money_rate = radical_buy_data_manager.TotalDealBigOrderInfoManager.get_big_order_rate(code) |
| | | if big_money_rate is not None: |
| | | threshold_rate = min(big_money_rate * 3, 0.8) |
| | | return threshold_rate, False |
| | | return max(threshold_rate, human_rate), False |
| | | else: |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | |
| | | threshold_rate = 0.5 * deal_rate + 0.35 |
| | | threshold_rate = max(threshold_rate, 0.375) |
| | | threshold_rate = min(threshold_rate, 0.8) |
| | | return threshold_rate, False |
| | | return max(threshold_rate, human_rate), False |
| | | if must_buy: |
| | | if is_up: |
| | | return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True |
| | |
| | | total_buy_money = BigOrderDealManager().get_total_buy_money(code) |
| | | total_sell_money = BigOrderDealManager().get_total_sell_money(code) |
| | | cls.set_big_num_deal_info(code, total_buy_money, total_sell_money) |
| | | |
| | | |
| | | @tool.singleton |
| | | class CancelRateHumanSettingManager: |
| | | """ |
| | | 手动撤单率设置 |
| | | """ |
| | | |
| | | def __init__(self): |
| | | # L后撤单 |
| | | self.l_down = {} |
| | | |
| | | def set_l_down(self, code, rate): |
| | | self.l_down[code] = rate |
| | | |
| | | def get_l_down(self, code): |
| | | return self.l_down.get(code) |
| | | |
| | | def remove_l_down(self, code): |
| | | if code in self.l_down: |
| | | self.l_down.pop(code) |
| | | |
| | | |
| | | # 计算成交位置之后的大单(特定笔数)的撤单比例 |
| | |
| | | trade_index = None |
| | | canceled_buyno_map = local_today_canceled_buyno_map.get(code) |
| | | for wi in watch_indexes: |
| | | cancel_data = L2DataComputeUtil.is_canceled(code, wi, total_data, canceled_buyno_map, trade_index, deal_order_nos) |
| | | cancel_data = L2DataComputeUtil.is_canceled(code, wi, total_data, canceled_buyno_map, trade_index, |
| | | deal_order_nos) |
| | | if cancel_data: |
| | | if str(wi) in after_place_order_index_dict: |
| | | # 真实下单位置之后的按照权重比例来计算 |