| | |
| | | except: |
| | | pass |
| | | # L撤比例 |
| | | l_down_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, |
| | | buy_mode=OrderBeginPosInfo.MODE_RADICAL) |
| | | l_down_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code, |
| | | buy_mode=OrderBeginPosInfo.MODE_RADICAL) |
| | | |
| | | # 在挂的距离成交进度位金额/(远近期参考量-单当日实时成交量)*100% |
| | | expire_rate = "未知" |
| | |
| | | expire_rate = "100%" |
| | | else: |
| | | expire_rate = f"{100 - round(100 * total_left_num * 100 / (referer_volume - today_volumn), 2)}%" |
| | | except: |
| | | pass |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | fdata = {"id": orderSysID, "code_info": (code, code_name), "total_num": total_nums, |
| | | "finish_num": deal_or_cancel_num, |
| | |
| | | "block": '', |
| | | "trade_queue": [], |
| | | "l_down_cancel_rate": l_down_cancel_rate, |
| | | "l_down_cancel_rate_info": cancel_rate_info, |
| | | "expire_rate": expire_rate |
| | | } |
| | | l_down_cancel_rate = CancelRateHumanSettingManager().get_l_down(code) |
| | |
| | | import socketserver |
| | | import subprocess |
| | | from http.server import BaseHTTPRequestHandler |
| | | from log_module.log import logger_system, logger_request_api |
| | | from log_module.log import logger_system, logger_request_api, logger_debug |
| | | |
| | | from utils import tool |
| | | |
| | |
| | | root_dir = ps_dict.get("dir") |
| | | script = ps_dict.get("script") |
| | | output_file = ps_dict.get("output") |
| | | logger_debug.info(f"编译: dir - 【{root_dir}】, script - 【{script}】, output - 【{output_file}】 ") |
| | | output_file_path = os.path.join(root_dir, output_file) |
| | | if os.path.exists(output_file_path): |
| | | os.remove(output_file_path) |
| | |
| | | # 获取撤单比例,返回(撤单比例,是否必买) |
| | | @classmethod |
| | | def get_cancel_rate(cls, code, is_up=False, is_l_down_recomputed=False, buy_mode=None): |
| | | """ |
| | | |
| | | @param code: |
| | | @param is_up: |
| | | @param is_l_down_recomputed: |
| | | @param buy_mode: |
| | | @return: 撤单比例, 是否加红, (原值,人为设置的值) |
| | | """ |
| | | try: |
| | | must_buy = cls.__MustBuyCodesManager.is_in_cache(code) |
| | | if buy_mode == OrderBeginPosInfo.MODE_RADICAL: |
| | |
| | | human_rate = 0 |
| | | if must_buy: |
| | | # 扫入加红 |
| | | return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True |
| | | return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True, (constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate) |
| | | 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 max(threshold_rate, human_rate), False |
| | | return max(threshold_rate, human_rate), False, (threshold_rate, human_rate) |
| | | 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 max(threshold_rate, human_rate), False |
| | | return max(threshold_rate, human_rate), False, (threshold_rate, human_rate) |
| | | if must_buy: |
| | | if is_up: |
| | | return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True |
| | | return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True, None |
| | | else: |
| | | return constant.L_CANCEL_RATE_WITH_MUST_BUY, True |
| | | return constant.L_CANCEL_RATE_WITH_MUST_BUY, True, None |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_l_cancel, str(e)) |
| | | |
| | |
| | | base_rate += deal_rate |
| | | except Exception as e: |
| | | l2_log.l_cancel_debug(code, f"计算撤单比例出错:{e}") |
| | | return round(base_rate, 2), False |
| | | return round(base_rate, 2), False, None |
| | | |
| | | # 获取L后成交太快的撤单比例 |
| | | @classmethod |
| | |
| | | # 计算监听的总条数 |
| | | total_num = 0 |
| | | max_num, max_num_count = 0, 0 |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code) |
| | | |
| | | for wi in watch_indexes: |
| | | if str(wi) in after_place_order_index_dict: |
| | |
| | | else: |
| | | canceled_count_weight += WATCH_INDEX_WEIGHTS[-1] |
| | | rate = round(canceled_count_weight / total_count_weight, 3) |
| | | thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, is_up=True) |
| | | thresh_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code, is_up=True) |
| | | l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},L前已撤单比例:{rate}/{thresh_cancel_rate}") |
| | | if rate >= thresh_cancel_rate: |
| | | # 计算成交进度位置到当前下单位置的纯买额 |
| | |
| | | total_nums += val["num"] |
| | | if left_count > 0 and index < trade_index: |
| | | total_deal_nums += val["num"] |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code) |
| | | if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05: |
| | | return False |
| | | return True |
| | |
| | | price = transaction_datas[-1][1] |
| | | huaxin_timestamp = transaction_datas[-1][3] |
| | | |
| | | # 判断是否可以扫入 |
| | | # 判断是否可以扫入, 暂时都不可扫入 |
| | | can_direct_buy = False |
| | | human_setting_money = TotalDealBigOrderThresholdMoneyManager().get_money_cache(code) |
| | | if human_setting_money: |
| | | can_direct_buy = True |
| | | # 自由市值80亿以上不扫 |
| | | # zyltgb = global_util.zyltgb_map.get( |
| | | # code) |
| | | # if zyltgb and zyltgb < 80e8: |
| | | # can_direct_buy = True |
| | | pass |
| | | |
| | | # 获取参考总卖额 |
| | | refer_sell_data = L2MarketSellManager().get_refer_sell_data(code, l2_huaxin_util.convert_time( |