From ed9e2367eea9baa6c8bea82e0f81c209ffb2a56f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 02 一月 2023 17:55:50 +0800 Subject: [PATCH] 撤单策略再次修改 --- tool.py | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tool.py b/tool.py index 27f8a60..eba30f9 100644 --- a/tool.py +++ b/tool.py @@ -157,6 +157,17 @@ return time_1 - time_2 +# 浜ゆ槗鏃堕棿鍔犲嚑s +def trade_time_add_second(time_str, second): + ts = time_str.split(":") + s_ = int(ts[0]) * 3600 + int(ts[1]) * 60 + int(ts[2]) + s = s_ + second + # 鏄惁鍦�11:30:00 + if s >= 11 * 3600 + 30 * 60 > s_: + s += 90 * 60 + return time_seconds_format(s) + + def compute_buy1_real_time(time_): ts = time_.split(":") s = int(ts[0]) * 3600 + int(ts[1]) * 60 + int(ts[2]) @@ -164,8 +175,21 @@ return time_seconds_format(s - 2 - cha) +# 鍏ㄨ杞崐瑙� +def strQ2B(ustring): + rstring = "" + for uchar in ustring: + inside_code = ord(uchar) + if inside_code == 12288: # 鍏ㄨ绌烘牸鐩存帴杞崲 + inside_code = 32 + elif 65281 <= inside_code <= 65374: # 鍏ㄨ瀛楃锛堥櫎绌烘牸锛夋牴鎹叧绯昏浆鍖� + inside_code -= 65248 + rstring += chr(inside_code) + return rstring + + if __name__ == "__main__": - print(trade_time_sub("11:29:59", "13:00:00")) - print(trade_time_sub("11:29:59", "14:00:00")) - print(trade_time_sub("10:29:59", "11:29:59")) - print(trade_time_sub("13:29:59", "14:29:59")) + print(trade_time_add_second("11:29:59", 1)) + print(trade_time_add_second("11:29:59", 5)) + print(trade_time_add_second("10:29:59", 10)) + print(trade_time_add_second("13:29:59", 60)) -- Gitblit v1.8.0