Administrator
2024-06-14 70bbbc724f11ffa7d36aadcc0fed99e9394b2e82
utils/tool.py
@@ -344,6 +344,15 @@
        return MARKET_TYPE_UNKNOWN
def is_stock(code):
    """
    是否是股票
    :param code:
    :return:
    """
    return code.find("00") == 0 or code.find("30") == 0 or code.find("60") == 0 or code.find("68") == 0
def get_limit_up_rate(code):
    # 获取涨停倍数
    if code.find("00") == 0 or code.find("60") == 0:
@@ -368,6 +377,7 @@
    limit_up_price = to_price(decimal.Decimal(str(pre_close_price)) * decimal.Decimal(f"{get_limit_up_rate(code)}"))
    return limit_up_price
# 将时间戳s格式化
def to_time_str(timestamp_second, format_="%H:%M:%S"):
    return datetime.datetime.fromtimestamp(timestamp_second).strftime(format_)