m值衰减比例更改/安全笔数最小值更改/下单后L2监听特殊笔数时间范围修改
| | |
| | | return [] |
| | | |
| | | def set_code_special_watch_volume(self, code, volume): |
| | | # 有效期为2s |
| | | self.special_code_volume_for_order_dict[code] = (volume, time.time() + 2) |
| | | # 有效期为3s |
| | | self.special_code_volume_for_order_dict[code] = (volume, time.time() + 3) |
| | | async_log_util.info(logger_local_huaxin_l2_subscript, f"设置下单量监听:{code}-{volume}") |
| | | |
| | | def OnFrontConnected(self): |
| | |
| | | # 获取下单信息 |
| | | def get_order_info(code): |
| | | info = _place_order_info_dict.get(code) |
| | | if info and time.time() - info[3] > 1: |
| | | async_log_util.info(logger_real_place_order_position, "get_order_info 间隔1s以上:code-{}", code) |
| | | if info and time.time() - info[3] > 3: |
| | | async_log_util.info(logger_real_place_order_position, "get_order_info 间隔3s以上:code-{}", code) |
| | | # 间隔3s以上就无效了 |
| | | info = None |
| | | _place_order_info_dict.pop(code) |
| | |
| | | base_count, min_count, max_count = L2TradeFactorUtil.get_safe_buy_count(self.code, True) |
| | | rate = self.get_safe_count_rate() |
| | | count = int(round(base_count * (1 + rate))) |
| | | return count |
| | | # 最少8笔 |
| | | return max(count, 8) |
| | | |
| | | # 获取m值影响比例 |
| | | @classmethod |
| | | def get_m_val_rate(cls, volume_rate_index): |
| | | rates = [0.0, -0.1, -0.2, -0.3, -0.4, -0.5, -0.6, -0.7] |
| | | rates = [0.0, -0.1, -0.15, -0.2, -0.25, -0.3, -0.35, -0.4] |
| | | if volume_rate_index >= len(rates): |
| | | volume_rate_index = -1 |
| | | return rates[volume_rate_index] |
| | |
| | | # print(L2TradeFactorUtil.get_rate_factors("003004")) |
| | | # print(L2TradeFactorUtil.factors_to_string("003004")) |
| | | |
| | | for i in range(2, 150): |
| | | print(i, L2TradeFactorUtil.get_base_safe_val(100000000 * i)) |
| | | # for i in range(2, 150): |
| | | print(19, L2TradeFactorUtil.get_base_safe_val(100000000 * 19)) |
| | | # print(L2TradeFactorUtil.get_limit_up_time_rate("11:30:00")) |
| | | # print(L2TradeFactorUtil.get_limit_up_time_rate("13:00:00")) |
| | | # print(L2TradeFactorUtil.get_limit_up_time_rate("13:48:00")) |