| | |
| | | return item |
| | | |
| | | # 卖大于2w且是涨停卖 |
| | | if item[3] != '1' and item[2] > filter_condition[0][4] and item[1] == filter_condition[0][1]: |
| | | # if item[3] != '1' and item[2] > filter_condition[0][4] and item[1] == filter_condition[0][1]: |
| | | # return item |
| | | |
| | | # 所有的涨停卖 |
| | | if item[1] == filter_condition[0][1]: |
| | | return item |
| | | |
| | | return None |
| | |
| | | import constant |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from l2.huaxin import l2_huaxin_util, huaxin_delegate_postion_manager |
| | | from l2.l2_limitup_sell_data_manager import L2LimitUpSellDataManager |
| | | from l2.l2_sell_manager import L2MarketSellManager, L2LimitUpSellManager |
| | | from l2.l2_transaction_data_manager import HuaXinSellOrderStatisticManager, BigOrderDealManager |
| | | from l2.place_order_single_data_manager import L2TradeSingleDataProcessor |
| | |
| | | limit_up_price = round(float(limit_up_price), 2) |
| | | # if trade_price_info and limit_up_price and trade_price_info[0] == limit_up_price: |
| | | # filter_limit_up_sell = True |
| | | L2LimitUpSellDataManager.add_l2_origin_data(code, origin_datas) |
| | | datas = l2_huaxin_util.get_format_l2_datas(code, origin_datas, limit_up_price, _start_index, |
| | | filter_limit_up_sell) |
| | | __start_time = round(t.time() * 1000) |
New file |
| | |
| | | """ |
| | | 涨停卖数据管理 |
| | | """ |
| | | from code_attribute import gpcode_manager |
| | | from l2 import l2_log |
| | | from log_module import async_log_util |
| | | from log_module.log import hx_logger_l2_sell_delegate, hx_logger_l2_sell_deal |
| | | |
| | | |
| | | class L2LimitUpSellDataManager: |
| | | """ |
| | | 涨停卖数据管理: |
| | | 用来扫代码使用,当涨停卖有成交的时候就代表在吃最后一档 |
| | | 此时统计涨停卖的金额作为快照 |
| | | 当板上成交额大于涨停卖数据一定的比值就下单 |
| | | """ |
| | | # 卖单集合 |
| | | __order_no_set_dict = {} |
| | | |
| | | # 订单号与数据的对照表:{code:{orderno:[order_no,price,volume]}} |
| | | __order_no_data_map_dict = {} |
| | | # 挂起的卖手数 |
| | | __delegating_sell_num_dict = {} |
| | | |
| | | @classmethod |
| | | def add_l2_origin_data(cls, code, origin_datas): |
| | | """ |
| | | 添加L2委托原始数据 |
| | | @param code: 代码 |
| | | @param origin_datas: 原始数据 |
| | | @return: |
| | | """ |
| | | try: |
| | | if code not in cls.__order_no_set_dict: |
| | | cls.__order_no_set_dict[code] = set() |
| | | if code not in cls.__order_no_data_map_dict: |
| | | cls.__order_no_data_map_dict[code] = {} |
| | | if code not in cls.__delegating_sell_num_dict: |
| | | cls.__delegating_sell_num_dict[code] = 0 |
| | | |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | for d in origin_datas: |
| | | order_no, price, volume = d[8], d[1], d[2] |
| | | if price != limit_up_price: |
| | | continue |
| | | if d[9] == 'D': |
| | | if d[3] != '1': |
| | | # 卖撤 |
| | | cls.__order_no_set_dict[code].discard(order_no) |
| | | cls.__delegating_sell_num_dict[code] -= volume |
| | | async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-卖撤-{order_no, price, volume}") |
| | | |
| | | else: |
| | | if d[3] != '1': |
| | | # 卖 |
| | | cls.__order_no_data_map_dict[code][order_no] = (order_no, price, volume) |
| | | cls.__order_no_set_dict[code].add(order_no) |
| | | cls.__delegating_sell_num_dict[code] += volume |
| | | async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-卖-{order_no, price, volume}") |
| | | except: |
| | | pass |
| | | |
| | | @classmethod |
| | | def set_deal_datas(cls, code, datas): |
| | | """ |
| | | 设置成交的卖单 |
| | | @param code: |
| | | @param datas: q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'],data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],data['SellNo'], data['ExecType'])) |
| | | @return: 是否触发计算 |
| | | """ |
| | | try: |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | has_limit_up_active_buy = False |
| | | for d in datas: |
| | | # 是否有涨停主动买成交 |
| | | if d[6] < d[7]: |
| | | continue |
| | | if d[1] != limit_up_price: |
| | | continue |
| | | has_limit_up_active_buy = True |
| | | break |
| | | if has_limit_up_active_buy: |
| | | # 打印日志 |
| | | async_log_util.l2_data_log.info(hx_logger_l2_sell_deal, f"有涨停主动卖:{code}-{datas[-1][3]}-{ cls.__delegating_sell_num_dict.get(code)}") |
| | | except: |
| | | pass |
| | |
| | | from l2.l2_data_manager import OrderBeginPosInfo |
| | | from l2.l2_data_manager_new import L2TradeDataProcessor |
| | | from l2.l2_data_util import L2DataUtil |
| | | from l2.l2_limitup_sell_data_manager import L2LimitUpSellDataManager |
| | | from l2.l2_transaction_data_manager import HuaXinBuyOrderManager, HuaXinSellOrderStatisticManager, BigOrderDealManager |
| | | from log_module import async_log_util |
| | | from log_module.log import hx_logger_l2_debug, logger_l2_trade_buy_queue, logger_debug, hx_logger_l2_upload |
| | |
| | | # GCancelBigNumComputer().set_big_sell_order_info(code, big_sell_order_info) |
| | | use_time_list.append(("处理卖单相关撤数据", time.time() - _start_time)) |
| | | _start_time = time.time() |
| | | # 统计涨停卖成交 |
| | | HuaXinSellOrderStatisticManager.statistic_total_deal_volume(code, datas, limit_up_price) |
| | | use_time_list.append(("统计成交量数据", time.time() - _start_time)) |
| | | except Exception as e: |
| | | async_log_util.error(logger_debug, f"卖单统计异常:{big_sell_order_info}") |
| | | logger_debug.exception(e) |
| | | _start_time = time.time() |
| | | L2LimitUpSellDataManager.set_deal_datas(code, datas) |
| | | cls.__statistic_thread_pool.submit(cls.statistic_big_order_infos, code, datas, order_begin_pos) |
| | | |
| | | use_time_list.append(("统计买单数据", time.time() - _start_time)) |
| | |
| | | filter=lambda record: record["extra"].get("name") == "hx_l2_debug", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_hx_path("l2", "sell_l2_delegate"), |
| | | filter=lambda record: record["extra"].get("name") == "hx_l2_sell_delegate", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_hx_path("l2", "sell_l2_deal"), |
| | | filter=lambda record: record["extra"].get("name") == "hx_l2_sell_deal", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_hx_path("contact", "debug"), |
| | | filter=lambda record: record["extra"].get("name") == "hx_contact_debug", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | |
| | | hx_logger_trade_debug = __mylogger.get_logger("hx_trade_debug") |
| | | hx_logger_trade_loop = __mylogger.get_logger("hx_trade_loop") |
| | | hx_logger_l2_active_sell = __mylogger.get_logger("hx_l2_active_sell") |
| | | hx_logger_l2_sell_delegate = __mylogger.get_logger("hx_l2_sell_delegate") |
| | | hx_logger_l2_sell_deal = __mylogger.get_logger("hx_l2_sell_deal") |
| | | |
| | | # -------------------------------华鑫本地日志--------------------------------- |
| | | logger_local_huaxin_l2_transaction = __mylogger.get_logger("local_huaxin_transaction") |
| | |
| | | limit_up_timestamp = LimitUpDataConstant.get_first_limit_up_time(code) |
| | | if not limit_up_timestamp: |
| | | limit_up_timestamp = time.time() |
| | | if limit_up_timestamp - current_before_codes_info[0][1] >= 10 * 60: |
| | | if limit_up_timestamp - current_before_codes_info[0][1] >= 15 * 60: |
| | | return False, f"距离老大涨停已过去10分钟({current_before_codes_info[0]})" |
| | | |
| | | history_index, history_before_codes_info = cls.__get_history_index(code, block, set()) |