Administrator
2025-07-08 283a7c89f85b1584fde8ff429028506dc00e53d7
utils/tool.py
@@ -3,6 +3,7 @@
"""
import ctypes
import decimal
import json
import math
import random
import threading
@@ -318,6 +319,14 @@
    return max(price1, price2)
# 获取买入价格笼子的最高价
def get_buy_max_price(price):
    price1 = price * (1 + 0.02)
    price1 = math.ceil(price1 * 100) / 100
    price2 = price + 0.1
    return max(price1, price2)
# 获取买入价格笼子的最低价
def get_shadow_price(price):
    # fprice = round((100 - random.randint(2, 10)) * price / 100, 2)
@@ -461,5 +470,12 @@
    return code.find("30") == 0
class SetEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, set):
            return list(obj)
        return json.JSONEncoder.default(self, obj)
if __name__ == "__main__":
    print(timestamp_format(1726034271, "%H%M%S"))