Administrator
2024-07-29 b9bf21dca8ed7c7c196e1d1713689f7a342a54d7
修改订阅的自由流通市值/输出撤单原因
2个文件已修改
37 ■■■■■ 已修改文件
l2/l2_data_manager_new.py 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/tool.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py
@@ -837,7 +837,25 @@
        if now_time_int >= 145700:
            return False, True, f"14:57后不能交易"
        if 130100 >= now_time_int >= 112900 or now_time_int < 93100:
            return False, True, f"09:31:00之前,11:29:00-13:01:00不能交易"
            if now_time_int < 93100:
                # 判断成交的大单数量
                data_list = BigOrderDealManager().get_total_buy_money_list(code)
                bigger_money = 2990000
                fdatas = []
                for d in data_list:
                    if d < bigger_money:
                        continue
                    fdatas.append(d)
                if len(fdatas) < 3:
                    return False, True, f"09:31:00之前下单,成交大单数量({len(fdatas)})不足3个"
                else:
                    # 判断数据是否卡
                    total_datas = local_today_datas.get(code)
                    if tool.trade_time_sub_with_ms(tool.get_now_time_with_ms_str(),
                                                   L2DataUtil.get_time_with_ms(total_datas[-1]["val"])) > 500:
                        return False, True, f"09:31:00之前下单,L2数据时间相差500ms以上"
            else:
                return False, True, f"09:31:00之前,11:29:00-13:01:00不能交易"
        # place_order_count = cls.__PlaceOrderCountManager.get_place_order_count(code)
        # if place_order_count > 0 and now_time_int >= 140000:
@@ -957,7 +975,7 @@
                                                                                total_datas[-1]["index"],
                                                                                limit_up_price, min_money)
                if left_count < 1:
                    return False, False, f"第{place_order_count+1}下单无待成交的大单"
                    return False, False, f"第{place_order_count + 1}下单无待成交的大单"
        # 暂时注释想买单功能
        if not cls.__WantBuyCodesManager.is_in_cache(code):
@@ -2228,6 +2246,9 @@
                # 大于8亿的安全笔数必须有8笔
                if money_y >= 8:
                    safe_count = 8
            # 9:31之前下单,安全笔数最小为5笔
            if int(tool.get_now_time_str().replace(":", "")) < int("093100"):
                safe_count = max(safe_count, 5)
            if buy_count < safe_count:
                not_buy_msg = f"【{i}】安全笔数不足,{buy_count}/{safe_count}"
utils/tool.py
@@ -53,6 +53,12 @@
    time_str = datetime.datetime.now().strftime("%H:%M:%S")
    return time_str
def get_now_time_with_ms_str():
    now = datetime.datetime.now()
    ms = int(now.microsecond / 1000)
    time_str = now.strftime(f"%H:%M:%S.{ms:03d}")
    return time_str
def get_now_datetime_str():
    time_str = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -416,4 +422,8 @@
if __name__ == "__main__":
    print(is_sz_code("0000"))
    print(get_now_time_with_ms_str())
    print(get_now_time_with_ms_str())
    print(get_now_time_with_ms_str())
    time.sleep(0.001)
    print(get_now_time_with_ms_str())