From da57f0e87d95b007b26560e6067169d1c434dc69 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 13 十月 2023 16:44:10 +0800 Subject: [PATCH] 测试影子订单 --- utils/tool.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/tool.py b/utils/tool.py index c2769fc..ece202b 100644 --- a/utils/tool.py +++ b/utils/tool.py @@ -3,6 +3,7 @@ """ import ctypes import decimal +import math import random import threading import time @@ -213,8 +214,16 @@ return datetime.datetime.fromtimestamp(timestamp_second).strftime(format_) +# 鑾峰彇涔板叆浠锋牸绗煎瓙鐨勬渶浣庝环 +def get_buy_min_price(price): + price1 = price * (1 - 0.02) + price1 = math.ceil(price1 * 100) / 100 + price2 = price - 0.1 + return max(price1, price2) + + if __name__ == "__main__": - print(int(to_time_str(1684132912).replace(":", ""))) + print(get_buy_min_price(20)) # print(trade_time_sub("11:29:59", 5)) # print(trade_time_sub("10:29:59", 10)) # print(trade_time_add_second("13:29:59", 60)) @@ -247,4 +256,4 @@ return thread_id except: pass - return None \ No newline at end of file + return None -- Gitblit v1.8.0