| | |
| | | |
| | | # 设置订单过滤条件 |
| | | # special_price:过滤的1手的价格 |
| | | def set_order_fileter_condition(self, code, min_volume, limit_up_price, special_price, buy_volume, |
| | | special_volumes=None, |
| | | special_volumes_expire_time=None): |
| | | if special_volumes is None: |
| | | special_volumes = set() |
| | | if code in self.filter_order_condition_dict and not special_volumes and not special_volumes_expire_time: |
| | | self.filter_order_condition_dict[code][0] = (min_volume, limit_up_price, special_price, buy_volume) |
| | | def set_order_fileter_condition(self, code, min_volume, limit_up_price, shadow_price, buy_volume): |
| | | if code not in self.filter_order_condition_dict: |
| | | self.filter_order_condition_dict[code] = [(min_volume, limit_up_price, shadow_price, buy_volume)] |
| | | huaxin_l2_log.info(logger_local_huaxin_l2_subscript, |
| | | f"({code})常规过滤条件设置:{self.filter_order_condition_dict[code]}") |
| | | else: |
| | | self.filter_order_condition_dict[code] = [(min_volume, limit_up_price, special_price, buy_volume), |
| | | special_volumes, |
| | | special_volumes_expire_time] |
| | | huaxin_l2_log.info(logger_local_huaxin_l2_subscript, |
| | | f"({code})下单后过滤条件设置:{self.filter_order_condition_dict[code]}") |
| | | |
| | | # 过滤订单 |
| | | def __filter_order(self, item): |
| | |
| | | if item[2] >= filter_condition[0][0]: |
| | | return item |
| | | # 1手的买单满足价格 |
| | | if item[2] == 100 and item[3] == '1' and abs(filter_condition[0][2] - item[1]) < 0.001: |
| | | if item[2] == 100 and abs(filter_condition[0][2] - item[1]) < 0.001: |
| | | return item |
| | | # 买量 |
| | | if item[2] == filter_condition[0][3] and item[3] == '1': |
| | | return item |
| | | |
| | | if filter_condition[1] and item[2] in filter_condition[1]: |
| | | if filter_condition[2] and time.time() > filter_condition[2]: |
| | | # 超时了,需要清除特殊量数据 |
| | | filter_condition[1] = set() |
| | | filter_condition[2] = None |
| | | return None |
| | | if item[2] == filter_condition[0][3]: |
| | | return item |
| | | return None |
| | | return item |