| | |
| | | from l2.l2_sell_manager import L2MarketSellManager, L2LimitUpSellManager |
| | | from l2.transaction_progress import TradeBuyQueue |
| | | from log_module import async_log_util, log_export |
| | | from third_data import kpl_data_manager, block_info |
| | | from third_data import kpl_data_manager, block_info, history_k_data_util |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | from utils import global_util, ths_industry_util, tool |
| | | import l2_data_util |
| | | from db import redis_manager_delegate as redis_manager |
| | |
| | | from l2 import l2_data_manager, l2_log, l2_data_source_util, code_price_manager, \ |
| | | transaction_progress, cancel_buy_strategy, l2_data_log |
| | | from l2.cancel_buy_strategy import SecondCancelBigNumComputer, HourCancelBigNumComputer, DCancelBigNumComputer, \ |
| | | LCancelBigNumComputer, LatestCancelIndexManager, FastCancelBigNumComputer, LCancelRateManager |
| | | LCancelBigNumComputer, LatestCancelIndexManager, FastCancelBigNumComputer, LCancelRateManager, GCancelBigNumComputer |
| | | from l2.l2_data_manager import L2DataException, OrderBeginPosInfo |
| | | from l2.l2_data_util import local_today_datas, L2DataUtil, local_today_num_operate_map, local_today_buyno_map, \ |
| | | local_latest_datas, local_today_canceled_buyno_map |
| | |
| | | __SecondCancelBigNumComputer = SecondCancelBigNumComputer() |
| | | __HourCancelBigNumComputer = HourCancelBigNumComputer() |
| | | __LCancelBigNumComputer = LCancelBigNumComputer() |
| | | __GCancelBigNumComputer = GCancelBigNumComputer() |
| | | __TradeStateManager = trade_manager.TradeStateManager() |
| | | __CodesTradeStateManager = trade_manager.CodesTradeStateManager() |
| | | __PauseBuyCodesManager = gpcode_manager.PauseBuyCodesManager() |
| | |
| | | pass |
| | | return None, "" |
| | | |
| | | # G撤 |
| | | def g_cancel(_buy_single_index, _buy_exec_index): |
| | | try: |
| | | b_need_cancel, b_cancel_data, extra_msg = cls.__GCancelBigNumComputer.need_cancel(code, |
| | | _buy_exec_index, |
| | | start_index, |
| | | end_index) |
| | | if b_need_cancel and b_cancel_data: |
| | | return b_cancel_data, f"G撤({extra_msg})" |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_error, |
| | | f"G撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 错误原因:{str(e)}") |
| | | # logger_l2_error.exception(e) |
| | | async_log_util.exception(logger_l2_error, e) |
| | | finally: |
| | | # l2_data_log.l2_time(code, round(t.time() * 1000) - _start_time, "已下单-L撤大单计算") |
| | | pass |
| | | return None, "" |
| | | |
| | | if start_index < 0: |
| | | start_index = 0 |
| | | |
| | |
| | | cancel_data, cancel_msg = None, "" |
| | | if order_begin_pos.mode == OrderBeginPosInfo.MODE_FAST: |
| | | cancel_data, cancel_msg = f_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) |
| | | |
| | | if not cancel_data: |
| | | cancel_data, cancel_msg = g_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) |
| | | |
| | | # 依次处理 |
| | | if not cancel_data: |
| | |
| | | # if cls.__TradeTargetCodeModeManager.get_mode_cache() == TradeTargetCodeModeManager.MODE_ONLY_BUY_WANT_CODES: |
| | | # return False, True, f"只买想买单中的代码" |
| | | |
| | | if HighIncreaseCodeManager().is_in(code): |
| | | return False, True, f"涨幅过高,5天内3次涨停" |
| | | return cls.can_buy_first(code, limit_up_price) |
| | | # else: |
| | | # return True, False, "在想买名单中" |
| | |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.6: |
| | | return False, True, f"股价创新高或者逼近前高且30天内有涨停,当日量比({cls.volume_rate_info[code][0]})小于0.6" |
| | | |
| | | # 前一天炸板之后,今日10:00之前才能下单 |
| | | # 上5个交易日有炸板/跌停之后 |
| | | if k_format and len(k_format) >= 11 and k_format[10]: |
| | | if now_timestamp > int("100000"): |
| | | return False, True, f"上个交易日炸板,当日10点以后不下单" |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.6: |
| | | return False, True, f"上5个交易日炸板/跌停,量未达到60%({cls.volume_rate_info[code][0]})" |
| | | |
| | | # 获取量的参考日期 |
| | | if code in global_util.max60_volumn: |
| | | day = global_util.max60_volumn[code][1] |
| | | if day in HistoryKDatasUtils.get_latest_trading_date_cache(5): |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.6: |
| | | return False, True, f"参考量在最近5天,量未达到60%({cls.volume_rate_info[code][0]})" |
| | | |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb >= 40 * 100000000: |
| | | return False, True, f"40亿以上的都不买({zyltgb})" |
| | | |
| | | if HighIncreaseCodeManager().is_in(code): |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.8: |
| | | return False, True, f"5天内3次涨停,量未达到80%({cls.volume_rate_info[code][0]})" |
| | | |
| | | msg_list = [] |
| | | if can_buy_result[3] and now_timestamp <= int("094000"): |
| | | if now_timestamp <= int("094000"): |
| | | msg_list.append("强势10分钟") |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | # 独苗 |
| | | if not can_buy_result[0] and can_buy_result[1]: |
| | | msg_list.append("独苗") |
| | |
| | | return True, False, can_buy_result[2] |
| | | return True, False, can_buy_result[2] |
| | | else: |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | # 非强势10分钟只买主线 |
| | | if not can_buy_result[0] and can_buy_result[1]: |
| | | return False, True, f"非强势10分钟,独苗不下单" |