| | |
| | | """ |
| | | import time |
| | | |
| | | from code_attribute import gpcode_manager |
| | | from code_attribute import gpcode_manager, code_volumn_manager |
| | | from l2 import l2_data_util, l2_data_source_util, transaction_progress |
| | | from l2.l2_data_util import L2DataUtil |
| | | from l2.l2_transaction_data_manager import HuaXinSellOrderStatisticManager |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_l2_error |
| | | from settings.trade_setting import MarketSituationManager, TradeBlockBuyModeManager |
| | | from trade import trade_data_manager |
| | | from utils import tool, buy_condition_util, global_util |
| | |
| | | @param trade_index: |
| | | @return: |
| | | """ |
| | | total_data = l2_data_util.local_today_datas.get(code) |
| | | total_count = 0 |
| | | total_big_count = 0 |
| | | for i in range(trade_index + 1, total_data[-1]["index"] + 1): |
| | | data = total_data[i] |
| | | val = data["val"] |
| | | if not l2_data_util.L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | money = val["num"] * float(val["price"]) |
| | | if money < 5000: |
| | | continue |
| | | # 获取今日成交量与参考量 |
| | | # today = get_today_volumn(code) |
| | | # max60, yesterday = get_histry_volumn(code) |
| | | try: |
| | | today_volume = code_volumn_manager.get_today_volumn_cache(code) |
| | | histry_volumn = code_volumn_manager.get_histry_volumn(code) |
| | | if not today_volume or not histry_volumn: |
| | | return False, "尚未获取到量" |
| | | threshhold_volume = (histry_volumn[0][0] - today_volume) // 3 |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | threshhold_volumes = threshhold_volume // 100, int(50000 / limit_up_price), int(200000 / limit_up_price) |
| | | |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2( |
| | | code, |
| | | i, |
| | | total_data, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_count += 1 |
| | | if money > 29900: |
| | | total_big_count += 1 |
| | | if total_count > 10: |
| | | break |
| | | if total_count > 10 or total_big_count < 1: |
| | | return False, f"未成交数量-{total_count},大单数量-{total_big_count}" |
| | | return True, "" |
| | | total_data = l2_data_util.local_today_datas.get(code) |
| | | total_count = 0 |
| | | total_big_count = 0 |
| | | total_num = 0 |
| | | for i in range(trade_index + 1, total_data[-1]["index"] + 1): |
| | | data = total_data[i] |
| | | val = data["val"] |
| | | if not l2_data_util.L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | money = val["num"] * float(val["price"]) |
| | | if money < 5000: |
| | | continue |
| | | |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2( |
| | | code, |
| | | i, |
| | | total_data, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_num += val["num"] |
| | | total_count += 1 |
| | | if money > 29900: |
| | | total_big_count += 1 |
| | | if threshhold_volumes[2] < total_num: |
| | | break |
| | | if threshhold_volumes[1] <= total_num <= threshhold_volumes[2] and total_num < threshhold_volumes[ |
| | | 0] and total_big_count > 0: |
| | | # 剩余的值在500w-2000w之间才会参与计算 |
| | | return True, "" |
| | | return False, f"未成交手数-{total_num},阈值-{threshhold_volumes[0]},大单数量-{total_big_count}" |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_error, f"计算是否距离成交进度位置近:{str(e)}") |
| | | return False, "计算异常" |
| | | |
| | | |
| | | def is_quantization(code, start_index, end_index): |