| | |
| | | from trade.buy_radical import radical_buy_data_manager, radical_buy_strategy |
| | | from l2 import l2_data_manager, l2_log, l2_data_source_util, code_price_manager, \ |
| | | transaction_progress, cancel_buy_strategy, place_order_single_data_manager |
| | | from l2.cancel_buy_strategy import LatestCancelIndexManager, NewGCancelBigNumComputer, JCancelBigNumComputer, L2DataComputeUtil, RDCancelBigNumComputer |
| | | from l2.cancel_buy_strategy import LatestCancelIndexManager, NewGCancelBigNumComputer, JCancelBigNumComputer, \ |
| | | L2DataComputeUtil, RDCancelBigNumComputer |
| | | 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, local_today_sellno_map |
| | |
| | | trade_record_log_util.add_place_order_use_time(code, |
| | | f"执行位时间:{L2DataUtil.get_time_with_ms(total_datas[order_begin_pos.buy_exec_index]['val'])} 耗时:{use_time}") |
| | | l2_log.debug(code, "设置真实下单位:{}", index) |
| | | cancel_buy_strategy.set_real_place_position(code, index, order_begin_pos.buy_single_index, is_default=False) |
| | | cancel_type, cancel_msg = cancel_buy_strategy.set_real_place_position(code, index, order_begin_pos.buy_single_index, is_default=False) |
| | | # 获取真实下单位置之后需要判断F撤 |
| | | try: |
| | | cancel_result = cancel_buy_strategy.FCancelBigNumComputer().need_cancel_for_deal_fast(code) |
| | | cancel_result = False, '', None |
| | | if cancel_type: |
| | | # 要撤单 |
| | | cancel_result = True, f"{cancel_msg}", cancel_type |
| | | if not cancel_result[0]: |
| | | cancel_result = cancel_buy_strategy.FCancelBigNumComputer().need_cancel_for_deal_fast(code) |
| | | if cancel_result[0]: |
| | | cancel_result = True, f"F撤:{cancel_result[1]}", trade_constant.CANCEL_TYPE_F |
| | | if cancel_result[0]: |
| | | L2TradeDataProcessor.cancel_buy(code, f"F撤:{cancel_result[1]}", |
| | | cancel_type=trade_constant.CANCEL_TYPE_F) |
| | | L2TradeDataProcessor.cancel_buy(code, cancel_result[1], |
| | | cancel_type=cancel_result[2]) |
| | | return |
| | | else: |
| | | l2_log.f_cancel_debug(code, f"获取真实成交位的F撤未生效:{cancel_result[1]}") |
| | |
| | | return False, True, f"09:32之前不能交易", True |
| | | if 125950 < now_time_int < 130100: |
| | | # 判断大单是否足够 |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, gpcode_manager.get_limit_up_price_as_num(code)) |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | if 5000e4 <= deal_big_order_info[5] < deal_big_order_info[1]: |
| | | pass |
| | | else: |
| | |
| | | current_deal_order_ids = big_order_deal_enough_result[7] |
| | | total_lack_money = int(big_order_deal_enough_result[6]) |
| | | |
| | | |
| | | # 如果有大单成交就不需要看大单 |
| | | if constant.CAN_RADICAL_BUY_NEED_BIG_ORDER_EVERYTIME: |
| | | # 每次下单都需要大单 |
| | |
| | | if t.time() > radical_data[0]: |
| | | return False, None, "超过生效时间" |
| | | |
| | | result = __can_order_v2() |
| | | # 根据建比来决定下单方式 |
| | | deal_big_money_info = radical_buy_data_manager.get_total_deal_big_order_info( |
| | | code, gpcode_manager.get_limit_up_price_as_num(code)) |
| | | if deal_big_money_info: |
| | | temp_rate = deal_big_money_info[1] / deal_big_money_info[5] |
| | | if temp_rate >= 0.4: |
| | | result = __can_order_v2() |
| | | else: |
| | | result = __can_order() |
| | | else: |
| | | result = __can_order() |
| | | |
| | | l2_log.debug(code, f"L2扫入判断({start_index}-{end_index}):{result}") |
| | | if result[0]: |
| | | # 已经扫入下过单且允许板上放量扫入的就需要判断板上放量的距离 |