| | |
| | | from trade.trade_manager import DealCodesManager, PlatePlaceOrderManager |
| | | from utils import huaxin_util, tool |
| | | |
| | | BIG_ORDER_MAX_SPACE_TIME = 3 |
| | | |
| | | |
| | | @tool.singleton |
| | | class TickSummaryDataManager: |
| | |
| | | IS_BY_BIG_ORDER = False |
| | | BIG_ORDER_MONEY_THRESHOLD = 200e4 |
| | | big_order_deals = self.__LowSuctionOriginDataExportManager.export_big_order_deal(BIG_ORDER_MONEY_THRESHOLD, |
| | | max_deal_space=3) |
| | | max_deal_space=BIG_ORDER_MAX_SPACE_TIME) |
| | | if not big_order_deals or IS_BY_BIG_ORDER: |
| | | big_order_deals = self.__LowSuctionOriginDataExportManager.export_big_order_deal_by( |
| | | BIG_ORDER_MONEY_THRESHOLD) |
| | |
| | | for d in big_orders: |
| | | try: |
| | | code = d[0] |
| | | # 只计算200w以上的买单 |
| | | if d[2][2] < 200e4: |
| | | continue |
| | | if d[1] == 0: |
| | | # 买单 |
| | | if code not in self.big_order_buy: |
| | | self.big_order_buy[code] = [] |
| | | self.big_order_buy[code].append(d[2]) |
| | | else: |
| | | # 卖单 |
| | | if code not in self.big_order_sell: |
| | | self.big_order_sell[code] = [] |
| | | self.big_order_sell[code].append(d[2]) |
| | | if code not in codes: |
| | | codes.append(code) |
| | | # 设置现价 |
| | | if code in self.stock_variables_dict: |
| | | self.stock_variables_dict[code].当前价 = d[2][4] |
| | | try: |
| | | # 只计算200w以上的买单 |
| | | if d[2][2] < 200e4: |
| | | continue |
| | | if d[1] == 0: |
| | | if tool.trade_time_sub(huaxin_util.convert_time(d[2][3]), |
| | | huaxin_util.convert_time(d[2][5])) > BIG_ORDER_MAX_SPACE_TIME: |
| | | # 成交超过指定时间 |
| | | continue |
| | | # 买单 |
| | | if code not in self.big_order_buy: |
| | | self.big_order_buy[code] = [] |
| | | self.big_order_buy[code].append(d[2]) |
| | | if code not in codes: |
| | | codes.append(code) |
| | | else: |
| | | # 卖单 |
| | | if code not in self.big_order_sell: |
| | | self.big_order_sell[code] = [] |
| | | self.big_order_sell[code].append(d[2]) |
| | | finally: |
| | | # 设置现价 |
| | | if code in self.stock_variables_dict: |
| | | self.stock_variables_dict[code].当前价 = d[2][4] |
| | | except Exception as e: |
| | | logger_debug.error(f"{d}") |
| | | # 驱动下单 |
| | | for code in codes: |
| | | self.__run(code, self.stock_variables_dict.get(code)) |
| | | try: |
| | | self.__run(code, self.stock_variables_dict.get(code)) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | def add_ticks(self, ticks): |
| | | """ |